Methods: client.uploadFile(), client.listFiles(), client.getFile(), client.getFileContent().
Example
const uploaded = await client.uploadFile({ purpose: "batch", file: new Blob(["{}"]) });
const file = await client.getFile(uploaded.id);
const content = await client.getFileContent(uploaded.id);
client.listFiles() exists, but GET /files currently returns file_list_not_supported_with_shared_gateway_key
when you use the shared gateway key. Persist the uploaded.id value and retrieve files directly.
Key parameters
file (required for upload): Blob/File/base64/string.
purpose (required for upload): e.g., batch.
Returns
FileObject (upload/get)
{
"id": "file-123",
"object": "file",
"filename": "data.json",
"purpose": "batch",
"status": "processed",
"created_at": 1677610602,
"bytes": 123
}
Or FileListResponse (list when the underlying provider key supports file enumeration)
{
"data": [
{
"id": "file-123",
"object": "file",
"filename": "data.json",
"purpose": "batch",
"status": "processed",
"created_at": 1677610602,
"bytes": 123
}
]
}