# Images

> The Seller API isn’t open to every seller yet. You can read the docs now; API keys and the Claude connector work once the API is turned on for your account. To ask for access, contact us: https://gathermark.com/help

The API does not accept file uploads. You can give it **image URLs** that Gathermark fetches, or add photos on the site after the draft is created.

## Listing and item images

```json
{
  "title": "Vintage pen roll: Parker, Pelikan, Sheaffer",
  "image_urls": [
    "https://example.com/roll-1.jpg",
    "https://example.com/roll-2.jpg"
  ],
  "items": [
    {
      "name": "Parker 51 Aerometric",
      "price": "185.00",
      "image_urls": ["https://example.com/parker-51.jpg"]
    }
  ]
}
```

- Listing-level `image_urls` become the gallery (the listing photos), in the order given. Send them when you create the draft, or later with `PATCH` (`update_draft_listing` through MCP), which replaces the gallery (see [Changing the gallery](#changing-the-gallery)). You can also add or change listing photos on the edit page.
- Item-level `image_urls` attach to that item. You can send them when you create the draft and with `PATCH` (`update_draft_listing` through MCP), in the item's `image_urls`.

In responses, every photo has the same shape, for the listing's gallery (`images`) and an item's photos (`items[].images`) alike:

```json
{ "id": "8Hq2kT0pXbLm3Va1", "url": "https://res.cloudinary.com/gathermark/image/upload/listings/api_12345678.jpg" }
```

The `url` is Gathermark's copy of the image, not the URL you sent.

### Which photos count

Only the listing photos (the gallery) count as the listing having photos: they clear `image` from `missing`. Item photos are shown with their item, but a listing with item photos and no listing photos still has `image` in `missing`.

## Rules for image URLs

- **`https://` only.** Any other scheme (`http://`, `file://`, `data:` and so on) is rejected with `422`.
- **Public hosts only.** Gathermark fetches the URL from its own servers, so URLs that point at private, loopback or link-local addresses (and hosts that resolve to them) are rejected.
- **A capped number of images.** At most 10 images per listing by default (`GET https://api.gathermark.com/v1/me` shows your limit).
- The URL must return the image directly. Pages that need a login, or that show the image inside an HTML page, will not work.

## Changing the gallery

`PATCH https://api.gathermark.com/v1/listings/{id}` (`update_draft_listing` through MCP) takes listing-level `image_urls`:

| You send | What happens |
|---|---|
| no `image_urls` | The gallery is kept as it is. |
| a list | The gallery's photos are replaced by the list, in that order. |
| `[]` | Every gallery photo is removed. |
| `null` | Refused with `422`. |

Each entry is an `https://` URL, or the `url` of a photo already in the gallery (as `GET` returns it), which keeps that photo as it is without fetching it again. So to add a photo, send the current `url`s plus the new entry; to reorder, send the current `url`s in the new order. Videos added on the site are left as they are.

If any entry can't be added, the `PATCH` changes nothing (see [When an image fails](#when-an-image-fails)): the gallery keeps the photos it had.

## When an image fails

What happens depends on whether you are creating the draft or changing it.

**Creating a draft** (`POST https://api.gathermark.com/v1/listings`): an image that can't be added does **not** fail the request. The draft is created and the response lists the URL under `warnings`, with one of the codes below. `warnings` is on every listing response; it is `[]` when every image was added.

| Code | What happened | What to do |
|---|---|---|
| `image_fetch_failed` | Gathermark could not fetch the URL, or it wasn't an image. | Add that photo on the edit page, or send it again with `PATCH` from a URL that works. |
| `image_concurrency_limited` | Too many requests with images were being processed for your account at once, so this image was skipped. | Later, send it again with `PATCH`. |
| `image_budget_exceeded` | Your account's image limit for today is used up (your daily draft quota times the images allowed per listing), so this image was skipped. | Add that photo on the edit page. |

For example:

```json
{
  "id": "h7Gf2KpL9sQw4ZxC",
  "status": "draft",
  "missing": [],
  "warnings": [
    { "code": "image_fetch_failed", "url": "https://example.com/roll-2.jpg", "message": "This image could not be fetched; add it on the site instead." }
  ]
}
```

**Changing a listing** (`PATCH`, `update_draft_listing` through MCP): a `PATCH` replaces the gallery, and an item's photos, with what it sends, so an image that can't be added fails the whole request instead. Nothing is changed: the listing keeps every photo it had. The response is `422` `image_fetch_failed`, with each entry that couldn't be added in `failed_images`: its `url`, the `field` it was sent in, a `code` from the table above and a `message`. Fix or remove those entries and send the change again; if every code is `image_concurrency_limited`, send the same change again in a moment.

```json
{
  "error": {
    "code": "image_fetch_failed",
    "message": "Nothing was changed: this image could not be added: image_urls[0] (https://example.com/roll-2.jpg). The listing's photos are as they were. Fix or remove each one (see failed_images for why) and send the change again.",
    "field": "image_urls[0]",
    "failed_images": [
      { "url": "https://example.com/roll-2.jpg", "field": "image_urls[0]", "code": "image_fetch_failed", "message": "This image could not be fetched: check that the URL is a public https:// image, or leave it out (the seller can add it on the site)." }
    ]
  }
}
```

## Adding photos on the site

Most sellers photograph their pens with their phone. The simplest flow is:

1. Create the draft through the API (or Claude) without images.
2. Open the draft's `edit_url` on your phone or computer.
3. Add photos and publish.

A draft with no listing photos has `image` in its `missing` list until you add one (item photos don't count).
