Stores
| Route | Scope | What it does |
|---|---|---|
GET /v1/stores | read | lists stores |
GET /v1/stores/{id} | read | shows a store |
POST /v1/stores | write | creates a store |
PATCH /v1/stores/{id} | write | updates a store |
DELETE /v1/stores/{id} | delete | deletes a store (see the rules below) |
Fields
| Field | Type | Description |
|---|---|---|
id | UUID | identifier |
name | text | store name |
is_active | yes/no | deactivated stores do not accept new products |
created_at, updated_at | date-time | creation and last change |
List
| Parameter | Description |
|---|---|
q | search in the name |
is_active | true or false |
updated_since | only those created or changed since that instant |
limit, cursor | pagination |
Create and update
| Field | Required | Rules |
|---|---|---|
name | yes on POST | 1 to 100 characters |
is_active | no | true or false (default true) |
id | no (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.