openapi: 3.1.0 info: title: Sifr Wahid public API summary: Public API for Sifr Wahid stores version: 1.0.0 description: > The public API of a Sifr Wahid store, for machines. A key is bound to one store: every answer is about that store only. Send the key as a bearer token. Each operation names the scope it needs in x-scope; a key with {resource}.read_write also holds {resource}.read. The API is a Pro plan feature (public_api): only Pro stores create keys, and a key of a store on any other plan is answered 402 feature_locked with required_plan pro (null while the Pro plan is not on sale). Webhooks are Pro only as well (webhooks). Conventions: money is an integer in halalas (1 SAR = 100 halalas); dates are ISO 8601 in UTC; translated text is an object {ar, en} whose members may be null; errors are {error: {code, message, fields?}}. Lists are sync lists ordered by (updated_at, id) and read page by page with meta.next_cursor. servers: - url: https://s.zo.sa/api/public/v1 security: - bearerAuth: [] components: securitySchemes: bearerAuth: type: http scheme: bearer description: A store API key (zo_live_...), created by the owner of a Pro store in the dashboard. parameters: Id: name: id in: path required: true schema: {type: integer, minimum: 1} Delivery: name: delivery in: path required: true schema: {type: integer, minimum: 1} PerPage: name: per_page in: query description: Rows per page, 1 to 100 (default 50; more is capped at 100). schema: {type: integer, minimum: 1, default: 50} Cursor: name: cursor in: query description: The meta.next_cursor of the previous page. Opaque. schema: {type: string, maxLength: 200} UpdatedSince: name: updated_since in: query description: Only rows updated at or after this time (ISO 8601, inclusive to the second; no offset means UTC). schema: {type: string, format: date-time} CreatedSince: name: created_since in: query description: Only rows created at or after this time (ISO 8601, inclusive to the second; no offset means UTC). schema: {type: string, format: date-time} IdempotencyKey: name: Idempotency-Key in: header required: false description: > 1 to 120 visible ASCII characters. A write sent again with the same key runs once; the retry gets the first answer back with the header Idempotent-Replayed: true. Use a new key for each new write. schema: {type: string, minLength: 1, maxLength: 120} responses: Unauthenticated: description: Missing, unknown, revoked or expired key. content: application/json: schema: {$ref: '#/components/schemas/Error'} Forbidden: description: > The key lacks the scope (code insufficient_scope, naming it in scope), the caller's address is not allowed (ip_not_allowed), or the store is suspended (store_suspended: reads stay allowed, every write answers this). content: application/json: schema: {$ref: '#/components/schemas/Error'} NotFound: description: No such row in this store (code not_found). content: application/json: schema: {$ref: '#/components/schemas/Error'} ValidationFailed: description: A query parameter is invalid (code validation_failed, with fields). content: application/json: schema: {$ref: '#/components/schemas/Error'} RateLimited: description: Too many requests (code rate_limited); see Retry-After. content: application/json: schema: {$ref: '#/components/schemas/Error'} FeatureLocked: description: > The store's plan does not include this feature (error code feature_locked, with the feature and the plan that has it). Every operation answers it with feature public_api when the key's store is not on the Pro plan. content: application/json: schema: {$ref: '#/components/schemas/Error'} WriteValidationFailed: description: > The body is invalid (code validation_failed). fields names each invalid input by its path in the body, such as variants.0.sku or images.1.url. content: application/json: schema: {$ref: '#/components/schemas/Error'} Conflict: description: A write with the same Idempotency-Key is still running (code duplicate_request); retry shortly. content: application/json: schema: {$ref: '#/components/schemas/Error'} NoContent: description: Done; no body. schemas: Error: type: object required: [error] properties: error: type: object required: [code, message] properties: code: {type: string, examples: [not_found, validation_failed, insufficient_scope]} message: {type: string} fields: type: object description: > Per-field messages, keyed by the input's path in the body or query. Sent with validation_failed, insufficient_stock and stock_managed_by_codes. additionalProperties: type: array items: {type: string} available: type: integer description: With insufficient_stock, the quantity on hand of the refused line (fields names it). customer_id: type: integer description: With customer_exists, the store's customer that already has this mobile. scope: type: string description: With insufficient_scope, the scope the key lacks. feature: type: string description: With feature_locked, the plan feature the call needs. required_plan: type: [string, 'null'] description: With feature_locked, the cheapest plan that includes the feature. items: type: array description: With out_of_stock, the indexes of the order lines without enough stock. items: {type: integer} from: type: string description: With invalid_transition, the order's current status. to: type: string description: With invalid_transition, the status asked for. ListMeta: type: object required: [per_page, next_cursor] properties: per_page: {type: integer} next_cursor: type: [string, 'null'] description: Pass as cursor for the next page; null on the last page. Translated: type: object required: [ar, en] properties: ar: {type: [string, 'null']} en: {type: [string, 'null']} Store: type: object required: [id, name, slug, url, currency, language, status, created_at] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} slug: {type: string} url: {type: string, format: uri} currency: {type: string, examples: [SAR]} language: {type: string, enum: [ar, en]} status: {type: string} created_at: {type: string, format: date-time} Variant: type: object description: > One sellable combination of the product's options. price and sale_price are what this variant sells for: the product's own when the variant sets none. required: [id, sku, barcode, price, sale_price, quantity, unlimited, hidden, weight_grams, options] properties: id: {type: integer} sku: {type: [string, 'null']} barcode: {type: [string, 'null']} price: {type: integer, description: Halalas.} sale_price: type: [integer, 'null'] description: > Halalas. Applies only between the product's sale_starts_at and sale_ends_at (a null end is open, so both null means always); outside that window the variant sells at price. quantity: {type: integer, description: Stock across all branches.} unlimited: {type: boolean, description: True when stock is not tracked; quantity is then no limit.} hidden: {type: boolean, description: Hidden from shoppers by the merchant; still part of the catalogue.} weight_grams: {type: [integer, 'null']} options: type: array items: type: object required: [name, value] properties: name: {$ref: '#/components/schemas/Translated'} value: {$ref: '#/components/schemas/Translated'} Product: type: object description: > A product has at least one variant (a product without options has exactly one), and prices live on its variants. required: [id, type, status, name, description, slug, url, images, images_pending, categories, brand, variants, sale_starts_at, sale_ends_at, created_at, updated_at] properties: id: {type: integer} type: {type: string, enum: [physical, service, food, digital, card, group, booking]} status: {type: string, enum: [draft, active, hidden]} name: {$ref: '#/components/schemas/Translated'} description: {$ref: '#/components/schemas/Translated'} slug: {type: string} url: {type: string, format: uri, description: The product page on the storefront.} images: type: array items: type: object required: [id, url, alt, sort] properties: id: {type: integer} url: {type: string, format: uri} alt: {type: [string, 'null'], description: Reserved; null until images carry alt text.} sort: {type: integer} images_pending: type: array description: > Picture links sent in a write that are copied in the background, usually within seconds. A link stays here with status pending until its copy joins images (and product.updated is sent), or with status failed when it could not be copied; failed links stay until the next picture write. Empty when nothing waits. items: {$ref: '#/components/schemas/PendingImage'} categories: type: array items: type: object required: [id, name, slug] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} slug: {type: string} brand: oneOf: - type: 'null' - type: object required: [id, name, slug] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} slug: {type: [string, 'null'], description: Reserved; null until brands carry slugs.} variants: type: array items: {$ref: '#/components/schemas/Variant'} sale_starts_at: {type: [string, 'null'], format: date-time, description: When the variants' sale_price starts to apply; null means from any time.} sale_ends_at: {type: [string, 'null'], format: date-time, description: When the variants' sale_price stops applying; null means no end.} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} Category: type: object required: [id, name, slug, parent_id, sort, is_active, products_count, created_at, updated_at] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} slug: {type: string} parent_id: {type: [integer, 'null']} sort: {type: integer} is_active: {type: boolean, description: False when the merchant hid the category from the storefront.} products_count: {type: integer, description: Products in this category itself (not its subcategories).} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} Brand: type: object required: [id, name, slug, logo_url, created_at, updated_at] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} slug: {type: [string, 'null'], description: Reserved; null until brands carry slugs.} logo_url: {type: [string, 'null'], description: Reserved; null until brands carry logos.} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} TranslatedInput: type: object required: [ar] properties: ar: {type: string} en: {type: [string, 'null']} ImageInput: type: object required: [url] description: > A picture the store copies from a public http(s) address (ports 80 and 443 only). A link that is not http(s), uses another port, or names a private, loopback, link-local or reserved address is refused with 422. The copy runs in the background after the answer: the link shows in the product's images_pending until it joins images. A name that resolves to a private address, or a file that is not a JPEG, PNG, WebP or GIF of at most 15 MB, ends as status failed with error image_unreachable. A store has at most 50 links waiting at a time: a write that would pass that is refused with 429 images_queue_full and a Retry-After header, and changes nothing. properties: url: {type: string, format: uri, maxLength: 2000} PendingImage: type: object required: [source_url, status, error] properties: source_url: {type: string, format: uri, description: The link as it was sent.} status: {type: string, enum: [pending, failed]} error: type: [string, 'null'] enum: [image_unreachable, too_many_images, copy_failed, null] description: Why a failed link was not copied; null while pending. too_many_images when the product already had 10 pictures by the time the copy finished; copy_failed when the copy job itself stopped, or ran out of time before this link (a job downloads for 60 seconds at most, 10 per link), so send it again in a new write. ProductImage: type: object required: [id, url, alt, sort] properties: id: {type: integer} url: {type: string, format: uri} alt: {type: [string, 'null'], description: Reserved; null until images carry alt text.} sort: {type: integer} ProductInput: type: object description: > A product to create (POST, where name and variants are required) or to change (PATCH: only the keys sent change; name and description merge per language, so name.ar may be left out). Keys not listed here are ignored. On PATCH, options, variants and images each replace the whole set when sent (images when the background copy finishes: when at least one link copies, the pictures become the copies in the order sent; when none copies they stay as they were; an empty list removes them at once): an option or value sent with the same Arabic name as a saved one keeps it, and a variant whose values are all kept keeps its stock and id. Send options with variants when the product has options. Stock is never set here: a quantity key anywhere is refused with 422; use POST /inventory/adjustments. Prices are in halalas. A product without options has exactly one variant, whose price is the product's price. Dropping an option value on PATCH deletes the variants made with it, and their stock. A product with options cannot be turned back into one without options through the API in this version. properties: name: {$ref: '#/components/schemas/TranslatedInput'} description: type: [object, 'null'] description: HTML is cleaned to the storefront's safe subset. properties: ar: {type: [string, 'null'], maxLength: 10000} en: {type: [string, 'null'], maxLength: 10000} type: type: string enum: [physical, service, food, digital, card, group, booking] description: Types other than physical need the plan feature all_product_types (402 feature_locked without it). status: type: string enum: [draft, active, hidden] description: Default draft. An active product that ships needs weight_grams. slug: {type: [string, 'null'], maxLength: 120, description: 'Letters of any language, digits and single dashes. Made unique in the store.'} category_ids: type: array items: {type: integer} brand_id: {type: [integer, 'null']} weight_grams: {type: [integer, 'null'], minimum: 0, maximum: 1000000, description: The product's weight; every variant ships at it.} track_stock: {type: boolean, description: 'Default true. False makes every variant unlimited.'} images: type: array maxItems: 10 items: {$ref: '#/components/schemas/ImageInput'} options: type: array maxItems: 3 items: type: object required: [name, values] properties: name: {$ref: '#/components/schemas/TranslatedInput'} values: type: array minItems: 1 maxItems: 30 items: type: object required: [key, name] properties: key: {type: string, maxLength: 40, description: 'Your own label for the value, unique in the body; variants refer to it.'} name: {$ref: '#/components/schemas/TranslatedInput'} variants: type: array minItems: 1 maxItems: 100 description: > One per combination of option values (at most 100): each variant's values hold exactly one key of every option, and no two variants hold the same combination (422 on variants.N.values otherwise). A combination left out is created at the product's price; on PATCH a saved one left out keeps its details. items: type: object required: [price] properties: values: type: array description: The keys of this variant's option values, one per option. Required when options are sent. items: {type: string} sku: {type: [string, 'null'], maxLength: 64, description: Unique in the store.} barcode: {type: [string, 'null'], maxLength: 64} price: {type: integer, minimum: 0, maximum: 99999999} sale_price: {type: [integer, 'null'], minimum: 0, description: Below price.} weight_grams: {type: [integer, 'null'], minimum: 0, description: 'The product''s weight_grams, given per variant: every variant must send the same value.'} track_stock: {type: boolean, description: 'The product''s track_stock, given per variant: every variant must send the same value.'} hidden: {type: boolean} sale_starts_at: {type: [string, 'null'], format: date-time, description: 'A bare date is that whole day in Riyadh.'} sale_ends_at: {type: [string, 'null'], format: date-time} CategoryInput: type: object description: A category to create (POST, name required) or change (PATCH, only the keys sent change; name merges per language). properties: name: {$ref: '#/components/schemas/TranslatedInput'} slug: {type: [string, 'null'], maxLength: 120, description: Made unique in the store; from the name when left out.} parent_id: {type: [integer, 'null'], description: 'Null for a top-level category. Categories nest at most 3 levels.'} sort: {type: integer, minimum: 0, description: Position among its siblings; after the last when left out.} is_active: {type: boolean} BrandInput: type: object required: [name] properties: name: {$ref: '#/components/schemas/TranslatedInput'} OrderCustomer: type: object description: > Who placed the order. Without the customers.read scope only id and name are present; with it, mobile and email are added. required: [id, name] properties: id: {type: [integer, 'null'], description: "The customer record (GET /customers/{id})."} name: {type: [string, 'null']} mobile: {type: [string, 'null'], description: Present only with customers.read. E.164 for Saudi numbers.} email: {type: [string, 'null'], description: Present only with customers.read.} ShippingAddress: type: object required: [name, mobile, country, city, district, street, building, postal_code, details] properties: name: {type: [string, 'null'], description: The recipient (the customer unless the address names someone else).} mobile: {type: [string, 'null']} country: {type: string, description: ISO 3166-1 alpha-2; SA unless the address says otherwise.} city: {type: [string, 'null'], description: The city's name as the shopper reads it.} district: {type: [string, 'null']} street: {type: [string, 'null']} building: {type: [string, 'null']} postal_code: {type: [string, 'null']} details: {type: [string, 'null'], description: "Address details the shopper typed (landmark, floor and so on)."} OrderItem: type: object required: [id, product_id, variant_id, sku, name, quantity, unit_price, total, options] properties: id: {type: integer} product_id: {type: [integer, 'null'], description: Null when the line is not tied to a product.} variant_id: {type: [integer, 'null']} sku: {type: [string, 'null']} name: {$ref: '#/components/schemas/Translated'} quantity: {type: integer} unit_price: {type: integer, description: Halalas.} total: {type: integer, description: Halalas.} options: description: The chosen option values as one text (for example "Red / L"); null for a product without options. oneOf: - type: 'null' - $ref: '#/components/schemas/Translated' Order: type: object description: > An order. shipping_address is present only with the customers.read scope (null for an order with nothing to ship) and so is customer_note; without that scope both keys are absent. Card codes, gift links, file paths and merchant notes are never shown. required: [id, number, status, payment_status, payment_method, source, currency, totals, customer, items, created_at, updated_at] properties: id: {type: integer} number: {type: string, description: The order number the merchant and the shopper see.} status: {type: string, enum: [awaiting_payment, under_review, in_progress, ready, shipping, delivered, completed, cancelled, return_in_progress, returned]} payment_status: {type: string, enum: [pending, paid, refund_due, refunded]} payment_method: {type: string, enum: [cod, bank_transfer, online, manual]} source: {type: [string, 'null'], description: "Where the order came from: storefront, manual (typed in the dashboard), api (created through this API), or a marketplace (trendyol, amazon)."} currency: {type: string, examples: [SAR]} totals: type: object required: [subtotal, discount, shipping, tax, total] description: > Halalas. shipping includes the cash-on-delivery fee; tax is the VAT already included in total. total may also hold paid order options. properties: subtotal: {type: integer} discount: {type: integer} shipping: {type: integer} tax: {type: integer} total: {type: integer} customer: {$ref: '#/components/schemas/OrderCustomer'} customer_note: {type: [string, 'null'], description: "What the shopper wrote with the order. Present only with customers.read (free text that may hold contact details)."} shipping_address: oneOf: - type: 'null' - $ref: '#/components/schemas/ShippingAddress' items: type: array items: {$ref: '#/components/schemas/OrderItem'} created_at: {type: string, format: date-time, description: When the order was placed.} updated_at: {type: string, format: date-time} OrderItemInput: type: object required: [quantity] properties: sku: {type: string, maxLength: 64, description: "The variant's exact SKU. Either sku or variant_id is required; with both, the variant must match both."} variant_id: {type: integer} quantity: {type: integer, minimum: 1, maximum: 999} unit_price: {type: [integer, 'null'], minimum: 0, maximum: 99999999, description: "Halalas. Left out: the variant's current price (its sale price while the sale runs)."} OrderCustomerInput: type: object required: [name, mobile] description: > A new or returning shopper, matched by mobile: a known mobile is that customer, and their stored name and email are kept (the ones sent are used only for a new customer). Needs customers.read (422 customers_scope_required). properties: name: {type: string, maxLength: 100} mobile: {type: string, maxLength: 20, description: "A Saudi mobile in any common form (05..., 9665..., +9665...)."} email: {type: [string, 'null'], format: email, maxLength: 190} OrderInput: type: object required: [items, payment_method] description: > An order the store took outside the storefront. Send customer_id (one of this store's customers) or customer, not both. Totals, VAT, status and payment status are worked out by the store and never read from the body (a total, subtotal, vat, status or payment_status sent is ignored). Stock is taken for each tracked item. The new order's source is api. properties: customer_id: {type: integer, description: "An existing customer of this store (GET /customers). Their name, mobile and email are used."} customer: {$ref: '#/components/schemas/OrderCustomerInput'} items: type: array minItems: 1 maxItems: 50 items: {$ref: '#/components/schemas/OrderItemInput'} payment_method: type: string enum: [cod, bank_transfer, manual] description: > cod: paid on delivery. bank_transfer: the order waits in awaiting_payment until the merchant confirms the transfer. manual: already paid (payment_status paid). Online card payment is not available here. shipping_method_id: {type: [integer, 'null'], description: "One of the store's shipping methods; its fee applies unless shipping_fee is sent."} shipping_fee: {type: [integer, 'null'], minimum: 0, maximum: 9999999, description: Halalas.} discount: {type: [integer, 'null'], minimum: 0, maximum: 99999999, description: "Halalas, at most the subtotal."} address: type: [object, 'null'] properties: city: {type: [string, 'null'], maxLength: 80} district: {type: [string, 'null'], maxLength: 80} street: {type: [string, 'null'], maxLength: 190} details: {type: [string, 'null'], maxLength: 190} customer_note: {type: [string, 'null'], maxLength: 500, description: "The shopper's note, shown on the order (customer_note)."} OrderStatusInput: type: object required: [status] properties: status: {type: string, enum: [awaiting_payment, under_review, in_progress, ready, shipping, delivered, completed, cancelled, return_in_progress, returned], description: "A status the order may move to from its current one (GET /order-statuses)."} note: {type: [string, 'null'], maxLength: 300, description: "Kept in the order's history; sent to the shopper with the status message only when the store sends notes."} OrderHistoryEntry: type: object required: [from_status, to_status, actor, note, at] properties: from_status: {type: [string, 'null'], description: Null on the entry that placed the order.} to_status: {type: string} actor: {type: string, examples: [shopper, merchant, system, api, channel, customer]} note: type: [string, 'null'] description: > The merchant's note on a status change, only when the store sends that note to the shopper; null otherwise (internal notes are never shown). at: {type: string, format: date-time} OrderStatus: type: object required: [status, next] properties: status: {type: string} next: type: array description: The statuses an order in this status may move to. items: {type: string} Customer: type: object required: [id, name, mobile, email, orders_count, created_at, updated_at] properties: id: {type: integer} name: {type: string} mobile: {type: [string, 'null'], description: E.164 for Saudi numbers.} email: {type: [string, 'null']} orders_count: {type: integer, description: The customer's orders in this store (deleted orders not counted).} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} CustomerInput: type: object required: [name, mobile] properties: name: {type: string, maxLength: 100} mobile: {type: string, maxLength: 20, description: 'Any common form (0501234567, 966501234567, +966501234567); stored as E.164, as the storefront stores it.'} email: {type: [string, 'null'], format: email, maxLength: 190} note: {type: [string, 'null'], maxLength: 1000, description: The merchant's own note on the customer. Kept inside the store; never shown back by the API.} CustomerUpdate: type: object description: > Only the keys sent change. The mobile is the customer's identity in the store and cannot be changed here: a body with mobile is refused (422, fields.mobile). Blocking is done from the dashboard: a body with is_blocked is refused (422). properties: name: {type: string, maxLength: 100} email: {type: [string, 'null'], format: email, maxLength: 190} note: {type: [string, 'null'], maxLength: 1000} StockLevel: type: object required: [variant_id, sku, branch_id, quantity, updated_at] properties: variant_id: {type: integer} sku: {type: [string, 'null']} branch_id: {type: integer} quantity: {type: integer} updated_at: {type: [string, 'null'], format: date-time} StockMovement: type: object required: [id, variant_id, branch_id, delta, quantity_after, reason, note, at] properties: id: {type: integer} variant_id: {type: integer} branch_id: {type: integer} delta: {type: integer, description: The change; negative when stock went out.} quantity_after: {type: integer, description: The branch's quantity right after the change.} reason: {type: string, examples: [sale, cancel, return, manual, received, damaged, stocktake]} note: {type: [string, 'null'], description: "Text the merchant typed with the change (or an order number on a sale); merchant-entered, not shopper data."} at: {type: string, format: date-time} Branch: type: object required: [id, name, is_default] properties: id: {type: integer} name: {$ref: '#/components/schemas/Translated'} is_default: {type: boolean} StockAdjustmentInput: type: object required: [items] properties: items: type: array minItems: 1 maxItems: 100 description: > Applied all together or not at all, in the order sent (two items for the same variant and branch see each other's change). items: type: object required: [mode, quantity] properties: sku: {type: string, maxLength: 64, description: "The variant's exact SKU. Either sku or variant_id is required; with both, the variant must match both."} variant_id: {type: integer} branch_id: {type: integer, description: "One of the store's branches (GET /branches); the default branch when left out."} mode: type: string enum: [increment, decrement, set] description: > increment adds quantity, decrement takes it away (never below zero: 409 insufficient_stock), set makes the branch's level exactly quantity. quantity: {type: integer, minimum: 0, maximum: 1000000, description: At least 1 for increment and decrement.} note: {type: [string, 'null'], maxLength: 255, description: Saved on the stock movement.} StockAdjustmentResult: type: object required: [variant_id, branch_id, quantity_after] properties: variant_id: {type: integer} branch_id: {type: integer} quantity_after: {type: integer, description: The branch's level after this item.} Coupon: type: object required: [id, code, type, value, min_subtotal, max_discount, free_shipping, usage_limit, per_customer_limit, uses, starts_at, ends_at, is_active, status, created_at, updated_at] properties: id: {type: integer} code: {type: string} type: {type: string, enum: [percent, fixed]} value: {type: integer, description: "A whole percent for type percent; halalas for type fixed."} min_subtotal: {type: [integer, 'null'], description: Halalas.} max_discount: {type: [integer, 'null'], description: Halalas.} free_shipping: {type: boolean} usage_limit: {type: [integer, 'null']} per_customer_limit: {type: [integer, 'null']} uses: {type: integer, description: How many times the coupon was used.} starts_at: {type: [string, 'null'], format: date-time} ends_at: {type: [string, 'null'], format: date-time} is_active: {type: boolean} status: {type: string, enum: [active, inactive, scheduled, expired, exhausted]} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} CouponInput: type: object description: > A coupon to create (POST: code, type and value required) or change (PATCH: only the keys sent change). The same rules as the dashboard's coupons page. properties: code: {type: string, maxLength: 40, pattern: '^[A-Za-z0-9_-]+$', description: 'Unique in the store; saved in capitals.'} type: {type: string, enum: [percent, fixed]} value: {type: integer, minimum: 1, description: 'A whole percent (at most 100) for percent; halalas for fixed.'} min_subtotal: {type: [integer, 'null'], minimum: 0, description: Halalas.} max_discount: {type: [integer, 'null'], minimum: 1, description: Halalas.} free_shipping: {type: boolean} usage_limit: {type: [integer, 'null'], minimum: 1} per_customer_limit: {type: [integer, 'null'], minimum: 1} starts_at: {type: [string, 'null'], format: date, description: 'The coupon works from the start of this day in Riyadh.'} ends_at: {type: [string, 'null'], format: date, description: 'Until the last second of this day in Riyadh; not before starts_at.'} is_active: {type: boolean, description: 'An expired coupon is switched back on only with an ends_at still ahead.'} applies_to: {type: string, enum: [all, products, categories], description: 'products needs product_ids, categories needs category_ids.'} product_ids: type: [array, 'null'] maxItems: 500 items: {type: integer} description: Products of this store. category_ids: type: [array, 'null'] maxItems: 200 items: {type: integer} description: Categories of this store. exclude_sale_items: {type: boolean} payment_methods: type: [array, 'null'] items: {type: string} description: Payment method codes the coupon is limited to. first_order_only: {type: boolean} exclude_wallet: {type: boolean} show_in_cart: {type: boolean} note: {type: [string, 'null'], maxLength: 190} ShipmentEvent: type: object required: [status, at] properties: status: {type: string} at: {type: [string, 'null'], format: date-time} note: {type: string, description: Present only when the event carries a note code.} Shipment: type: object description: A shipment. The carrier's raw answer and the label file are never shown. required: [id, order_id, carrier, status, tracking_number, tracking_url, cost, weight_grams, events, created_at, updated_at] properties: id: {type: integer} order_id: {type: integer} carrier: {type: string, description: A carrier code or manual.} status: {type: string, enum: [label_created, picked_up, in_transit, out_for_delivery, delivered, failed, returned, cancelled]} tracking_number: {type: [string, 'null']} tracking_url: {type: [string, 'null']} cost: {type: integer, description: Halalas.} weight_grams: {type: [integer, 'null']} events: type: array items: {$ref: '#/components/schemas/ShipmentEvent'} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} ShipmentInput: description: > Either a label booked with a platform carrier (carrier; the label is paid from the store's wallet and needs the carrier_integration plan feature), or a tracking number from the store's own carrier contract. oneOf: - type: object required: [carrier] properties: carrier: {type: string, description: 'A platform carrier code offered to the store, such as aramex.'} - type: object required: [tracking_number] properties: tracking_number: {type: string, maxLength: 80} tracking_url: {type: [string, 'null'], format: uri, maxLength: 255} carrier_name: {type: [string, 'null'], maxLength: 80} ReviewCustomer: type: object required: [id, name] properties: id: {type: integer} name: {type: [string, 'null'], description: Null when the reviewer asked to hide their name.} ReviewReply: type: object required: [body, at] properties: body: {type: string} at: {type: [string, 'null'], format: date-time} Review: type: object required: [id, type, product_id, order_id, customer, stars, factors, body, media, status, reply, created_at, updated_at] properties: id: {type: integer} type: {type: string, enum: [product, store, shipping]} product_id: {type: [integer, 'null']} order_id: {type: [integer, 'null']} customer: description: Null for a review with no customer record. oneOf: - type: 'null' - $ref: '#/components/schemas/ReviewCustomer' stars: {type: integer, minimum: 1, maximum: 5} factors: {type: [object, 'null'], description: Per-criterion ratings the shopper gave.} body: {type: [string, 'null']} media: type: array items: {type: string} description: Picture addresses. status: {type: string, enum: [pending, approved]} reply: oneOf: - type: 'null' - $ref: '#/components/schemas/ReviewReply' created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} ReviewReplyInput: type: object required: [body] properties: body: {type: string, minLength: 1, maxLength: 1000, description: 'The store''s reply, shown under the review in the store.'} Payment: type: object description: A payment on an order. The gateway, its reference and answer, and card details are never shown. required: [id, order_id, method, status, amount, fee, refunded, currency, paid_at, created_at] properties: id: {type: integer} order_id: {type: integer} method: {type: [string, 'null'], description: "The way the shopper paid (mada, visa, mastercard, apple_pay, stc_pay)."} status: {type: string, enum: [pending, paid, failed, refunded]} amount: {type: integer, description: Halalas.} fee: {type: integer, description: Halalas.} refunded: {type: integer, description: Halalas.} currency: {type: string, examples: [SAR]} paid_at: {type: [string, 'null'], format: date-time} created_at: {type: string, format: date-time} PaymentMethod: type: object required: [method, enabled] properties: method: {type: string, enum: [cod, bank_transfer, online]} enabled: {type: boolean, description: Whether the store takes this method at checkout now.} AbandonedCartCustomer: type: object required: [id, name] properties: id: {type: [integer, 'null'], description: Null for a guest.} name: {type: [string, 'null']} mobile: {type: [string, 'null'], description: Present only with customers.read.} email: {type: [string, 'null'], description: Present only with customers.read.} AbandonedCartItem: type: object required: [variant_id, sku, name, quantity, unit_price] properties: variant_id: {type: integer} sku: {type: [string, 'null']} name: {$ref: '#/components/schemas/Translated'} quantity: {type: integer} unit_price: {type: integer, description: Halalas at today price.} AbandonedCart: type: object description: A cart with items and a contact that sat idle past the store's reminder threshold. The cart token and recovery links are never shown. required: [id, customer, items, subtotal, currency, last_activity_at, reminders_sent, created_at, updated_at] properties: id: {type: integer} customer: {$ref: '#/components/schemas/AbandonedCartCustomer'} items: type: array items: {$ref: '#/components/schemas/AbandonedCartItem'} subtotal: {type: integer, description: "Halalas, from the store's cart valuation: active products only, custom-field fees included. It can differ from the sum of items unit_price times quantity."} currency: {type: string, examples: [SAR]} last_activity_at: {type: string, format: date-time} reminders_sent: {type: integer} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} WebhookEvent: type: object required: [event, group, kind, scope, attributes] properties: event: {type: string, examples: [order.created]} group: {type: string, examples: [orders]} kind: {type: string, description: 'The payload kind the event carries (order, product, customer, cart...).', examples: [order]} scope: {type: string, description: 'The read scope a key needs to subscribe to this event.', examples: [orders.read]} attributes: type: array items: {type: string} description: The flat payload attributes a rule may test. WebhookHeader: type: object required: [key, value] properties: key: {type: string, maxLength: 64, pattern: '^[A-Za-z0-9-]+$'} value: {type: string, maxLength: 500, description: 'Masked (••••••) on every read; shown only in the answer to the POST or PATCH that sent it. Sending the mask back in a PATCH keeps the stored value.'} Webhook: type: object description: A webhook this key created. The secret is never shown here; it comes back once, on create and on rotate. required: [id, name, event, url, rule, headers, security_strategy, signature_version, is_active, disabled_reason, failures, last_status, last_delivered_at, created_at, updated_at] properties: id: {type: integer} name: {type: string} event: {type: string} url: {type: string, format: uri} rule: {type: [string, 'null'], description: 'A rule on the payload attributes, such as total > 100 AND payment_method = `cod`.'} headers: type: array items: {$ref: '#/components/schemas/WebhookHeader'} security_strategy: {type: string, enum: [signature, token, none]} signature_version: {type: integer, enum: [1, 2], description: '1 signs the raw body; 2 signs "{X-Zo-Timestamp}.{raw body}" and sends X-Zo-Timestamp.'} is_active: {type: boolean} disabled_reason: {type: [string, 'null'], description: failures when the webhook switched itself off.} failures: {type: integer, description: Failed deliveries in a row.} last_status: {type: [integer, 'null'], description: The HTTP status of the last delivery.} last_delivered_at: {type: [string, 'null'], format: date-time} created_at: {type: string, format: date-time} updated_at: {type: string, format: date-time} WebhookWithSecret: allOf: - {$ref: '#/components/schemas/Webhook'} - type: object required: [secret] properties: secret: {type: [string, 'null'], description: 'Shown only in this answer; null with security_strategy none.'} WebhookInput: type: object description: > A webhook to create (POST: name, event and url required) or change (PATCH: only the keys sent change). The same rules as the dashboard form. Subscribing to an event needs the read scope of its resource (GET /webhooks/events names it); without it the answer is 403 insufficient_scope. properties: name: {type: string, maxLength: 120} event: {type: string, description: One of GET /webhooks/events.} url: {type: string, maxLength: 2000, description: 'https only, a public address (never the server, a LAN or a metadata range).'} rule: {type: [string, 'null'], maxLength: 500} headers: type: [array, 'null'] maxItems: 10 items: {$ref: '#/components/schemas/WebhookHeader'} description: Custom headers sent with every delivery. Host, Authorization, Content-Type, User-Agent and X-Zo-* are refused. security_strategy: {type: string, enum: [signature, token, none], default: signature} secret: {type: [string, 'null'], minLength: 16, maxLength: 200, description: Generated when left out and the strategy is signature or token.} signature_version: {type: integer, enum: [1, 2], default: 1} is_active: {type: boolean, description: 'Switching a webhook back on clears its failure count.'} WebhookDelivery: type: object description: One send of a webhook, kept 30 days. payload and response_body only on a single delivery (detail, test, resend). required: [id, uuid, event, is_test, status, attempts, response_status, error, duration_ms, next_attempt_at, created_at] properties: id: {type: integer} uuid: {type: string, format: uuid, description: The X-Zo-Delivery header the receiver saw.} event: {type: string} is_test: {type: boolean} status: {type: string, enum: [pending, success, failed]} attempts: {type: integer} response_status: {type: [integer, 'null']} error: {type: [string, 'null'], description: 'Why it failed: timeout, connection_failed, blocked_url, http_{status}, webhook_disabled, or feature_locked (the store no longer has the public API, so a key''s webhook stopped).'} duration_ms: {type: [integer, 'null']} next_attempt_at: {type: [string, 'null'], format: date-time} created_at: {type: string, format: date-time} payload: {type: object, description: 'The body sent: {event, merchant, created_at, data}.'} response_body: {type: [string, 'null'], description: The first 10 KB of the answer.} queued: {type: boolean, description: 'Only on a test send that could not run at once (every outbound slot busy): true, and the delivery waits on the queue with status pending.'} tags: - name: Store description: "The store the key belongs to." - name: Products description: "Products and their variants, read and written by id or by SKU, and product images." - name: Categories description: "The store's product categories." - name: Brands description: "The store's brands." - name: Inventory description: "Stock levels, stock movements, stock adjustments and the store's branches." - name: Orders description: "Orders, their status history and status changes, and the store's order statuses." - name: Payments description: "Payments recorded on an order and the store's payment methods." - name: Shipments description: "Shipments: create one for an order, list them, get a label, cancel." - name: Customers description: "The store's customers." - name: Abandoned carts description: "Carts customers left without placing an order." - name: Coupons description: "Discount coupons." - name: Reviews description: "Customer reviews and the store's replies." - name: Webhooks description: "Webhook subscriptions, the events you can subscribe to, test sends, secret rotation and delivery logs." x-tagGroups: - name: Store tags: [Store] - name: Catalog tags: [Products, Categories, Brands, Inventory] - name: Orders tags: [Orders, Payments, Shipments] - name: Customers and marketing tags: [Customers, Abandoned carts, Coupons, Reviews] - name: Webhooks tags: [Webhooks] paths: /store: get: operationId: getStore tags: [Store] summary: The store this key belongs to x-scope: store.read responses: '200': description: The store. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Store'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/RateLimited'} /products: get: operationId: listProducts tags: [Products] summary: Products, as a sync list (deleted products never appear) x-scope: products.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[status] in: query schema: {type: string, enum: [draft, active, hidden]} - name: filter[type] in: query schema: {type: string, enum: [physical, service, food, digital, card, group, booking]} - name: filter[category_id] in: query schema: {type: integer} - name: filter[sku] in: query description: Only the product that has a variant with exactly this SKU. schema: {type: string, maxLength: 64} responses: '200': description: A page of products. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Product'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createProduct tags: [Products] summary: Create a product x-scope: products.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: allOf: - {$ref: '#/components/schemas/ProductInput'} - required: [name, variants] responses: '201': description: The new product. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Product'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /products/{id}: get: operationId: getProduct tags: [Products] summary: One product x-scope: products.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The product. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Product'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateProduct tags: [Products] summary: Change a product (only the keys sent) x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/ProductInput'} responses: '200': description: The product as saved. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Product'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: deleteProduct tags: [Products] summary: Delete a product (it leaves every list; the merchant can restore it from the dashboard) x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '204': {$ref: '#/components/responses/NoContent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /products/sku/{sku}: get: operationId: getProductBySku tags: [Products] summary: The product that has a variant with this SKU x-scope: products.read parameters: - name: sku in: path required: true schema: {type: string, maxLength: 64} responses: '200': description: The product. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Product'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateProductBySku tags: [Products] summary: Change the product that has a variant with this SKU (only the keys sent) x-scope: products.read_write parameters: - {name: sku, in: path, required: true, schema: {type: string, maxLength: 64}} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/ProductInput'} responses: '200': description: The product as saved. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Product'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /products/{id}/images: post: operationId: addProductImage tags: [Products] summary: Add a picture to a product, from a URL (JSON) or an upload (multipart field image) description: > An upload is stored at once and answered 201 with the picture. A URL is copied in the background: 202 with the pending entry, which the product lists in images_pending until the copy joins images (last in the order). Links still pending count against the 10 pictures a product may have. x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/ImageInput'} multipart/form-data: schema: type: object required: [image] properties: image: {type: string, format: binary, description: 'JPEG, PNG or WebP, at most 10 MB.'} responses: '201': description: The uploaded picture, last in the product order. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/ProductImage'} '202': description: The URL is accepted and copied in the background. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/PendingImage'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /products/{id}/images/{image}: delete: operationId: deleteProductImage tags: [Products] summary: Remove a picture from a product x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} - {name: image, in: path, required: true, schema: {type: integer, minimum: 1}} responses: '204': {$ref: '#/components/responses/NoContent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /categories: get: operationId: listCategories tags: [Categories] summary: Categories, as a sync list x-scope: products.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} responses: '200': description: A page of categories. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Category'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createCategory tags: [Categories] summary: Create a category x-scope: products.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: allOf: - {$ref: '#/components/schemas/CategoryInput'} - required: [name] responses: '201': description: The new category. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Category'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /categories/{id}: get: operationId: getCategory tags: [Categories] summary: One category x-scope: products.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The category. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Category'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateCategory tags: [Categories] summary: Change a category (only the keys sent) x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/CategoryInput'} responses: '200': description: The category as saved. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Category'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: deleteCategory tags: [Categories] summary: Delete a category; its subcategories move up to its parent and its products stay (only the link goes) x-scope: products.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '204': {$ref: '#/components/responses/NoContent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /brands: get: operationId: listBrands tags: [Brands] summary: Brands, as a sync list x-scope: products.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} responses: '200': description: A page of brands. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Brand'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createBrand tags: [Brands] summary: Create a brand x-scope: products.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/BrandInput'} responses: '201': description: The new brand. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Brand'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': {$ref: '#/components/responses/Conflict'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /brands/{id}: get: operationId: getBrand tags: [Brands] summary: One brand x-scope: products.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The brand. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Brand'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /orders: get: operationId: listOrders tags: [Orders] summary: Orders, as a sync list (customer contact data needs customers.read) x-scope: orders.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[status] in: query schema: {type: string, enum: [awaiting_payment, under_review, in_progress, ready, shipping, delivered, completed, cancelled, return_in_progress, returned]} - name: filter[payment_status] in: query schema: {type: string, enum: [pending, paid, refund_due, refunded]} - name: filter[customer_id] in: query schema: {type: integer} responses: '200': description: A page of orders. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Order'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createOrder tags: [Orders] summary: Create an order (stock is taken, totals are computed by the store) description: > The Idempotency-Key header is required here (422 validation_failed without it): a retry with the same key returns the first answer and never creates a second order. A customer object (name and mobile) finds the store's customer by that mobile, so it needs customers.read: without it the call is refused with 422 customers_scope_required (on fields.customer.mobile), whether or not the store has that number; a customer_id works with orders.read_write alone. The answer follows the same contact rule as the reads: without customers.read the order names its customer by id and name only. History records the creation with actor api. x-scope: orders.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/OrderInput'} responses: '201': description: The new order. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Order'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': description: > out_of_stock (items lists the indexes of the items there is not enough stock for; nothing was created), or duplicate_request (the same Idempotency-Key is still running). content: application/json: schema: {$ref: '#/components/schemas/Error'} '422': description: > validation_failed (fields names the input, such as items.0.sku for a SKU this store does not have, items.0.variant_id, customer_id or customer.mobile). Nothing was created. content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /orders/{id}: get: operationId: getOrder tags: [Orders] summary: One order x-scope: orders.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The order. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Order'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /orders/{id}/history: get: operationId: getOrderHistory tags: [Orders] summary: The order's status changes, oldest first x-scope: orders.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The history. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/OrderHistoryEntry'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /orders/{id}/status: post: operationId: changeOrderStatus tags: [Orders] summary: Move an order to another status description: > Only the moves GET /order-statuses lists are allowed. Cancelling or returning puts stock back when the store's order settings say so. The Idempotency-Key header is optional. History records the change with actor api. x-scope: orders.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/OrderStatusInput'} responses: '200': description: The order after the change. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Order'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': description: > channel_order_cancel_remote (a marketplace order is cancelled on the marketplace), or duplicate_request (the same Idempotency-Key is still running). content: application/json: schema: {$ref: '#/components/schemas/Error'} '422': description: > invalid_transition (the order cannot move from its status to this one; from and to name both), or validation_failed. content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /order-statuses: get: operationId: listOrderStatuses tags: [Orders] summary: Every order status and where an order may go from it x-scope: orders.read responses: '200': description: The statuses. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/OrderStatus'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/RateLimited'} /customers: get: operationId: listCustomers tags: [Customers] summary: Customers, as a sync list x-scope: customers.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[mobile] in: query description: Exactly this mobile, in any common form (0501234567, 966501234567, +966501234567). schema: {type: string, maxLength: 30} - name: filter[email] in: query description: Exactly this email. schema: {type: string, maxLength: 190} responses: '200': description: A page of customers. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Customer'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createCustomer tags: [Customers] summary: Add a customer description: The mobile is normalised as the storefront does; a customer with that mobile already in the store is answered 409. x-scope: customers.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/CustomerInput'} responses: '201': description: The new customer. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Customer'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': description: > customer_exists (the store already has a customer with this mobile; customer_id names it), or duplicate_request (the same Idempotency-Key is still running). content: application/json: schema: {$ref: '#/components/schemas/Error'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /customers/{id}: get: operationId: getCustomer tags: [Customers] summary: One customer x-scope: customers.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The customer. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Customer'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateCustomer tags: [Customers] summary: Change a customer (only the keys sent) x-scope: customers.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/CustomerUpdate'} responses: '200': description: The customer as saved. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Customer'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': description: validation_failed; mobile in the body is refused (the mobile cannot change), and so is is_blocked (blocking is done from the dashboard). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /inventory: get: operationId: getInventory tags: [Inventory] summary: One variant's stock in each branch (pass sku or variant_id) x-scope: inventory.read parameters: - name: sku in: query description: The variant's exact SKU. Either sku or variant_id is required; with both, the variant must match both. schema: {type: string, maxLength: 64} - name: variant_id in: query schema: {type: integer} responses: '200': description: One row per branch that holds a level for the variant; empty when no variant of this store matches. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/StockLevel'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /inventory/movements: get: operationId: listStockMovements tags: [Inventory] summary: Stock changes, as a list in (created_at, id) order description: Movements are never edited, so this list takes created_since and no updated_since. x-scope: inventory.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[variant_id] in: query schema: {type: integer} - name: filter[sku] in: query schema: {type: string, maxLength: 64} - name: filter[branch_id] in: query schema: {type: integer} responses: '200': description: A page of movements. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/StockMovement'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /inventory/adjustments: post: operationId: adjustStock tags: [Inventory] summary: Change stock levels in one batch (all items apply or none) description: > The Idempotency-Key header is required here (422 validation_failed without it). Each change is saved as a stock movement with reason api. A digital card product's stock is its unsold codes and cannot be changed here (422 stock_managed_by_codes). A decrement never clamps: if any item would take a level below zero the whole batch is refused with 409 insufficient_stock, naming the item in fields and the quantity on hand in available. x-scope: inventory.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/StockAdjustmentInput'} responses: '200': description: One result per item, in the order sent. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/StockAdjustmentResult'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': description: > insufficient_stock (a decrement would go below zero; fields names items.N.quantity and available gives the quantity on hand; nothing was applied), or duplicate_request (the same Idempotency-Key is still running). content: application/json: schema: {$ref: '#/components/schemas/Error'} '422': description: > validation_failed (fields names items.N.sku or items.N.variant_id for a variant this store does not have, items.N.branch_id for a branch it does not have), or stock_managed_by_codes (a digital card product; fields names the item). Nothing was applied. content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /branches: get: operationId: listBranches tags: [Inventory] summary: The store's branches and warehouses (not paged) x-scope: inventory.read responses: '200': description: Every branch. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/Branch'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/RateLimited'} /coupons: get: operationId: listCoupons tags: [Coupons] summary: Coupons, as a sync list x-scope: marketing.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[is_active] in: query schema: {type: boolean} - name: filter[code] in: query schema: {type: string, maxLength: 64} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Coupon'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createCoupon tags: [Coupons] summary: Add a coupon x-scope: marketing.read_write parameters: - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: allOf: - {$ref: '#/components/schemas/CouponInput'} - required: [code, type, value] responses: '201': description: The new coupon. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Coupon'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '409': {$ref: '#/components/responses/Conflict'} '422': description: validation_failed (fields names the input; a code the store already has is refused on code). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /coupons/{id}: get: operationId: getCoupon tags: [Coupons] summary: One coupon x-scope: marketing.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The row. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Coupon'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateCoupon tags: [Coupons] summary: Change a coupon (only the keys sent) x-scope: marketing.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/CouponInput'} responses: '200': description: The coupon as saved. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Coupon'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': description: validation_failed, or coupon_expired_end (switching an expired coupon back on needs an ends_at still ahead). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: deleteCoupon tags: [Coupons] summary: Delete a coupon (orders that used it keep its code) x-scope: marketing.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '204': {$ref: '#/components/responses/NoContent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /shipments: get: operationId: listShipments tags: [Shipments] summary: Shipments, as a sync list x-scope: shipments.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[order_id] in: query schema: {type: integer} - name: filter[status] in: query schema: {type: string, enum: [label_created, picked_up, in_transit, out_for_delivery, delivered, failed, returned, cancelled]} - name: filter[carrier] in: query schema: {type: string, maxLength: 30} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Shipment'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /shipments/{id}: get: operationId: getShipment tags: [Shipments] summary: One shipment x-scope: shipments.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The row. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Shipment'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: cancelShipment tags: [Shipments] summary: Cancel a shipment description: > A carrier label is cancelled only before the carrier picks the parcel up; its cost goes back to the wallet once the carrier confirms the label is void. A manual tracking number can be removed until delivery. x-scope: shipments.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The shipment, now cancelled. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Shipment'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '422': description: shipment_not_cancellable (the parcel is already with the carrier, delivered, or cancelled). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /shipments/{id}/label: get: operationId: getShipmentLabel tags: [Shipments] summary: The shipment's label as a PDF description: > The label as the dashboard prints it: the carrier's own PDF, or the platform's printable label for a carrier that gave none. The label shows the shopper's address and mobile, so besides shipments.read the key needs customers.read (403 insufficient_scope with scope customers.read otherwise). A tracking number of the store's own carrier has no label (404). A cancelled shipment's label is never handed out again (422). x-scope: shipments.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The label. content: application/pdf: schema: {type: string, contentMediaType: application/pdf} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '422': description: shipment_cancelled (the label was cancelled). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /orders/{id}/shipments: get: operationId: listOrderShipments tags: [Shipments] summary: The order's shipments (not paged) x-scope: shipments.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The rows (not paged). content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/Shipment'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createOrderShipment tags: [Shipments] summary: Ship an order (book a carrier label or record a tracking number) description: > The Idempotency-Key header is required here (422 validation_failed without it): a carrier label is paid from the store's wallet, and a retry with the same key returns the first answer without booking or charging again. The order moves forward (ready for a label, shipping for a tracking number), as in the dashboard. x-scope: shipments.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/IdempotencyKey'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/ShipmentInput'} responses: '201': description: The new shipment. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Shipment'} '401': {$ref: '#/components/responses/Unauthenticated'} '403': {$ref: '#/components/responses/Forbidden'} '402': description: > feature_locked (carrier labels need the carrier_integration plan feature), or wallet_insufficient (the wallet holds less than the label costs; balance and required are given). Nothing was booked or charged. content: application/json: schema: {$ref: '#/components/schemas/Error'} '404': {$ref: '#/components/responses/NotFound'} '409': {$ref: '#/components/responses/Conflict'} '422': description: > validation_failed, order_not_shippable (the order's status or a pickup order), shipment_exists (the order already has an open shipment), carrier_no_cod, carrier_overweight, address_missing or gift_pending. content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /reviews: get: operationId: listReviews tags: [Reviews] summary: Reviews, as a sync list x-scope: reviews.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[product_id] in: query schema: {type: integer} - name: filter[status] in: query schema: {type: string, enum: [pending, approved]} - name: filter[stars] in: query schema: {type: integer, minimum: 1, maximum: 5} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Review'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /reviews/{id}: get: operationId: getReview tags: [Reviews] summary: One review x-scope: reviews.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The row. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Review'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /reviews/{id}/reply: put: operationId: replyToReview tags: [Reviews] summary: Set the store's reply to a review (replaces any earlier reply) x-scope: reviews.read_write parameters: - {$ref: '#/components/parameters/Id'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/ReviewReplyInput'} responses: '200': description: The review with its reply. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Review'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: deleteReviewReply tags: [Reviews] summary: Remove the store's reply to a review x-scope: reviews.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The review, without a reply. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Review'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /orders/{id}/payments: get: operationId: listOrderPayments tags: [Payments] summary: The order's payments (not paged) x-scope: payments.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The rows (not paged). content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/Payment'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /payment-methods: get: operationId: listPaymentMethods tags: [Payments] summary: Which payment methods the store takes now description: online is enabled only when the platform takes online payments and the store switched it on. x-scope: payments.read responses: '200': description: cod, bank_transfer and online, each with its state. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/PaymentMethod'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/RateLimited'} /carts/abandoned: get: operationId: listAbandonedCarts tags: ["Abandoned carts"] summary: Abandoned carts, as a sync list (plan feature abandoned_carts, included in Pro; contact data needs customers.read) x-scope: carts.read description: > Carts with items and a contact, never ordered, idle past the store's reminder threshold, and not hidden by the merchant. A cart becomes abandoned by the passing of time, without any change to its row, so this list cannot be synced by updated_at: it is ordered by (created_at, id), refuses updated_since (422), and clients read it afresh each time (optionally with created_since) instead of incrementally. parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/CreatedSince'} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/AbandonedCart'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '403': {$ref: '#/components/responses/Forbidden'} '402': {$ref: '#/components/responses/FeatureLocked'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/events: get: operationId: listWebhookEvents tags: [Webhooks] summary: The events a webhook may subscribe to (no plan feature needed beyond public_api) x-scope: webhooks.read responses: '200': description: Every event, with its payload kind, the scope a key needs for it and the attributes a rule may test. content: application/json: schema: type: object required: [data] properties: data: type: array items: {$ref: '#/components/schemas/WebhookEvent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks: get: operationId: listWebhooks tags: [Webhooks] summary: This key's webhooks, as a sync list (a Pro feature) description: > A key sees and manages only the webhooks it created. Webhooks made in the dashboard or by another key are not listed and answer 404. They all share the store's webhook quota (10 on Pro). x-scope: webhooks.read parameters: - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/UpdatedSince'} - {$ref: '#/components/parameters/CreatedSince'} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/Webhook'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} post: operationId: createWebhook tags: [Webhooks] summary: Add a webhook (the secret is shown once) description: > Not idempotent: an Idempotency-Key is ignored, because a stored answer would keep the secret. A retry after a lost answer makes a second webhook; list GET /webhooks and delete the extra one. x-scope: webhooks.read_write requestBody: required: true content: application/json: schema: allOf: - {$ref: '#/components/schemas/WebhookInput'} - required: [name, event, url] responses: '201': description: The new webhook with its secret. Keep the secret; it is not shown again. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/WebhookWithSecret'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': description: insufficient_scope, naming the read scope the event needs. content: application/json: schema: {$ref: '#/components/schemas/Error'} '422': description: validation_failed (fields names the input), or plan_limit (the store has as many webhooks as its plan allows). content: application/json: schema: {$ref: '#/components/schemas/Error'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}: get: operationId: getWebhook tags: [Webhooks] summary: One of this key's webhooks x-scope: webhooks.read parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The row. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/Webhook'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} patch: operationId: updateWebhook tags: [Webhooks] summary: Change a webhook (only the keys sent) description: > Not idempotent (an Idempotency-Key is ignored). The answer shows the values of the headers this request sent, and the secret only when this change made one (security_strategy set to signature or token on a webhook without a secret, and no secret sent). x-scope: webhooks.read_write parameters: - {$ref: '#/components/parameters/Id'} requestBody: required: true content: application/json: schema: {$ref: '#/components/schemas/WebhookInput'} responses: '200': description: The webhook as saved; with secret only when this change made one. content: application/json: schema: type: object required: [data] properties: data: allOf: - {$ref: '#/components/schemas/Webhook'} - type: object properties: secret: {type: string, description: 'Present only when this change made a new secret.'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': description: insufficient_scope, naming the read scope a new event needs. content: application/json: schema: {$ref: '#/components/schemas/Error'} '404': {$ref: '#/components/responses/NotFound'} '422': {$ref: '#/components/responses/WriteValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} delete: operationId: deleteWebhook tags: [Webhooks] summary: Delete a webhook and its delivery log x-scope: webhooks.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '204': {$ref: '#/components/responses/NoContent'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}/secret: post: operationId: rotateWebhookSecret tags: [Webhooks] summary: A new secret (the old one stops working at once; the new one is shown once) x-scope: webhooks.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The webhook with its new secret. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/WebhookWithSecret'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}/test: post: operationId: testWebhook tags: [Webhooks] summary: Send a test delivery now and answer its result description: > Sends the store's latest subject of the event's kind (or an empty sample) marked as a test. A test never counts as a failure of the webhook. The receiver has 5 seconds in all (1 to connect) to answer; a slower one is recorded as error timeout. When the platform's outbound slots are all busy, the test is queued instead: the answer is the delivery with status pending and queued true, and its result is read later. Up to 10 a minute. x-scope: webhooks.read_write parameters: - {$ref: '#/components/parameters/Id'} responses: '200': description: The test delivery with the body sent and the answer. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/WebhookDelivery'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}/deliveries: get: operationId: listWebhookDeliveries tags: [Webhooks] summary: The webhook's deliveries of the last 30 days, ordered by (created_at, id) description: A delivery's row changes while it is retried, so this list pages by creation time and refuses updated_since (422). x-scope: webhooks.read parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/PerPage'} - {$ref: '#/components/parameters/Cursor'} - {$ref: '#/components/parameters/CreatedSince'} - name: filter[status] in: query schema: {type: string, enum: [pending, success, failed]} responses: '200': description: A page. content: application/json: schema: type: object required: [data, meta] properties: data: type: array items: {$ref: '#/components/schemas/WebhookDelivery'} meta: {$ref: '#/components/schemas/ListMeta'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '422': {$ref: '#/components/responses/ValidationFailed'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}/deliveries/{delivery}: get: operationId: getWebhookDelivery tags: [Webhooks] summary: One delivery, with the body sent and the answer x-scope: webhooks.read parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/Delivery'} responses: '200': description: The delivery. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/WebhookDelivery'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'} /webhooks/{id}/deliveries/{delivery}/resend: post: operationId: resendWebhookDelivery tags: [Webhooks] summary: Send a delivery's data again, as a new delivery (a new X-Zo-Delivery) description: > The send is queued: the answer is the new delivery with status pending. Read its outcome later with GET /webhooks/{id}/deliveries/{delivery}. Up to 20 a minute. x-scope: webhooks.read_write parameters: - {$ref: '#/components/parameters/Id'} - {$ref: '#/components/parameters/Delivery'} responses: '202': description: The new delivery, queued, with the body it will send. content: application/json: schema: type: object required: [data] properties: data: {$ref: '#/components/schemas/WebhookDelivery'} '401': {$ref: '#/components/responses/Unauthenticated'} '402': {$ref: '#/components/responses/FeatureLocked'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/RateLimited'}