---
title: "Initialise a preview upload — allocate a random preview address + presigned PUT URLs"
method: POST
path: "/previews/uploads/init"
tags: ["Previews"]
---

# Initialise a preview upload — allocate a random preview address + presigned PUT URLs

`POST /previews/uploads/init`

## Request

- Base URL: `https://api.nippy.host`
- URL: `https://api.nippy.host/previews/uploads/init`
- Auth: `bearer` (a scheme the document does not define)

## Request body

- InitPreviewUploadDto
  - `files` InitUploadFileDto[], required
    - `name` string, required: Filename including extension
    - `size` number, required: File size in bytes
    - `contentType` string, required: MIME type the browser will use when uploading

## Response `200`

Init successful — files should be PUT to the returned URLs

- APIInitPreviewUploadResponse
  - `uploadBatchId` string, required
  - `previewId` string, required
  - `slug` string, required: Server-assigned random preview name
  - `expiresAt` string, date-time, required: Presigned upload URLs stop working at this time
  - `files` APIPresignedFile[], required
    - `name` string, required: Original filename as supplied to /uploads/init
    - `uploadUrl` string, required: Presigned PUT URL — bind exact ContentType + Content-Length
    - `key` string, required: R2 object key the file will land at

## Other responses

- `400`: Validation failed (file shape, size cap, etc.)
- `401`: Not authenticated

---

[API](https://skmtc.dev/nippy/apis/nippy-backend-api.md) · [All operations](https://skmtc.dev/nippy/apis/nippy-backend-api/llms.txt) · [OpenAPI document](https://skmtc.dev/nippy/apis/nippy-backend-api/revisions/7ab23f040a55?raw)
