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

file_id string (required)Source file IDThere 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 fields

id stringSource file IDobject stringSource file object type, fixed as filebytes integerFile size in bytescreated_at integerCreation time in Unix secondsfilename stringFile namestatus stringFile 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

Response example

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

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