PIM API Reference
Base path: `/api/pim/`
Authentication: Bearer token (JWT) or API key (X-API-Key header).
Product Schema#
GET /api/pim/schema/#
Returns the tenant's current product schema. Returns empty fields list if no schema has been defined yet.
Response
PUT /api/pim/schema/#
Replace the tenant's product schema.
Request body
Response — updated ProductSchema object (same shape as GET)
Products#
GET /api/pim/products/#
List products with pagination. Supports dynamic field filtering and text search.
Query params
| Param | Type | Description |
|---|---|---|
q | string | Text search on name (case-insensitive contains) |
<field_name> | string | Filter by data->>'field_name' exact match (e.g. ?brand=Nike) |
page | int | Page number (default 1) |
page_size | int | Results per page (default 50, max 200) |
Response
GET /api/pim/products/{id}/#
Retrieve a single product by internal ID.
PATCH /api/pim/products/{id}/#
Update product name and/or data.
Request body
DELETE /api/pim/products/{id}/#
Delete a product.
POST /api/pim/products/#
Create a single product.
Request body
POST /api/pim/products/bulk/#
Bulk upsert by SKU. Creates new products or updates existing ones.
Request body
Fields beyond sku and name are stored in data.
Response
Facets#
GET /api/pim/facets/#
Returns distinct values for string and array schema fields. Useful for building filter UI.
Response
Values are limited to 100 per field, computed from the first 1,000 products.
CSV Import#
POST /api/pim/import/csv/#
Upload a CSV file. Returns AI-suggested schema and column mapping synchronously (< 3s).
Request — multipart/form-data
| Field | Type | Required |
|---|---|---|
file | File | Yes — UTF-8 CSV |
Response
GET /api/pim/import/{job_id}/#
Poll import job status.
Response
Status values: pending → mapping (after upload) → importing (task running) → done or failed
POST /api/pim/import/{job_id}/confirm/#
Confirm the column mapping and schema, start the import task.
Request body
mapping— maps each CSV header to a schema field name, ornullto skipschema— full list of schema fields to save; replaces existingProductSchema.fieldsdefault_currency/default_locale— optional, updatesProductSchema
Response
Errors
| Code | Condition |
|---|---|
| 400 | Job already in importing, done, or failed state |
| 404 | Job not found for this tenant |
Product Segments#
Base path: /api/product-segments/
GET /api/product-segments/#
List all product segments for the authenticated tenant.
Response:
POST /api/product-segments/#
Create a new product segment.
Request body:
Response: 201 Created — full ProductSegment object.
GET /api/product-segments/{id}/#
Retrieve a single product segment.
PATCH /api/product-segments/{id}/#
Update a product segment (partial update).
DELETE /api/product-segments/{id}/#
Delete a product segment.
POST /api/product-segments/preview/#
Run a live preview of a segment definition without saving. Returns matched SKUs and the compiled SQL.
Request body: Full definition object (see DSL format above).
Response:
POST /api/product-segments/{id}/compute/#
Enqueue a Celery task to recompute segment membership for the given segment. Returns 200 OK with { "status": "queued", "segment_id": <id> } immediately.
The segment's computed_count and last_computed_at fields update when the task completes (poll GET /api/product-segments/{id}/ to detect completion).
GET /api/product-segments/{id}/members/#
Return matched products for a computed segment. Joins product_memberships (ClickHouse) with Product (Postgres) to return full product details.
Query params:
cursor— pagination cursor
Response:
next_cursor is the integer offset to pass as the next cursor query param, or null on the last page.