Inventory levels
How many units of each variant of the catalog the website has in stock, one level per variant and named by it. Placing an order takes its units off and refuses a quantity the stock does not cover; :adjust moves the stock by a difference in one atomic write. A variant without a level is sold in any quantity.
List inventory levels
Lists the website's stock levels, the most recently changed first. filter takes product_id — the levels of one product's variants — variant_id and update_time; order_by takes update_time.
path Parameters
website_idId of the parent website.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: update_time desc. Sortable: update_time.
filterAIP-160 subset (§8). Filterable: product_id, update_time, variant_id. A field outside the list is INVALID_ARGUMENT.
List inventory levels › Responses
One page of inventory_levels.
This page of inventory_levels, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create inventory level
Starts tracking the stock of a variant: variant_id — a variant of the website's catalog, else INVALID_ARGUMENT on variant_id — and quantity, its units in stock. A variant that has a level already answers ALREADY_EXISTS, and a quantity below zero FAILED_PRECONDITION INSUFFICIENT_STOCK. The level is named by the variant's id; from then on an order takes its units off.
path Parameters
website_idId of the parent website.
Create inventory level › Request Body
quantityHow many units of the variant are in stock: a whole number from 0 to 1000000000. An order takes its units off when it is placed and refuses a quantity the stock does not cover; a cancelled order gives them back. Set it here, or move it by a difference with :adjust.
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
Create inventory level › Responses
The created resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
product_idThe product the variant belongs to, set by the server from the variant. Deleting the product, or the variant, deletes the level.
quantityHow many units of the variant are in stock: a whole number from 0 to 1000000000. An order takes its units off when it is placed and refuses a quantity the stock does not cover; a cancelled order gives them back. Set it here, or move it by a difference with :adjust.
Get inventory level
How many units of one variant of the catalog the website has in stock. A variant with a level is sold while its quantity covers the order, and placing the order takes the units off; a variant without one is not tracked and is sold in any quantity. A level is named by its variant's id, and deleting the variant or its product deletes it.
path Parameters
website_idId of the parent website.
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get inventory level › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
product_idThe product the variant belongs to, set by the server from the variant. Deleting the product, or the variant, deletes the level.
quantityHow many units of the variant are in stock: a whole number from 0 to 1000000000. An order takes its units off when it is placed and refuses a quantity the stock does not cover; a cancelled order gives them back. Set it here, or move it by a difference with :adjust.
Delete inventory level
Stops tracking a variant's stock: from then on it is sold in any quantity. To stop selling it, set its quantity to 0 instead, or switch the variant off.
path Parameters
website_idId of the parent website.
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Delete inventory level › Responses
Deleted. No body (§7).
Update inventory level
Sets the quantity of a variant's stock, as counted. variant_id is fixed and refused here; a quantity below zero answers FAILED_PRECONDITION INSUFFICIENT_STOCK. To move the stock by a difference without reading it first — a delivery received, a breakage — use :adjust.
path Parameters
website_idId of the parent website.
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
query Parameters
update_maskComma-separated field paths to merge. A field named here and sent as null is cleared; without the mask a null is dropped (§7, §11).
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Update inventory level › Request Body
quantityHow many units of the variant are in stock: a whole number from 0 to 1000000000. An order takes its units off when it is placed and refuses a quantity the stock does not cover; a cancelled order gives them back. Set it here, or move it by a difference with :adjust.
Update inventory level › Responses
The updated resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
variant_idThe variant of the website's catalog whose units this counts, and the level's id: the resource is websites/{website}/inventory_levels/{variant_id}. A variant has one level at most. Required on create and fixed afterwards.
product_idThe product the variant belongs to, set by the server from the variant. Deleting the product, or the variant, deletes the level.
quantityHow many units of the variant are in stock: a whole number from 0 to 1000000000. An order takes its units off when it is placed and refuses a quantity the stock does not cover; a cancelled order gives them back. Set it here, or move it by a difference with :adjust.
Adjust (inventory level)
Moves a variant's stock by a difference in one atomic write: {"delta": 12} adds twelve units, {"delta": -3} takes three off, whatever else changes the stock meanwhile — an order placed at the same moment included. A difference that would leave the stock below zero answers FAILED_PRECONDITION INSUFFICIENT_STOCK with the units it has, one above 1000000000 FAILED_PRECONDITION LIMIT, and nothing is written. Answers the level as it is after.
path Parameters
website_idId of the parent website.
variant_idId of the parent variant.
Adjust (inventory level) › Request Body optional
Adjust (inventory level) › Responses
The affected resource, or the method’s own response object (§10).