---
title: "File a derived copy of a photo"
method: PUT
path: "/api/v1/documents/{id}/variants/{variant}"
tags: ["Files"]
---

# File a derived copy of a photo

`PUT /api/v1/documents/{id}/variants/{variant}`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/documents/{id}/variants/{variant}`
- Auth: API key in cookie `better-auth.session_token`

The copy’s bytes, as the body. The browser derives a small copy of a photo at upload time and files it here; the server mints the key from the original’s own, so a copy always sits beside what it was made from and is deleted, replaced, swept and erased with it. Only a photo that is already stored takes copies, a copy is WebP or JPEG, and sending the same copy again replaces it. Read one back from GET /documents/{id}/content?variant=…

## Path parameters

- `id` string, required
- `variant` 'thumb' | 'display', required

## Query parameters

- `width` integer, required
- `height` integer, required

## Response `200`

The copy is filed and will be served for its name from now on.

- object
  - `ok` unknown, required
  - `data` object, required
    - `documentId` string, required: Stable record id, e.g. `lse_012`.
    - `variant` 'thumb' | 'display', required
    - `bytes` integer, required: What the store measured, not what the client sent.
    - `contentType` string, required
    - `width` integer, required
    - `height` integer, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: The copy is not an image type copies are kept in, is larger than a copy may be, declares no length, or the document’s file is not a photo.
- `401`: No session. Sign in first.
- `404`: No document with that id belongs to you.
- `409`: The original has not landed yet. A copy of nothing is nothing.
- `429`: Over the file budget, which is counted per owner and separately from the rest of the API.

---

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