DevelopersREST API

AnyFile API documentation

Upload, organize, and manage your files, create share links and file requests, inspect submissions, and read analytics with the versioned AnyFile REST API. The OpenAPI 3.1 contract is the source of truth for request and response schemas.

Getting started

Make your first request

All REST endpoints are versioned under the base URL below. JSON endpoints expect a bearer credential and return JSON unless the endpoint streams file contents.

https://www.useanyfile.com/api/v1
curl "https://www.useanyfile.com/api/v1/files?limit=25" \
  -H "Authorization: Bearer YOUR_API_KEY"

Keep API keys secret. AnyFile only shows a newly created key once, so store it securely when you create it.

Authentication

API keys and OAuth 2.0

Send either an AnyFile API key or an OAuth 2.0 access token in the Authorization header. OAuth tokens for REST integrations target the AnyFile API resource.

Authorization: Bearer YOUR_API_KEY

OAuth authorization-server metadata is available at /.well-known/oauth-authorization-server.

Permissions

Use least-privilege scopes

API keys and OAuth use the same granular permissions. Grant only the scopes your integration needs. Uploading, organizing, renaming, and deleting owned files or folders requires files:write. Reading folders and downloads use files:read. Moving a file request requires requests:write.

files:readView your files, including their contents and metadata
files:writeUpload, rename, and delete your files
folders:readView your folders and their resource counts
folders:writeCreate, rename, and delete your folders
shares:readView your share links
shares:writeCreate, update, and disable share links
requests:readView your file requests and submissions
requests:writeCreate, update, and disable file requests
analytics:readView share analytics
File uploads

Upload directly without proxying file bytes

AnyFile uses short-lived upload grants so large files transfer directly to private Blob storage. First prepare one or many uploads with file metadata. Add an owned folder ID to create the resulting files directly inside that folder.

POST https://www.useanyfile.com/api/v1/files
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "folderId": "FOLDER_ID",
  "files": [
    {
      "name": "proposal.pdf",
      "type": "application/pdf",
      "size": 482193
    }
  ]
}

Install @vercel/blob, then transfer each file using the returned pathname, handleUploadUrl, and clientPayload. Pass the client payload exactly as returned. It expires with the upload intent and should be treated like a presigned upload URL.

import { upload } from "@vercel/blob/client";

await upload(grant.pathname, file, {
  access: "private",
  contentType: grant.contentType,
  multipart: file.size > 5 * 1024 * 1024,
  handleUploadUrl: grant.handleUploadUrl,
  clientPayload: JSON.stringify(grant.clientPayload),
});

Finally, poll the returned statusUrl with the same bearer credential used to prepare the upload until the status iscomplete. The result contains the AnyFile file ID you can use with download, metadata, deletion, folder moves, or the existing share-link endpoint.

GET https://www.useanyfile.com/api/v1/files/uploads/UPLOAD_INTENT_ID
Authorization: Bearer YOUR_API_KEY

{
  "data": {
    "status": "complete",
    "result": { "id": "FILE_ID" }
  }
}
Uploading and creating a share are separate operations. After an upload completes, pass its file ID to the existing POST /shares endpoint only when your workflow actually needs a public share.
Folders

Organize files and request destinations

Folders are flat, user-owned containers. Files and file requests expose both folderId and compact folder metadata. Filter collection endpoints with folderId, or setfolderId: null on an update to move a resource back to root. Deleting a folder keeps its contents and moves them to root automatically.

POST https://www.useanyfile.com/api/v1/folders
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{ "name": "Client A" }
PATCH https://www.useanyfile.com/api/v1/files/FILE_ID
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{ "folderId": "FOLDER_ID" }
POST https://www.useanyfile.com/api/v1/requests
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "title": "Upload your documents",
  "folderId": "FOLDER_ID"
}
Pagination

Cursor-based pagination

Collection endpoints use cursor pagination. Pass the returnednextCursorvalue as the next request'scursorparameter. A null next cursor means there are no more results.

{
  "data": [...],
  "pagination": {
    "nextCursor": "cursor_value"
  }
}
Errors

Structured error responses

API errors use a consistent object with a machine-readable code, human-readable message, and actionable hint. Handle 400, 401, 403, 404, 409, and 429 responses where applicable.

{
  "error": {
    "code": "...",
    "message": "...",
    "hint": "..."
  }
}
Reference

Endpoints

The reference below summarizes the public v1 surface. Use the OpenAPI contract for complete request, response, and schema definitions.

Full schema
GET/Public

API capabilities

Inspect the public API capability index. Authentication is not required.

GET/filesfiles:read

List files

List owned file metadata with search, folder filtering, cursor pagination, and a configurable limit.

POST/filesfiles:write

Prepare file uploads

Prepare one or many direct uploads, optionally into a folder, and receive short-lived Blob upload grants.

DELETE/filesfiles:write

Delete files

Permanently delete one or many owned files by file ID.

GET/files/uploads/{intentId}files:write

Get upload status

Poll a prepared upload until it returns the created AnyFile file ID or an error.

GET/files/{fileId}files:read

Get a file

Get metadata for one file, including its folder assignment.

PATCH/files/{fileId}files:write

Update file metadata

Rename and/or move an owned file. Use folderId: null to move it back to root.

DELETE/files/{fileId}files:write

Delete a file

Permanently delete one owned file and its generated previews.

GET/files/{fileId}/downloadfiles:read

Download a file

Stream an owned file through the authenticated AnyFile download endpoint.

GET/foldersfiles:read

List folders

List owned folders with file and file-request counts.

POST/foldersfiles:write

Create a folder

Create a flat user-owned folder for files and file requests.

GET/folders/{folderId}files:read

Get a folder

Get one owned folder and its resource counts.

PATCH/folders/{folderId}files:write

Rename a folder

Rename an owned folder.

DELETE/folders/{folderId}files:write

Delete a folder

Delete a folder without deleting its contents. Files and file requests move back to root.

GET/sharesshares:read

List share links

List share links with cursor pagination.

POST/sharesshares:write

Create a share link

Create or reactivate a share link for an owned file.

GET/shares/{shareId}shares:read

Get a share link

Get one share link and its associated file metadata.

PATCH/shares/{shareId}shares:write

Update a share link

Update the state or supported settings of an existing share link.

GET/requestsrequests:read

List file requests

List file requests with cursor pagination and optional folderId filtering.

POST/requestsrequests:write

Create a file request

Create a file request, optionally assign a destination folder, and return its public URL.

GET/requests/{requestId}requests:read

Get a file request

Get one file request, its folder assignment, and its submission count.

PATCH/requests/{requestId}requests:write

Update a file request

Update settings and/or move a file request. Use folderId: null to move it back to root.

GET/requests/{requestId}/submissionsrequests:read

List request submissions

Review submitter details and safe file metadata without exposing private storage URLs.

GET/analyticsanalytics:read

Get analytics

Read aggregate analytics, or pass shareId to inspect one owned share.

Need machine-readable docs?

The OpenAPI 3.1 document is available directly for client generation, tooling, and agent discovery.

View /openapi.json