Skip to content

Get a file

GET /v1/files/{file_id}

Returns a file’s metadata.

To get the file’s content, see Download a file.

The key must have the files:read capability. For what each capability allows, see Keys.

Path parameters

NameTypeRequiredDefaultDescription
file_idstringYesThe ID of the file to retrieve.

Response

Returns 200 with the file object. For every field, see Files.

{
"id": "329409ba-f288-4b44-9c73-14a18150edee",
"created_at": "2026-10-21T01:41:11.028Z",
"filename": "cities.csv",
"mime_type": "text/csv",
"size_bytes": 46,
"type": "file",
"downloadable": true
}

Errors

This endpoint can return these errors as well as the common errors.

Statuserror.typeCause and fix
404not_found_errorNo file with this ID exists, or this key can’t read it or the session that produced it. Check the ID from the upload or from the list.

Example

cURL
curl -sS "$CONTEXT_BASE_URL/v1/files/329409ba-f288-4b44-9c73-14a18150edee" -H "x-api-key: $CONTEXT_API_KEY"
Python
file = client.beta.files.retrieve_metadata("329409ba-f288-4b44-9c73-14a18150edee")
TypeScript
const file = await client.beta.files.retrieveMetadata("329409ba-f288-4b44-9c73-14a18150edee")