Skip to content

Retrieve file

GET https://api.fastapi.ai/v1/files/{file_id}

Returns information about a specific file.

Path parameters


file_id string Required
The ID of the file to use for this request.

Returns


The File object matching the specified ID.


The file object

The File object represents a document that has been uploaded to OpenAI.


id string
The file identifier, which can be referenced in the API endpoints.


bytes integer
The size of the file, in bytes.


created_at integer
The Unix timestamp (in seconds) for when the file was created.


expires_at integer
The Unix timestamp (in seconds) for when the file will expire.


filename string
The name of the file.


object string
The object type, which is always file.


purpose string
The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results and vision.


status Deprecated string
Deprecated. The current status of the file, which can be either uploaded, processed, or error.


status_details Deprecated string
Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.


OBJECT The file object
bash
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 120000,
  "created_at": 1677610602,
  "expires_at": 1680202602,
  "filename": "salesOverview.pdf",
  "purpose": "assistants",
}

Example

Request

bash
curl https://api.fastapi.ai/v1/files/file-abc123 \
  -H "Authorization: Bearer $FAST_API_KEY"

Response

bash
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 120000,
  "created_at": 1677610602,
  "filename": "mydata.jsonl",
  "purpose": "fine-tune",
}

那年我双手插兜, 让bug稳如老狗