# GET /products/{id}/availability — Check availability

A live check: can the product be bought right now.

For automatically fulfilled products it checks the supplier's stock and whether the price is acceptable. For manually fulfilled products it returns our own “on sale” flag.

Call it right before a purchase. `POST /purchase/{productId}` runs the same check, so this endpoint and the purchase never disagree.

Authorization: header `X-Entity-Key`.

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Product ID, a positive integer. Example: `12`. |

**Responses**

- `200 OK` — Available

```json
{
  "status": "success",
  "productId": 12,
  "price": 1490,
  "currency": "RUB",
  "available": true
}
```

- `200 OK` — Unavailable. `reason`: `out_of_stock` — the supplier has none; `not_configured` — the product isn't set up for automatic fulfillment; `temporarily_unavailable` — can't be sold at the current price for now.

```json
{
  "status": "success",
  "productId": 12,
  "price": 1490,
  "currency": "RUB",
  "available": false,
  "reason": "out_of_stock"
}
```

- `400 Bad Request` — Invalid ID

```json
{
  "status": "error",
  "message": "Invalid product id"
}
```

- `404 Not Found` — Product not found

```json
{
  "status": "error",
  "message": "Product not found"
}
```

- `503 Service Unavailable` — Check unavailable

```json
{
  "status": "error",
  "message": "Availability check temporarily unavailable"
}
```

- `401 Unauthorized` — No key

```json
{
  "status": "error",
  "message": "Missing X-Entity-Key header"
}
```

- `403 Forbidden` — Invalid key

```json
{
  "status": "error",
  "message": "Invalid entity key"
}
```

- `429 Too Many Requests` — Rate limited

```json
{
  "status": "error",
  "message": "Too many requests, try again later"
}
```

Web version: https://docs.merchant.dbdlobby.com/en/reference/product-availability
