Get a file
Returns file metadata (content excluded). Commonly used to confirm that the post-upload safety scan status has transitioned to available.
Prerequisites
Endpoint and authentication are configured. See Overview and authentication.
Endpoint
/files/{file_id}Returns file metadata (filename, size_bytes, mime_type, created_at, status); content is not included. The scope field is returned only on session-sandbox internal copies.
Status values
status reports the safety scan result. Values: available (passed; mountable into sessions), checking (in progress), rejected (content failed review), type_rejected (file type unsupported). Only files with status available can be mounted into a session or referenced as message content.
Path parameters
file_idstringRequiredFile ID, format file_<24 alphanumeric characters>
Response fields
idstringFile ID, formatted as file_<id>
typestringFixed value file
filenamestringFile name
mime_typestringMIME type detected by the server
size_bytesintFile size in bytes
downloadableboolWhether the file is downloadable. For direct uploads through this endpoint and session-sandbox copies, this is always false.
statusstringSafety scan status: available / checking / rejected / type_rejected
scopeobjectReturned only for session-sandbox internal copies; shape {"type": "session", "id": "sesn_..."}. Regular uploaded files do not include this field.
created_atstringUpload time, ISO 8601
requestIdstringUnique identifier for this request
Request example
curl "$AGENTSTUDIO_URL/files/file_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
import os
import dashscope
client = dashscope.Client(api_key=os.getenv('DASHSCOPE_API_KEY'))
# Query file information (returns file metadata, not file content)
result = client.files.get('file-xxx')
print(result.file_id, result.name, result.size)
AgentStudioFile f = client.files().retrieve("file_xxx");
System.out.println(f.getFilename() + " " + f.getSizeBytes());
Response example
{
"id": "file_xxx",
"type": "file",
"filename": "sales_2025.csv",
"downloadable": false,
"mime_type": "text/csv",
"size_bytes": 524288,
"status": "available",
"created_at": "2026-06-16T14:51:39+08:00",
"requestId": "xxx"
}
The response is a File object. Fields: