Skip to main content

Retrieve a source file

Return source file metadata for a file ID.

Endpoint

GET /agents/file/{file_id} Returns 200 and source file metadata. The response shape differs from the source file list and upload response: it uses bytes, Unix-second timestamps, and an object field.

Path parameters

FieldRequiredTypeDescription
file_idYesstringSource file ID
There is no source file content download endpoint.

Request example

curl -sS "$BASE_URL/agents/file/file_xxx" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "OpenAI-Beta: agents=v1"

Response example

{
  "id": "file_xxx",
  "object": "file",
  "bytes": 18,
  "created_at": 1794321796,
  "filename": "input.txt",
  "status": "uploaded"
}

Response fields

FieldTypeDescription
idstringSource file ID
objectstringSource file object type, fixed as file
bytesintegerFile size in bytes
created_atintegerCreation time in Unix seconds
filenamestringFile name
statusstringFile status: uploaded, processed, or error. processed means the file is usable; uploaded means it is uploaded and undergoing content moderation; error means processing failed or content moderation did not pass

Error codes

HTTP statusError type / codeSolution
401authentication_error / invalid_api_keySend a valid Authorization: Bearer $DASHSCOPE_API_KEY header
404not_found_error / not_found_errorUse a source file ID that exists in the current workspace
500server_error / server_errorRetry later. If it keeps failing, submit a ticket with x-request-id