# `image.archiveToken`

<span class="badge">bearer / PAT</span>

**Mint a short-lived link to download the full archive**

Returns a 5-minute, image-scoped URL to a zip of every render plus the original. Ready images only — a pending/failed image would produce a partial archive.

## Parameters

Passed by name in the `params` object.

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Image UUID |

## Result

Returns `archiveResult`:

| Field | Type | Description |
|---|---|---|
| `expires_at *` | string |  |
| `url *` | string |  |

## Errors

| Code | Message | When |
|---|---|---|
| `2002` | `validation_failed` | Malformed request; see error.data. |
| `2001` | `not_found` | No such resource owned by the caller. |

See the [error reference](/docs/errors) for the full catalog, including the authentication codes.

## Example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "image.archiveToken",
  "params": {
    "id": "018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d"
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "url": "https://peinture.gumeniuk.com/api/v1/images/018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d/archive?token=eyJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJhcmNoaXZlIn0.c2ln",
    "expires_at": "2026-03-14T09:31:53Z"
  }
}
```

**curl**

```bash
curl -s https://peinture.gumeniuk.com/rpc \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"image.archiveToken","params":{"id":"018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d"}}'
```

**JavaScript**

```js
const res = await fetch("https://peinture.gumeniuk.com/rpc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${token}`,
  },
  body: JSON.stringify({
    jsonrpc: "2.0", id: 1, method: "image.archiveToken", params: {"id":"018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d"},
  }),
});
const { result, error } = await res.json();
```

**Go**

```go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"image.archiveToken","params":{"id":"018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d"}}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
```

