API reference
Read a file
GET /api/pub/v1/files/{fileId}, a file's metadata.
GET
https://api.dhanu.ai/api/pub/v1/files/{fileId}Reads a file’s metadata. kind tells you what it is: an uploaded file, image,
audio or video, or an artifact the assistant made, a canvas, page, sheet,
deck or app. Uploaded kinds can be downloaded;
artifacts are exported instead.
Request
curl https://api.dhanu.ai/api/pub/v1/files/$FILE_ID \
-H "Authorization: Bearer $DHANU_API_KEY"const file = await dhanu.files.get(fileId);file = dhanu.files.get(file_id) Response
200 OK
{ "file": { "id": "…", "filename": "Q3 plan.sheet", "mimeType": "application/vnd.dhanu.sheet", "sizeBytes": 0, "kind": "sheet", "createdAt": "…" } }
Errors
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
not_found | 404 | No such resource in the key's workspace. |