---
title: "Prepare one or more file uploads"
method: POST
path: "/files"
---

# Prepare one or more file uploads

`POST /files`

## Request

- Base URL: `https://www.useanyfile.com/api/v1`
- URL: `https://www.useanyfile.com/api/v1/files`
- Auth: HTTP bearer

Creates short-lived upload intents for direct-to-Blob transfer. Use each returned pathname, handleUploadUrl, and clientPayload with @vercel/blob/client. The clientPayload contains an intent-scoped secret for the Blob handshake, so the long-lived API credential is not sent to Blob. Poll statusUrl with the AnyFile bearer credential until the resulting file ID is available.

## Request body

- object
  - `files` object[], required
    - `name` string, required
    - `type` string, required
    - `size` integer, required
  - `folderId` string, nullable: Owned folder ID. Pass null on update to move the resource back to root.

## Response `201`

Short-lived direct upload grants

- object
  - `data` object, required
    - `uploads` object[], required
      - `intentId` string, required
      - `name` string, required
      - `contentType` string, required
      - `size` integer, required
      - `pathname` string, required
      - `handleUploadUrl` string, uri, required
      - `statusUrl` string, uri, required
      - `clientPayload` object, required: Short-lived presigned payload for the Blob token handshake. Pass it exactly as returned and do not log or persist the grant secret.
        - `intentId` string, required
        - `name` string, required
        - `grant` string, required
      - `expiresAt` string, date-time, required

## Other responses

- `400`: Structured AnyFile API error
- `401`: Structured AnyFile API error
- `403`: Structured AnyFile API error
- `404`: Structured AnyFile API error
- `409`: Structured AnyFile API error
- `429`: Structured AnyFile API error

---

[API](https://skmtc.dev/useanyfile/apis/anyfile-rest-api.md) · [All operations](https://skmtc.dev/useanyfile/apis/anyfile-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/useanyfile/apis/anyfile-rest-api/revisions/bad3e5a8e395?raw)
