How can I download files referenced as sandbox://file.pdf from an Assistant response when using the Threads API?

Hi everyone :waving_hand:,

I’m currently using the OpenAI Assistants API and invoking prompts through the Threads API.
Sometimes, the Assistant’s response includes links like this:

sandbox://file.pdf
sandbox://output.csv

From what I understand, these are files generated during the Assistant’s processing (inside the OpenAI sandbox environment).
However, I can’t find any clear documentation or examples on how to actually download or access these sandbox files.

Here’s my current setup:

  • I’m using the Assistants + Threads API flow

  • I send a prompt → the model processes it → and in the response text I get one or more sandbox://... file links

  • Now I’d like to programmatically retrieve these files (for example, download sandbox://file.pdf and process it further in my system)

So my questions are:

  1. How can I download or access files referenced with sandbox://file.pdf links that appear in an Assistant response?

  2. Is there an API endpoint (or SDK helper) to fetch these files from the sandbox environment?

  3. Are these files temporary, and how long do they remain accessible?

  4. If they’re not directly downloadable, what’s the recommended best practice to retrieve their contents?

Example of what I get from the API:

{
“id”: “msg_123”,
“type”: “message”,
“role”: “assistant”,
“content”: [
{
“type”: “text”,
“text”: “Here is your report: sandbox://file.pdf”
}
]
}

Any official guidance, sample code, or clarification from the OpenAI team would be greatly appreciated :folded_hands:
Thanks in advance!

Gianluca

The AI is writing the path incorrectly in what you show.

When written as sandbox://mnt/data/filename.ext, they will be caught by the Assistants API backend and replaced with real download links.

OpenAI hasn’t trained models enough to emit this, and it is not instructed in the tool, so you’ll have to write it out as an additional instruction of how to supply files to the user for reliability, along with clarifying that users can’t see sandbox code or get the files themselves.

1 Like

sandbox:/mnt/data/Matritsa_Rangi_Teskari_Matritsa_Referat_FULL.pdf