Skip to main content

Stores

RouteScopeWhat it does
GET /v1/storesreadlists stores
GET /v1/stores/{id}readshows a store
POST /v1/storeswritecreates a store
PATCH /v1/stores/{id}writeupdates a store
DELETE /v1/stores/{id}deletedeletes a store (see the rules below)

Fields​

FieldTypeDescription
idUUIDidentifier
nametextstore name
is_activeyes/nodeactivated stores do not accept new products
created_at, updated_atdate-timecreation and last change

List​

ParameterDescription
qsearch in the name
is_activetrue or false
updated_sinceonly those created or changed since that instant
limit, cursorpagination

Create and update​

FieldRequiredRules
nameyes on POST1 to 100 characters
is_activenotrue or false (default true)
idno (POST only)UUID you generate
curl -X PATCH https://api.validades.com/v1/stores/STORE_ID \
-H "Authorization: Bearer vld_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"is_active": false}'

Deleting a store​

Cascade deletion

A store may have products and batches. Deleting a store with cascade=true also deletes all its products and all the batches of those products, on every device of the organization. The deletion is permanent for you.

1. Check first, without deleting anything: dry_run=true​

curl -X DELETE "https://api.validades.com/v1/stores/STORE_ID?cascade=true&dry_run=true" \
-H "Authorization: Bearer vld_live_YOUR_KEY"
{
"data": {
"id": "…",
"dry_run": true,
"requires_cascade": true,
"would_delete": { "store": 1, "products": 132, "batches": 410 },
"members_unassigned": 3
}
}

members_unassigned is the number of organization members linked to that store who lose the link.

2. Without cascade, a store with products is not deleted​

{
"error": {
"code": "store_has_products",
"internal_code": 111,
"message": "…",
"request_id": "req_…",
"details": { "products": 132, "batches": 410 }
}
}

A store without products is deleted normally, without cascade.

3. Delete for real: cascade=true​

curl -X DELETE "https://api.validades.com/v1/stores/STORE_ID?cascade=true" \
-H "Authorization: Bearer vld_live_YOUR_KEY"
{
"data": {
"id": "…",
"cascade": true,
"deleted": { "store": 1, "products": 132, "batches": 410 },
"members_unassigned": 3
}
}

After the deletion:

  • the owner and admins get an email with the store, the key used, the counts, the IP and the request_id;
  • the store and each product show up in the organization's activity log;
  • the store, the products and the batches show up in /v1/deletions;
  • Validades keeps a copy of the deleted data for 30 days, for support purposes only. It is not a backup and does not guarantee recovery. If it was a mistake, contact support as soon as possible, with the request_id.

Accepts If-Match.