> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://tieback.io/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://tieback.io/docs/_mcp/server.

# API: Images

> Upload a web-sized principal picture for each product with an API key. The picture shows on the product and its passport.

## What It Does

Gives each product 1 principal picture from your own system, in 2 steps:

1. **Upload** web-sized pictures. Each gets an `image_id`.
2. **Set** an uploaded picture as a product's principal picture.

The principal picture shows on the product in **tie*back*** and on its passport.

| Route                      | Returns                                 |
| -------------------------- | --------------------------------------- |
| `POST /v1/images`          | An `image_id` for each uploaded picture |
| `POST /v1/products/images` | A status for each product               |

## Who It's For

Developers bringing product photos into **tie*back*** from a store or a product information system.

## Before You Start

* Use a key with **Import products** (see **API: Credentials**). Send `Authorization: Bearer <token>`.
* A key works in its own workspace only. It cannot remove pictures people added or change anything else about a product.
* Get product ids from **API: Products** (`POST /v1/products/lookup` finds them by SKU, GTIN or your own id).
* **Send web-sized pictures.** A store's own image service can give you one: for example, add `width=1600` to a Shopify image address.

---

### POST /v1/images

Send `multipart/form-data` with 1 to 10 files, each in a field named `files`.

* **Types:** PNG, JPEG or WebP. The type is read from the file itself, never from its name.
* **Size:** up to 2 MB a file, and up to 2048 pixels on the long side. The whole request is up to 21 MB.

```bash
curl -X POST https://api.tieback.io/v1/images \
  -H "Authorization: Bearer $TOKEN" \
  -F "files=@front.jpg"
```

```json
{
  "images": [
    {
      "image_id": "3c1e…",
      "filename": "front.jpg",
      "mime_type": "image/jpeg",
      "size_bytes": 182113,
      "status": "stored",
      "expires_at": "2026-11-14T10:00:00Z"
    }
  ]
}
```

* **`status`:** `stored`, or `not_stored` if that file could not be saved (send it again).
* **`filename`:** the name as kept. Folders, spaces and control characters are removed.
* **`expires_at`:** set the picture on a product before then. An upload that is never set is removed after 24 hours.
* **Refused files:** if any file is refused, nothing is uploaded and the reply lists each file with its `reason`:
  * `empty`;
  * `too_large` (over 2 MB);
  * `too_many_pixels` (over 2048 pixels on the long side);
  * `not_png_jpeg_or_webp`;
  * `unreadable` (the picture's size could not be read).
* **Limit:** a workspace can hold up to 500 uploads that are not yet set (`409` beyond that).

### POST /v1/products/images

Sets uploaded pictures as products' principal pictures: up to 100 items a call, 1 per product.

```bash
curl -X POST https://api.tieback.io/v1/products/images \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "items": [ { "product_id": "9a00…", "image_id": "3c1e…" } ] }'
```

```json
{
  "results": [
    {
      "index": 0,
      "product_id": "9a00…",
      "image_id": "3c1e…",
      "status": "set",
      "attachment_id": "e81f…"
    }
  ]
}
```

| `status`               | Meaning                                                                                      |
| ---------------------- | -------------------------------------------------------------------------------------------- |
| `set`                  | The picture is now the product's principal picture                                           |
| `already_set`          | That picture is already the product's principal picture; nothing changed                     |
| `kept_tieback_picture` | Someone added a picture to the product in tieback; it stays, and yours is not added          |
| `removed_in_tieback`   | Someone removed the API's picture from the product in tieback; the API sets none there again |
| `in_use_by_notice`     | A draft recall notice uses the API's current picture; it stays until the notice is done      |
| `product_not_found`    | No such product in this workspace                                                            |
| `image_not_found`      | No such upload in this workspace, not stored, or expired before it was set                   |

**Replacing a picture:** setting a new picture replaces the one the API set before. Pictures people add in **tie*back*** always win: when someone adds a picture to a product, the API's picture on it is retired at once. 1 upload can be set on several products.

---

## Errors

Errors are `application/problem+json` with `title`, `status`, `detail` and `request_id` (also in the `X-Request-Id` header; quote it to support). A request body over 21 MB (uploads) or 64 KB (set) gets `413`. `503` means try again shortly; an upload that was stored before the error stays until it expires.

## Related Docs

* [API: Credentials](/docs/api-reference/api-credentials)
* [API: Products](/docs/api-reference/api-products)
* [API: Import](/docs/api-reference/api-import)