Import stock quantities from CSV
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/inventory/import';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {'x-api-key': '<x-api-key>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://apibase.ecomweb.app/api/v1/stores/example/inventory/import \ --header 'Content-Type: multipart/form-data' \ --header 'x-api-key: <x-api-key>' \ --form file=@fileSets on_hand for the variants in a CSV file, as one adjustment with the reason count. Upload a file from the export as the file field (at most 5 MB, 5000 rows) with the On hand (new) column filled in. A row is written only if the variant’s stock still matches On hand (current). Rows that cannot be applied, such as an unknown variant, a repeated variant or stock that changed since the export, are listed in skipped and do not stop the other rows.
Required scopes: write:inventory
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The CSV file, at most 5 MB. Use a file produced by the export, with the On hand (new) column filled in.
Responses
Section titled “Responses”object
Rows whose on hand quantity was written.
Rows whose new quantity already matched the current one.
Rows that were not applied, with the reason for each.
object
Why the row was skipped.
The data row number, starting at 1 and not counting the header.
The variant ID as written in the file, or null when the cell was empty.
The variant’s current on hand quantity, when it is known.
Example
{ "skipped": [ { "reason": "stale" } ]}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}