v22

latestOpenAPI 3.1.0raw.githubusercontent.com2025-10-15361989.5 KB

Create a file

Create a file by uploading its content and optional metadata.

Example cURL request:

curl -X POST https://api.replicate.com/v1/files \
  -H "Authorization: Token $REPLICATE_API_TOKEN" \
  -H 'Content-Type: multipart/form-data' \
  -F 'content=@/path/to/archive.zip;type=application/zip;filename=example.zip' \
  -F 'metadata={"customer_reference_id": 123};type=application/json'

The request must include:

  • content: The file content (required)
  • type: The content / MIME type for the file (defaults to application/octet-stream)
  • filename: The filename (required, ≤ 255 bytes, valid UTF-8)
  • metadata: User-provided metadata associated with the file (defaults to {}, must be valid JSON)
post/files

Response

File has been created

content_typestring required

The content / MIME type of the file

created_atstring date-time required

When the file was created

expires_atstring date-time required

When the file expires

idstring required

A unique, randomly-generated identifier for the file resource

metadataobject required

Metadata provided by user when the file was created

sizeinteger required

The length of the file in bytes

Example response

{
  "checksums": {
    "sha256": "f047f8e745f9996c6e386064e06cb2007b8e6bc0a968a334fc0d2b2d64012066"
  },
  "content_type": "application/zip",
  "created_at": "2024-02-21T12:54:18.578761Z",
  "expires_at": "2024-02-21T13:54:18.578761Z",
  "id": "cneqzikepnug6xezperrr4z55o",
  "metadata": {
    "customer_reference_id": 123
  },
  "size": 69420,
  "urls": {
    "get": "https://api.replicate.com/v1/files/cneqzikepnug6xezperrr4z55o"
  }
}