Hi awork team,
I’m building a VS Code extension that talks to custom agents via the public API (OAuth 2.0, PKCE, public client app, scopes full_access offline_access). Creating threads, sending messages, polling status, reading messages, credits, uploading temporary files: all of this works fine.
Problem: I can’t download the agent’s output files.
GET /agents/threads/{threadId}/messages returns the generated files in temporaryFiles like this:
{
"id": "/workspace/output/.gitignore",
"name": ".gitignore",
"mimeType": "application/octet-stream",
"sandboxPath": null,
"downloadUrl": "/agents/threads/{threadId}/artifacts/download?path=%2Fworkspace%2Foutput%2F.gitignore"
}
The id is a sandbox path, not a file ID, so the documented routes /agents/threads/{threadId}/files/{fileId}/download and /temporaryfiles/{fileId}/download can’t be used.
The downloadUrl route fails with the OAuth token, no matter how the path is written (/workspace/output/x, x, output/x):
401 {"code":"unauthorized","description":"No permissions to access this endpoint."}
An API key gives the same result: GET /agents returns 200 with the key, but artifacts/download returns the same 401 („No permissions to access this endpoint.“).
The same route works in the awork web app (200, file content). The browser sends no Authorization header there, only the session cookie. So the endpoint seems to accept only the web session and is blocked for all API clients (OAuth and API key).
Questions
- Is
artifacts/downloadmeant to be used by API clients? If so, which permission or client setting is needed? - If not: is there another supported way for an integration to get the files an agent saved in its output folder (for example a real file ID in
temporaryFiles, or a documented download route)? - Related: the web app lists chats via
GET /agents/threads?filterby=...(own and shared threads). Is this endpoint supported for client apps? The docs only list/agents/management/threads.
I can share thread IDs privately if that helps.
Thanks, Martin.