# Shopify API for agents

> API for Agents · https://apiforagents.dev/platforms/shopify · HTML twin: https://apiforagents.dev/platforms/shopify

Products, prices and stock from any Shopify store.

Endpoint: `POST https://apiforagents.dev/v1/shopify`. One op per call. Quote first with `"estimateOnly": true`.

## Prices (USD per record, pay as you go)

| Record | Per record |
|---|---|
| products | $0.0009 |

## Operations

### products

The catalogue of up to five Shopify storefronts. Every product with its price range, sale flag, stock, variants and options.

| Field | Required | Type | Meaning |
|---|---|---|---|
| subjects | yes | list of string (1-5 items) | Store URLs. Any Shopify-powered storefront. |
| limit | no | integer (1-100) |  |

Response fields (each row of data; every field present, null when the source had nothing):

| Field | Type |
|---|---|
| storeUrl | string |
| productId | string |
| productUrl | string |
| title | string |
| brand | string |
| category | string |
| description | string |
| tags | list of string |
| currency | string |
| priceFrom | number |
| priceTo | number |
| onSale | boolean |
| inStock | boolean |
| variantCount | integer |
| variants | any |
| options | any |
| imageUrl | string |
| media | any |
| createdDate | string |
| publishedDate | string |
| details | object |

`details` is always the last field: everything else the source sent for that row, under our own field names. Its keys depend on the source that answered, so read them defensively; it is `{}` when there is nothing more.

Example request:

```bash
curl -X POST https://apiforagents.dev/v1/shopify \
  -H "Authorization: Bearer $AFA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"op":"products","subjects":["https://www.allbirds.com"],"limit":25}'
```

Example response rows (made-up names, real field names; a live row carries every field above):

```json
[
  {
    "title": "Linen Overshirt",
    "brand": "Northfold Studio",
    "category": "Shirts",
    "currency": "USD",
    "priceFrom": 89,
    "priceTo": 89,
    "onSale": false,
    "inStock": true,
    "variantCount": 5,
    "tags": [
      "linen",
      "summer"
    ],
    "storeUrl": "https://shop.northfold.example/linen-overshirt-1000",
    "productId": "2846215038",
    "productUrl": "https://shop.northfold.example/linen-overshirt-1000",
    "imageUrl": "https://img.shop.northfold.example/linen-overshirt.jpg",
    "createdDate": "2026-10-07",
    "publishedDate": "2026-10-07",
    "details": {}
  },
  {
    "title": "Merino Crew Socks (3 pack)",
    "brand": "Northfold Studio",
    "category": "Socks",
    "currency": "USD",
    "priceFrom": 28,
    "priceTo": 32,
    "onSale": true,
    "inStock": true,
    "variantCount": 3,
    "tags": [
      "merino",
      "bestseller"
    ],
    "storeUrl": "https://shop.northfold.example/merino-crew-socks-3-pack-1001",
    "productId": "508030209",
    "productUrl": "https://shop.northfold.example/merino-crew-socks-3-pack-1001",
    "imageUrl": "https://img.shop.northfold.example/merino-crew-socks-3-pack.jpg",
    "createdDate": "2026-10-01",
    "publishedDate": "2026-10-14",
    "details": {}
  }
]
```

Try it in the playground: https://apiforagents.dev/dashboard/run?platform=shopify&op=products (sign in first).

### history (free)

Stored price/stock series of a store's products already held. Free.

| Field | Required | Type | Meaning |
|---|---|---|---|
| subjects | yes | list of string (1-5 items) |  |
| metric | no | enum |  Values: price_from, price_to, in_stock, variant_count. |
| days | no | integer (1-730) |  |

Request shape:

```json
{
  "op": "history",
  "subjects": [
    "example"
  ]
}
```

Try it in the playground: https://apiforagents.dev/dashboard/run?platform=shopify&op=history (sign in first).

## Notes for the agent

Measured Shopify storefront data, one operation per call. Any Shopify-powered store, named by its URL. Every fetch adds a price and stock point to each product's history. ops: products (the catalogue of up to five stores. Title, brand, category, tags, price range, sale flag, stock, variant count, every variant with SKU/price/stock, options, images, created and published dates), history (stored price/stock series of a product already held, by product URL, free). Fresh fetches are charged per record; your own answer is free while fresh.
