# Publish a product

`POST https://api.anyshop.io/v1/products/{id}/publish`

Puts a draft on sale, on your storefront and at checkout, in both modes. Refused while something its type needs is missing, such as a verified file; a listing a person has to look at first is held for review instead. Needs a live key.

- Part of the [API reference](https://docs.anyshop.io/reference.md), [Products](https://docs.anyshop.io/reference.md#products).
- Scope: `products:write`.
- Live keys only.
- Idempotent with Idempotency-Key.
- Answers 403 `store_suspended` while the store is suspended.

## Path parameters

- `id` (string, required)

## Headers

- `Idempotency-Key` (string): Up to 255 characters. A retry with the same key and request gets the first answer, without running twice (24 hours).

## Returns

The **product** object.

## Errors

| Status | error.type | When |
| --- | --- | --- |
| 400 | `invalid_request` | The request is not valid; `error.param` names the field |
| 401 | `authentication` | No API key, or it is not valid |
| 403 | `permission` | The key does not have the scope this needs, or the store is suspended (store_suspended) |
| 404 | `not_found` | Not found in the key's store and mode |
| 409 | `conflict` | Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused) |
| 429 | `rate_limited` | Too many requests; see Retry-After |

## Example

curl:

```bash
curl -X POST \
  https://api.anyshop.io/v1/products/prod_01m3rr5kmbeb2s18x1kpntjxqb/publish \
  -H "Authorization: Bearer $ANYSHOP_LIVE_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Node:

```js
const response = await fetch("https://api.anyshop.io/v1/products/prod_01m3rr5kmbeb2s18x1kpntjxqb/publish", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ANYSHOP_LIVE_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
const answer = await response.json();
```

Python:

```python
import os
import requests
import uuid

response = requests.post(
    "https://api.anyshop.io/v1/products/prod_01m3rr5kmbeb2s18x1kpntjxqb/publish",
    headers={
        "Authorization": f"Bearer {os.environ['ANYSHOP_LIVE_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
answer = response.json()
```

Answer (200):

```json
{
  "object": "product",
  "id": "prod_01m3rr5kmbeb2s18x1kpntjxqb",
  "name": "Lumen Studio Pro",
  "slug": "lumen-studio-pro",
  "description": "",
  "type": "serial",
  "category": "digital_files",
  "status": "draft",
  "currency": "USD",
  "variants": [
    {
      "id": "var_01m3rr5kmd6h0q2t8w4y9zb7ce",
      "name": "Standard",
      "price": 1999,
      "compare_at_price": null,
      "price_kind": "fixed",
      "minimum_price": null,
      "suggested_price": null,
      "current_price": 1999,
      "sale": null,
      "description": null,
      "low_stock_threshold": null
    }
  ],
  "stock_mode": "shared",
  "max_quantity_per_order": 2,
  "min_quantity_per_order": 1,
  "listed": true,
  "low_stock_threshold": 20,
  "platform": "Windows and macOS",
  "region": "Global",
  "delivery_instructions": "In Lumen Studio Pro, choose Help, Enter license key, and paste this key.",
  "immediate_delivery_consent": true,
  "stock_limit": null,
  "payment_methods": null,
  "seo_title": null,
  "seo_description": null,
  "after_purchase_url": null,
  "quantity_discounts": [],
  "thank_you_message": "",
  "questions": [],
  "upsell": null,
  "items": null,
  "created_at": "2026-10-02T14:21:07.000Z",
  "updated_at": "2026-10-02T14:21:07.000Z",
  "published_at": null
}
```

Answer (400):

```json
{
  "error": {
    "type": "invalid_request",
    "code": "invalid_query",
    "message": "The request is not valid; `error.param` names the field",
    "param": null
  }
}
```

Answer (409):

```json
{
  "error": {
    "type": "conflict",
    "code": "conflict",
    "message": "Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused)",
    "param": null
  }
}
```

The IDs and keys in these examples are made up. Every schema is in the OpenAPI document, https://api.anyshop.io/v1/openapi.json.
