Upload File
beta.files.upload(**kwargs) -> FileMetadata { id, created_at, filename, 4 more }
POST/v1/files
Upload File
Parameters
file: FileInput
The file to upload
Returns
Upload File
require "anthropic"
anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key")
file_metadata = anthropic.beta.files.upload(file: StringIO.new("Example data"))
puts(file_metadata)Response 200
{
"id": "file_011CNha8iCJcU1wXNR6q4V8w",
"created_at": "2025-04-15T18:37:24.100435Z",
"filename": "document.pdf",
"mime_type": "application/pdf",
"size_bytes": 102400,
"type": "file",
"downloadable": false
}Returns Examples
Response 200
{
"id": "file_011CNha8iCJcU1wXNR6q4V8w",
"created_at": "2025-04-15T18:37:24.100435Z",
"filename": "document.pdf",
"mime_type": "application/pdf",
"size_bytes": 102400,
"type": "file",
"downloadable": false
}