Skip to content

Developers

Developer API

Manage your store's products, orders, customers, design and settings through a REST API, with tokens limited to the scopes you choose.
On this page
  1. Authentication
  2. Base URL and versioning
  3. Quickstart
  4. Permissions (scopes)
  5. Commerce gateway
  6. Idempotency
  7. Rate limits
  8. Errors
  9. Security

The API is versioned, and one scoped token covers both your store's design and settings and its Magento commerce data. The contract is published as OpenAPI 3.1.

Authentication

Authenticate with a Personal Access Token in the Authorization header:

http
Authorization: Bearer stoily_pat_live_xxxxxxxxxxxx

Create tokens in your admin under System › Developer › API Tokens. Each token covers the stores you select, with permissions per resource. It is shown once, and you can rotate or revoke it at any time. A token can carry an expiry date and an IP allowlist.

Live tokens use the stoily_pat_live_ prefix. Test tokens start with stoily_pat_test_ so your own tooling can tell them apart. They read and write your live store data, like any other token. Tokens with the older soc_pat_ prefix still work; you do not need to replace them.

Base URL and versioning

All endpoints live under https://api.stoily.com/api/v1. The machine-readable contract is published at /api/v1/openapi.json (OpenAPI 3.1). Use it to generate an SDK or to load the API into your HTTP client.

Quickstart

bash
# Your API base URL and a token
API=https://api.stoily.com/api/v1
TOKEN=stoily_pat_live_xxxxxxxxxxxx

# List the stores your token can access
curl $API/stores -H "Authorization: Bearer $TOKEN"

# Read a store's design document
curl $API/stores/STORE_ID/design \
  -H "Authorization: Bearer $TOKEN"

# Update theme + tracking scripts (design:write)
curl -X PUT $API/stores/STORE_ID/design \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"design": {"primaryColor": "#111827",
       "customCodeSnippets": []}}'

# Read Magento orders through the gateway (orders:read)
curl $API/stores/STORE_ID/commerce/orders \
  -H "Authorization: Bearer $TOKEN"

Permissions (scopes)

A token grants read or write per resource. write implies read. A token can never exceed the access of the account that created it. Available resources:

  • stores

    stores:read · stores:write

  • design

    design:read · design:write

  • settings

    settings:read · settings:write

  • config

    config:read · config:write

  • email

    email:read · email:write

  • domains

    domains:read · domains:write

  • members

    members:read · members:write

  • webhooks

    webhooks:read · webhooks:write

  • integrations

    integrations:read · integrations:write

  • extensions

    extensions:read · extensions:write

  • backups

    backups:read · backups:write

  • deployments

    deployments:read · deployments:write

  • orders

    orders:read · orders:write

  • products

    products:read · products:write

  • customers

    customers:read · customers:write

  • inventory

    inventory:read · inventory:write

  • operations

    operations:read · operations:write

  • audit

    audit:read · audit:write

  • structure

    structure:read · structure:write

  • marketplace

    marketplace:read · marketplace:write

  • content

    content:read · content:write

  • connect

    connect:read · connect:write

Commerce gateway

GETPOSTPUTPATCHDELETEHEADOPTIONS

http
/api/v1/stores/{storeId}/commerce/{path}

The gateway accepts every method and passes your request through to that store's Magento REST API (orders, products, customers, inventory and more), limited by your token's scopes. Send the Magento resource path directly, for example commerce/orders or commerce/products/ABC-1. For a Magento endpoint the gateway does not cover, you can get a direct Magento token from your admin.

Idempotency

Retry a write safely by sending an Idempotency-Key header. The first response is recorded for 24 hours, and a retry with the same key replays it with Idempotent-Replayed: true. Reusing a key with a different body returns 409, and so does a retry sent while the first request is still running.

bash
curl -X POST $API/stores/STORE_ID/commerce/products \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: 9f1c5b8e-..." \
  -H "Content-Type: application/json" \
  -d '{"product": {"sku": "ABC-1", "name": "Widget"}}'

Rate limits

The limit is 600 requests a minute per credential. Responses carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers. Exceeding the limit returns 429 with a Retry-After header. Wait that long, then retry.

Errors

Errors use application/problem+json (RFC 9457) with type, title, status and detail. Commerce responses are returned verbatim from Magento with the upstream status code.

Security

Treat a token like a password and never commit it to a repository. If a token leaks, revoke it in your admin straight away.

Make your first API call

Create an account, then create a token in your admin under System › Developer › API Tokens.