> ## Documentation index
> Fetch the complete documentation index at: https://tryjuice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Images & retention

> How the images are made and hosted, how to keep them, and how long everything is kept.

Source: https://tryjuice.ai/platform/docs/images-and-retention.md

## Images

Juice also makes the images for every design, created to fit your request.

## The assets array

`artifacts.assets` lists the design’s images, the same URLs `artifacts.html` uses.

*artifacts.assets*

```json
[
  {
    "url": "https://api.tryjuice.ai/assets/gen_8Kq2mZt4Rw9xLp3VbN7cHd1F/0.jpg",
    "width": 1536,
    "height": 960,
    "alt": "Morning light on a counter of pastéis de nata",
    "content_type": "image/jpeg",
    "bytes": 182311
  },
  {
    "url": "https://api.tryjuice.ai/assets/gen_8Kq2mZt4Rw9xLp3VbN7cHd1F/1.jpg",
    "width": 1024,
    "height": 1280,
    "alt": "The baker dusting cinnamon over a tray of custard tarts",
    "content_type": "image/jpeg",
    "bytes": 214870
  },
  {
    "url": "https://api.tryjuice.ai/assets/gen_8Kq2mZt4Rw9xLp3VbN7cHd1F/2.jpg",
    "width": 1024,
    "height": 1024,
    "alt": "A paper bag of bread rolls on a tiled windowsill",
    "content_type": "image/jpeg",
    "bytes": 167402
  }
]
```

- `url` (string): Public URL of the image.
- `width, height` (integer): Its size in pixels.
- `alt` (string): The alt text of its slot in the design.
- `content_type` (string): `image/jpeg`, or `image/webp` for images with a transparent background.
- `bytes` (integer): File size.

## Image URLs

- **Public but unguessable.** No key needed; anyone with the URL can load the image.
- **Kept as long as the job,** which is until you delete it. Then its images go too, though cached copies can show for up to an hour.
- **Cached** with `Cache-Control: public, max-age=3600`. Some may redirect, so follow redirects.

To serve a design from your own storage, or keep it after you delete the job, copy its images and point the design at the copies:

*rehost.ts*

```ts
const API = 'https://api.tryjuice.ai/v1'

// Stores bytes in your own storage (S3, R2, GCS…) and returns their URL.
type Upload = (bytes: ArrayBuffer, contentType: string) => Promise<string>

async function rehost(id: string, upload: Upload) {
  const res = await fetch(`${API}/generations/${id}?include=artifacts`, {
    headers: { Authorization: `Bearer ${process.env.JUICE_API_KEY}` },
  })
  const { artifacts } = await res.json()

  let html = artifacts.html
  for (const asset of artifacts.assets) {
    const image = await fetch(asset.url)
    const copy = await upload(await image.arrayBuffer(), asset.content_type)
    html = html.replaceAll(asset.url, copy)
  }
  return html // the page, pointing at your copies
}
```

## Showing the design in your product

Put the design in a sandboxed iframe, so it stays apart from your site:

```html
<iframe sandbox="allow-scripts" srcdoc="…the design, with & and &quot; escaped…" title="Generated design"></iframe>
```

## Retention

| What | How long |
| --- | --- |
| The job, its design and images | Until you [delete it](https://tryjuice.ai/platform/docs/generations.md#delete-a-generation). Nothing is deleted automatically (`expires_at` is always `null`). |
| After deletion | Only a short record is kept: ids, times and usage. The prompt, title, design and images are gone. |
| Call logs | 90 days: each call’s operation, status, timing, IP address and user agent, never a body. Calls with no key, a malformed key or an unknown key are only counted. |
