WalletD developers
Catalog

Change a tracked variant's on-hand count, with a reason

Changes a tracked variant's on-hand count, either by delta or to an absolute set_to, with a reason, and answers with the variant and the movement row it wrote.

POST/v1/clients/{clientId}/offerings/{offeringId}/variants/{variantId}/stock

Changes a tracked variant's on-hand count, either by delta or to an absolute set_to, with a reason, and answers with the variant and the movement row it wrote. Reserved units are not touched: they belong to open orders. Needs authority over the client — membership of its organization, an API key bound to this client, or tenant staff holding clients:manage; anything else is refused not_client_member or insufficient_scope (403), and an unknown client client_not_found (404). Refuses invalid_request (400), not_found (404) and invalid_transition (409) for an archived variant.

Authorization

bearerAuth
AuthorizationBearer <token>

A tenant API key (sk_{env}_{id}_{secret}), a wallet user token, or an IdP access token. Which principal the credential resolves to decides the scopes it carries; see the authentication guide.

In: header

Path Parameters

clientId*string
Formatuuid
offeringId*string
Formatuuid
variantId*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Exactly one of delta (signed change) or set_to (absolute count).

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/v1/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/offerings/497f6eca-6276-4993-bfeb-53cbbbba6f08/variants/497f6eca-6276-4993-bfeb-53cbbbba6f08/stock" \  -H "Content-Type: application/json" \  -d '{}'
{  "variant": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "offering_id": "a7d124b6-6a8c-44d1-9d46-4636e3f8c04e",    "sku": "string",    "barcode": "string",    "option_values": [      "string"    ],    "position": 0,    "pricing_mode": "manual",    "cost_amount": 0,    "markup": {      "kind": "percent",      "value": 0    },    "amount": 0,    "image_url": "string",    "inventory": {      "track_inventory": true,      "in_stock": true,      "low_stock": true,      "on_hand": 0,      "reserved": 0,      "available": 0,      "allow_backorder": true,      "low_stock_threshold": 0    },    "status": "active",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "movement": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "variant_id": "8a2d415d-59aa-4132-bef3-011f97c4a0f6",    "kind": "adjustment",    "quantity": 0,    "on_hand_after": 0,    "reserved_after": 0,    "reason": "string",    "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",    "actor_type": "string",    "actor_id": "string",    "created_at": "2019-08-24T14:15:22Z"  }}