---
title: "Preview a task image"
method: GET
path: "/api/tasks/{id}/files/{fileId}/preview"
---

# Preview a task image

`GET /api/tasks/{id}/files/{fileId}/preview`

## Request

- Base URL: `https://www.toma.com`
- URL: `https://www.toma.com/api/tasks/{id}/files/{fileId}/preview`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `better-auth.session_token`

Return authenticated JSON with base64 PNG or JPEG bytes for non-animated images up to 1 MiB, 8192 pixels per side, and 16 megapixels. Other files return unavailable with a reason. Applies the same access rules as downloads and checks access again after reading all bytes. No public URL is issued. Treat images as untrusted content. Already delivered previews cannot be recalled.

## Path parameters

- `id` string, required
- `fileId` string, required

## Response `200`

Image preview or unavailable reason.

- union
  - object
    - `kind` 'image', required
    - `fileId` string, required
    - `path` string, required
    - `mimeType` 'image/png' | 'image/jpeg', required
    - `data` string, byte, required
  - object
    - `kind` 'unavailable', required
    - `fileId` string, required
    - `path` string, required
    - `reason` string, required

## Other responses

- `401`: Sign in first.
- `403`: File access denied or changed during preview.
- `404`: No accessible ready file.
- `409`: Account deletion has closed these files.
- `503`: Storage unavailable or file integrity check failed.

---

[API](https://skmtc.dev/toma/apis/toma-api.md) - [All operations](https://skmtc.dev/toma/apis/toma-api/llms.txt) - [OpenAPI document](https://skmtc.dev/toma/apis/toma-api/revisions/b4e56e1db5a2?raw)
