> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maple.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Update location stock

> Sets the stock state of up to 500 items, variations or modifier options in one call: `out_of_stock` to 86 one, `in_stock` to bring it back.

POST`https://api.maple.inc/v1/locations/{locationId}/catalog/stock`API key

Each is named by `object_type` and `external_id`. All-or-nothing: if any object is not in the published catalog, the call answers 404 `stock_object_not_found`, names every missing one and changes nothing. The phone agent sees the change at once; you need not republish. Returns the changed objects. Requires `catalog:write` and an active connection to the location.

Update location stock

```sh
curl "$MAPLE_BASE/locations/str_123/catalog/stock" \
  -H "Authorization: Bearer $MAPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"updates":[{"object_type":"item","external_id":"string","stock_status":"in_stock"}]}'
```

```python
import os
import requests


r = requests.post(
    f"{os.environ['MAPLE_BASE']}/locations/str_123/catalog/stock",
    headers={"Authorization": f"Bearer {os.environ['MAPLE_KEY']}"},
    json={
        "updates": [
            {
                "object_type": "item",
                "external_id": "string",
                "stock_status": "in_stock",
            },
        ],
    },
    timeout=30,
)
r.raise_for_status()
print(r.json())
```

```js
const res = await fetch(`${process.env.MAPLE_BASE}/locations/str_123/catalog/stock`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MAPLE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "updates": [
      {
        "object_type": "item",
        "external_id": "string",
        "stock_status": "in_stock"
      }
    ]
  }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

```json
{
  "object": "list",
  "data": [
    {
      "object": "stock_status",
      "livemode": true,
      "id": "string",
      "external_id": "string",
      "object_type": "item",
      "name": "string",
      "stock_status": "in_stock"
    }
  ],
  "has_more": true
}
```

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "string",
    "doc_url": "string",
    "feedback": "string"
  }
}
```

## Authorization

Send your API key as `Authorization: Bearer <key>`: `mpk_test_…` for test mode, `mpk_live_…` for live mode. Both use `https://api.maple.inc/v1`. See [Authentication](https://docs.maple.inc/developer-api/concepts/authentication.md). The samples read the key from `MAPLE_KEY` and the base URL from `MAPLE_BASE`, as set up in the [Quickstart](https://docs.maple.inc/developer-api/quickstart.md).

## Parameters

- `locationId` string path required

- `Idempotency-Key` string header

  Your unique key for this request, such as a UUID. A retry with the same key and the same body within 24 hours returns the first response, with `Idempotent-Replayed: true`, and does not run again. See <https://docs.maple.inc/developer-api/concepts/idempotency> Up to 255 characters.

- `Maple-Version` string header

  The API version your code expects. A version Maple does not serve answers 400 `invalid_request` with `param` `Maple-Version`. See <https://docs.maple.inc/developer-api/concepts/versioning> Always `2026-11-27`.

## Request body

`application/json`, required.

- `updates` object\[] required

  Up to 500 items.

- `updates[].object_type` string required

  One of `item`, `variation`, `modifier_option`.

- `updates[].external_id` string required

- `updates[].stock_status` string required

  One of `in_stock`, `out_of_stock`, `low_stock`.

## Responses

### 200 OK

- `object` string required

  Always `list`.

- `data` object\[] required

- `data[].object` string required

  Always `stock_status`.

- `data[].livemode` boolean required

- `data[].id` string required

  Maple’s id for the object, as the catalog returns it in `id`. Use it as `starting_after`.

- `data[].external_id` string required

  The `external_id` you published the object under.

- `data[].object_type` string required

  One of `item`, `variation`, `modifier_option`.

- `data[].name` string required

- `data[].stock_status` string required

  One of `in_stock`, `out_of_stock`, `low_stock`.

- `has_more` boolean required

### Errors

- `400` Bad request Invalid request (`invalid_request_error`), or `idempotency_error` for `idempotency_key_mismatch`

- `401` Unauthorized Missing or invalid credential (`authentication_error`)

- `403` Forbidden Not allowed (`permission_error`)

- `404` Not found Not found (`invalid_request_error`)

- `409` Conflict Conflicts with current state (`invalid_request_error`), or `idempotency_error` for `idempotency_key_in_use`

- `415` Unsupported Content-Type (`invalid_request_error`)

- `429` Too many requests Rate limit reached (`rate_limit_error`)

- `500` Server error Maple could not complete the request (`api_error`)

Every error body is one `error` object: branch on its `type` and `code`; `message` is for people, `param` names the field at fault, and `doc_url` links the code on [Errors](https://docs.maple.inc/developer-api/concepts/errors.md).

A `429` also sends `Retry-After`: Seconds to wait before retrying; also returned as error.retry\_after in the body.
