---
title: "Get a preview URL"
method: GET
path: "/api/v1/files/{fileId}/preview"
tags: ["Files"]
---

# Get a preview URL

`GET /api/v1/files/{fileId}/preview`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/files/{fileId}/preview`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Returns a short-lived presigned URL (inline disposition) for a ready, preview-eligible file (images and PDFs); load the bytes directly from that URL before it expires. The URL grants access to the file contents — treat it as a secret and request a fresh one per render. Responds 409 until the file is ready, and 415 when the file cannot be previewed inline.

## Path parameters

- `fileId` string, required

## Response `200`

The presigned preview URL and its expiry.

- object
  - `url` string, required: Short-lived presigned GET URL with inline disposition for rendering in-browser.
  - `expiresAt` string, required

## Other responses

- `401`: Authentication is missing or invalid.
- `404`: The resource was not found.
- `409`: Response.
- `415`: Response.
- `429`: Too many requests; retry after the indicated delay.

---

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