Hello,
I am using the Files API and I keep getting this error when trying to extract text content from an uploaded file: ”Error in getting uploaded files content: Error code: 400 - {‘error’: {‘message’: ‘Not allowed to download files of purpose: user_data’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}”I tested this feature last week and the model was able to properly give a response based on the uploaded file content, so I’m confused as to what has regressed.
SDK: openai==1.101.0 (Python)
Usage:
Uploading via Files API
Getting model responses via Chat/Completions (LangChain ChatOpenAI)
Goal: Let the backend read uploaded file bytes (to extract text) using Files API.
Observed:
Upload works and files appear in dashboard.
files.list(…) works.
files.content(…) returns 400:
For purpose=“user_data”: “Not allowed to download files of purpose: user_data”
For purpose=“assistants”: similar error.
Questions:
Is files.content intentionally disallowed for files with purpose user_data and assistants?
If so, which purposes (if any) allow downloading bytes via files.content?
What’s the recommended pattern to have the model read uploaded files if we’re using Chat/Completions (not Assistants)? Should we extract text server‑side from the upload instead of downloading via OpenAI?
It is assumed that user data could be an end-user’s scoped personal data. You wouldn’t want any API key holder having the ability to list, download, blackmail, laugh, etc. They’d have to ask an AI that consumes the data.
You can consume what the AI has produced for you, although on responses, that is typically code interpreter output that needs to be obtained from a container before it expires.
Here’s a “directionality” table.
purpose
upload
download
assistants
Yes
No
assistants_output
No
Yes
user_data
Yes
No
fine-tune
Yes
No
fine-tune-results
No
Yes
batch
Yes
Yes
batch_output
No
Yes
vision
Yes
Yes
evals
Yes
No
I suppose you could use OpenAI as your image storage instead of just having an AI look at them…
Chat Completions doesn’t have internal tools. You can upload PDFs as user_data or your JPEGs for vision and directly attach them as parts of user messages, though.
I ran into the same thing recently. The files content endpoint no longer lets you download files that were uploaded with purpose= “user_data”. That change seems intentional. Right now the workflow is: if you just want the model to use info from your file in Chat/Completions, you should parse the file on your own server after upload and then send the text as input. Direct download from OpenAI for user_data files isn’t supported anymore.
Okay, is there any documentation on this? It still feels like a bug to me; why have the upload api without the ability to use user uploaded files as part of the input?
here’s the actual doc : https://platform.openai.com/docs/api-reference/files/create#files-create-purpose which states the definition of a purpose and this functionality has regressed since last week. @OpenAI_Support - This is a bug in the file uploads api where files with a purpose of user_data cannot be downloaded to be used as input as part of a call chain. This functionality was working as of last week. This is stalling our feature release for customers.
The native handling of expiration date and size limitations make it easier to use the uploaded files as part of temporary user input, moving that to the client may add security implications to handle.
Logged a feature request here since the regressions have caused delays in feature launches and also confusion as the workaround to use purpose = “assistants“ is misleading.
@OpenAI_Support any updates on file uploads API ? There is no native support for using file uploads with a purpose of “user_data“ within chatCompletions. The alternative solution to use “assistants“ will never work as it needs uptake from an assistantsAPI implementation. This has caused has significant delays in releasing a feature out to the customer and now we have to go with the alternative of doing this with Vercel AI SDK which adds an additional file/blob storage for us to manage for temporary files that should be part of the chat context.