API introduction

How to call the API

On this page

Every call is an ordinary HTTPS request to the store's address, with your key in a header. These examples use https://yourstore.example.com; use the address of the store you connect to. New here? The Quick start goes from nothing to a first call.

A read call#

List the first five products. The key needs the read:products scope.

curl -s "https://yourstore.example.com/api/v1/products?limit=5" \
  -H "Authorization: Bearer YOUR_API_KEY"

A write call#

Add an internal note to an order. The key needs the write:orders scope. Write calls carry an Idempotency-Key so a retry never does the work twice (see Requests).

curl -s -X POST "https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/notes" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
  -d '{
    "note": "Customer called to confirm the address."
}'

Read the answer#

  • A status of 200 or 201 means it worked. The JSON has a data part (what you asked for) and a meta part.
  • A status of 400 or more means it did not work. The JSON has an error part with a code (short and stable, for your code to check) and a message (in plain words, for people). A 422 also lists what to fix in fields.
  • Always check the status before you use data.

The full shape of answers and every error code are on Responses and errors.

If your first call fails#

You seeWhat it usually means
401 missing_api_key or invalid_api_keyThe key was not sent in a header, or it was not copied completely.
403 insufficient_scopeThe key does not have the permission this call needs. error.required_scope names it. Add it to the key in the admin.
403 ip_not_allowedThe key can only be used from certain internet addresses, and yours is not one of them.
404 not_foundThe address is wrong (check the path and that it starts with /api/v1), or that product, order or size does not exist.
429 rate_limitedToo many requests in a minute. Wait the seconds in the Retry-After header.
503 service_busyThe store could not reach its database for a moment. Wait the seconds in the Retry-After header and send the same request again.

Tools#

You can try calls without writing code. Import the Postman collection or the OpenAPI file into Postman or any other API tool, and set your store address and your key.