---
title: "Create a file"
method: POST
path: "/files"
---

# Create a file

`POST /files`

Create a file by uploading its content and optional metadata.

Example cURL request:

```console
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)

## Response `201`

File has been created

- SchemasFileResponse — A file resource
  - `checksums` object, required — A dictionary of checksums for the file keyed by the algorithm name
    - `sha256` string — SHA256 checksum of the file
  - `content_type` string, required — The content / MIME type of the file
  - `created_at` string, date-time, required — When the file was created
  - `expires_at` string, date-time, required — When the file expires
  - `id` string, required — A unique, randomly-generated identifier for the file resource
  - `metadata` object, required — Metadata provided by user when the file was created
  - `size` integer, required — The length of the file in bytes
  - `urls` object, required — A dictionary of URLs associated with the file resource
    - `get` string, uri — A URL to the file resource

## Other responses

- `413` — Content Too Large

---

[API](https://skmtc.net/replicate/apis/replicate-http-api.md) · [All operations](https://skmtc.net/replicate/apis/replicate-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/replicate/replicate-http-api/versions/7a537f433b0b/schema)
