Files
files
Methods
Create A File -> { id, checksums, content_type, 5 more... }
post/files
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 toapplication/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)
Delete A File ->
delete/files/{file_id}
Delete a file. Once a file has been deleted, subsequent requests to the file resource return 404 Not found.
Example cURL request:
curl -X DELETE \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/files/cneqzikepnug6xezperrr4z55o
Download A File -> unknown
get/files/{file_id}/download
Download a file by providing the file owner, access expiry, and a valid signature.
Example cURL request:
curl -X GET "https://api.replicate.com/v1/files/cneqzikepnug6xezperrr4z55o/download?expiry=1708515345&owner=mattt&signature=zuoghqlrcnw8YHywkpaXQlHsVhWen%2FDZ4aal76dLiOo%3D"
Get A File -> { id, checksums, content_type, 5 more... }
get/files/{file_id}
Get the details of a file.
Example cURL request:
curl -s \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/files/cneqzikepnug6xezperrr4z55o
List Files -> CursorURLPage<{ id, checksums, content_type, 5 more... }>
get/files
Get a paginated list of all files created by the user or organization associated with the provided API token.
Example cURL request:
curl -s \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/files
The response will be a paginated JSON array of file objects, sorted with the most recent file first.