For the complete documentation index, see llms.txt. This page is also available as Markdown.

Bulk create or update product stock

Creates or updates many product-stock records in a single request. The body is a JSON array of stock objects; for each element, the record of the given product is updated if it exists and created otherwise.

Every element must carry a product. An element that is missing product or is otherwise malformed is rejected with 406 Not Acceptable, and no changes from that request are applied.

On success the response is an empty object.

post
/product_stock/bulk_upsert/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Bodyobject · ProductStockRequest[]

A JSON array of stock objects for the bulk upsert endpoint. For each element, the record of the given product is updated if it exists and created otherwise. Every element must carry a product.

productintegerRequired

The identifier of the product this stock belongs to. Required on create. On update it must match the record's current product — a different value is rejected.

stockintegerOptional

The sellable quantity. A non-negative integer. Reconciled against sold_quantity_unreported on write.

Default: 0
unit_typestring · enumOptional

The unit of measure of a stock quantity.

Possible values:
extra_fieldobjectOptional

Free-form JSON for extra data. Optional.

sold_quantity_unreportedintegerOptional

The quantity sold locally but not yet reported. Optional; normally managed internally.

Responses
200

The records were created or updated successfully. The response body is an empty object.

application/json
objectOptional
post/product_stock/bulk_upsert/
POST /api/v1/remote/1/product_stock/bulk_upsert/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 74

[
  {
    "product": 3391,
    "stock": 24
  },
  {
    "product": 3392,
    "stock": 0,
    "unit_type": "qty"
  }
]
{}

Last updated

Was this helpful?