Products
The catalog layer — products, images and batches. One product can have many passports, one per serialised unit, each with its own QR code.
/api/v1/productsCreate a product
Create a product. The category template is resolved automatically from the `category` slug — must match a seeded category (e.g. `battery`, `textile`, `jewelry`). Model strings are unique within the workspace.
/api/v1/products/{id}Get a single product
Read one product by ID. Returns the full document including default field values, image URLs, template reference, and the running `passportCount`. No daily read counter is consumed by this endpoint.
/api/v1/productsList products
Paginated list of every product the workspace owns, sorted by `createdAt` descending. Page size capped at 100. Filter by category slug, status (`active` / `archived`), or a free-text search across name + model.
/api/v1/products/{id}Update a product
Patch one or more product fields. Send only the keys you want to change — omitted fields stay untouched. The whole-array semantics on `imageUrls` are intentional: your CMS is the canonical image set, so a PATCH with `imageUrls: ["a","b"]` replaces whatever was there. To append a single image without rewriting the list, use the multipart upload endpoint instead.
/api/v1/products/{id}/imagesUpload a product image
Upload a single image file (multipart/form-data, field name `file`) and append it to the product's `imageUrls` array. Use this when you don't have a CDN URL ready — TracePass stores the image and returns its public URL in the response.
/api/v1/products/{id}/archiveArchive a product
Soft-archive. `Product.status` flips to `archived`; the change is one-way (no endpoint unarchives a product). Archived products still appear in `GET /api/v1/products`; pass `status=active` to leave them out. Allowed only once every passport of the product is archived (409 otherwise) — and archiving a product does not prevent new passport creation against it.
/api/v1/products/{id}Delete a product permanently
**Permanent and irreversible.** Removes the product row + any uploaded documents whose only reference was this product (documents linked to other products/passports stay, just with `productId` unset). Stored files that belonged only to this product are deleted too.