{"openapi":"3.1.0","info":{"title":"Zhopwe Store API","version":"v1","description":"Store-scoped REST API. Authenticate with a merchant API key (zk_…) or an app access token (zat_…) as `Authorization: Bearer`. The path carries the version; an `Accept-Version` header, if sent, must be 1 or v1 (406 otherwise). Every error is JSON: {error, message, request_id[, fields]}."},"servers":[{"url":"https://zhopwe.com"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"fields":{"type":"object"}}}}}}}},"paths":{"/api/v1/me":{"get":{"operationId":"me","summary":"The credential in use: its scopes, rate limit and store.","security":[{"bearer":[]}],"x-required-scope":null,"parameters":[],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/products":{"get":{"operationId":"products","summary":"List products, newest first.","security":[{"bearer":["products:read"]}],"x-required-scope":"products:read","parameters":[{"name":"page","in":"query","required":false,"description":"integer","schema":{"type":"string"}},{"name":"per_page","in":"query","required":false,"description":"integer (max 100)","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"draft | active | archived","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"products.create","summary":"Create a single-variant product.","security":[{"bearer":["products:write"]}],"x-required-scope":"products:write","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"description":"string, required"},"price":{"description":"decimal string, required"},"slug":{"description":"string"},"status":{"description":"draft | active"},"sku":{"description":"string"},"stock":{"description":"integer"},"track_inventory":{"description":"boolean"},"compare_at":{"description":"decimal string"},"low_stock_threshold":{"description":"integer"},"subtitle":{"description":"string"},"description":{"description":"string"}}}}}}}},"/api/v1/products/{id}":{"get":{"operationId":"product","summary":"One product with its variants, by id or public id.","security":[{"bearer":["products:read"]}],"x-required-scope":"products:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"products.update","summary":"Change a product; only the fields sent change (price, stock, status, title, …).","security":[{"bearer":["products:write"]}],"x-required-scope":"products:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"price":{"description":"decimal string"},"stock":{"description":"integer"},"status":{"description":"draft | active"},"title":{"description":"string"},"sku":{"description":"string"}}}}}}}},"/api/v1/orders":{"get":{"operationId":"orders","summary":"List orders, newest first. Each carries payment_state (unpaid | partially_paid | paid) and amount_due_minor, the customer and delivery details (customer_name, phone_alt, whatsapp, shipping_address, payment_method, shipping_method, customer_note, locale, is_test) and its items. No courier is ever assigned or implied.","security":[{"bearer":["orders:read"]}],"x-required-scope":"orders:read","parameters":[{"name":"page","in":"query","required":false,"description":"integer","schema":{"type":"string"}},{"name":"per_page","in":"query","required":false,"description":"integer (max 100)","schema":{"type":"string"}},{"name":"payment_status","in":"query","required":false,"description":"pending | authorized | paid | partially_refunded | refunded | failed | canceled | expired","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"ISO-8601 date-time (2026-10-22T10:00:00Z) or \"Y-m-d H:i:s\" in UTC; INCLUSIVE (updated_at >= since). 422 when unreadable.","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"updated_asc: oldest change first (updated_at, then id). Omitted: newest first.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/orders/{id}":{"get":{"operationId":"order","summary":"One order with its lines and the same fields as the list.","security":[{"bearer":["orders:read"]}],"x-required-scope":"orders:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/orders/{id}/payment-proofs/{proof}":{"get":{"operationId":"order.payment_proof","summary":"One payment screenshot of an order (the file itself: image/jpeg, image/png, image/webp or application/pdf). Listed under payment_verification.screenshots once staff have verified the payment with its bank reference.","security":[{"bearer":["orders:read"]}],"x-required-scope":"orders:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/orders/{id}/payments":{"post":{"operationId":"orders.payments","summary":"Record money received (bank transfer, advance). A partial amount leaves the order partially_paid; more than is owed is refused.","security":[{"bearer":["orders:write"]}],"x-required-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"description":"decimal string, required"},"reference":{"description":"string"}}}}}}}},"/api/v1/orders/{id}/fulfillments":{"post":{"operationId":"orders.fulfil","summary":"Mark items sent (all remaining items when `items` is omitted).","security":[{"bearer":["orders:write"]}],"x-required-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"description":"[{item_id, quantity}]"},"carrier":{"description":"string"},"tracking_number":{"description":"string"},"notify_customer":{"description":"boolean"}}}}}}}},"/api/v1/orders/{id}/cancel":{"post":{"operationId":"orders.cancel","summary":"Cancel an order that has not been sent (OrderService::cancel: restocks when asked, publishes order.cancelled).","security":[{"bearer":["orders:write"]}],"x-required-scope":"orders:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"description":"string"},"restock":{"description":"boolean"},"note":{"description":"string"}}}}}}}},"/api/v1/customers":{"get":{"operationId":"customers","summary":"List active customers, newest first.","security":[{"bearer":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"page","in":"query","required":false,"description":"integer","schema":{"type":"string"}},{"name":"per_page","in":"query","required":false,"description":"integer (max 100)","schema":{"type":"string"}},{"name":"email","in":"query","required":false,"description":"exact address","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"operationId":"customers.create","summary":"Create a customer record (no password: the person can claim it by signing up).","security":[{"bearer":["customers:write"]}],"x-required-scope":"customers:write","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"description":"string, required"},"first_name":{"description":"string"},"last_name":{"description":"string"},"phone":{"description":"string"},"accepts_marketing":{"description":"boolean"},"locale":{"description":"en | si | ta"}}}}}}}},"/api/v1/customers/{id}":{"get":{"operationId":"customer","summary":"One customer.","security":[{"bearer":["customers:read"]}],"x-required-scope":"customers:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"operationId":"customers.update","summary":"Change a customer; only the fields sent change.","security":[{"bearer":["customers:write"]}],"x-required-scope":"customers:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"description":"string"},"last_name":{"description":"string"},"phone":{"description":"string"},"accepts_marketing":{"description":"boolean"},"status":{"description":"active | disabled"}}}}}}}},"/api/v1/inventory":{"get":{"operationId":"inventory","summary":"Stock per active variant: on_hand, reserved, available.","security":[{"bearer":["inventory:read"]}],"x-required-scope":"inventory:read","parameters":[{"name":"page","in":"query","required":false,"description":"integer","schema":{"type":"string"}},{"name":"per_page","in":"query","required":false,"description":"integer (max 100)","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/inventory/{id}":{"get":{"operationId":"inventory.item","summary":"Stock for one variant, by variant id or public id.","security":[{"bearer":["inventory:read"]}],"x-required-scope":"inventory:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/inventory/{id}/adjustments":{"post":{"operationId":"inventory.adjust","summary":"Change stock by `delta`, or set `on_hand` absolutely (exactly one of the two).","security":[{"bearer":["inventory:write"]}],"x-required-scope":"inventory:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"description":"8–100 characters of [A-Za-z0-9_-:.]. A retry with the same key and body returns the first response; a different body is refused.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"201":{"description":"Created"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"delta":{"description":"integer"},"on_hand":{"description":"integer"},"note":{"description":"string"}}}}}}}},"/api/v1/returns":{"get":{"operationId":"returns","summary":"List return requests, newest first.","security":[{"bearer":["returns:read"]}],"x-required-scope":"returns:read","parameters":[{"name":"page","in":"query","required":false,"description":"integer","schema":{"type":"string"}},{"name":"per_page","in":"query","required":false,"description":"integer (max 100)","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"requested | approved | rejected | in_transit | received | completed | canceled","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/api/v1/returns/{id}":{"get":{"operationId":"return","summary":"One return request with its lines.","security":[{"bearer":["returns:read"]}],"x-required-scope":"returns:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"406":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}}}}