---
title: "Initialise an upload for the authenticated user — allocate Site + presigned PUT URLs"
method: POST
path: "/sites/uploads/init"
tags: ["Uploads"]
---

# Initialise an upload for the authenticated user — allocate Site + presigned PUT URLs

`POST /sites/uploads/init`

## Request

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

## Request body

- AuthInitUploadDto
  - `subdomain` string, required: Requested subdomain (server may disambiguate with `-N` suffix on collision)
  - `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

- APIInitUploadResponse
  - `uploadBatchId` string, required
  - `subdomain` string, required: Subdomain the file will be served from. May differ from the requested value if disambiguation was applied.
  - `expiresAt` string, date-time, required
  - `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 (subdomain, 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)
