Hi everyone,
I was processing scanned book pages using the Batch API with gpt-image-2 and /v1/images/edits.
Initially, my Batch workflow was working perfectly. I successfully processed around 150 pages using uploaded image files and file_id.
Then, without making any changes to my script or JSONL structure, the Batch API suddenly started failing every request with:
Unable to authorize file access.
The individual Image Edit API continued to work correctly with the same images and API key, so the problem appeared to be specifically related to Batch API access to the uploaded image files.
I also:
- Created a new API key
- Confirmed the key was assigned to the correct project
- Confirmed the source files existed
- Confirmed the uploaded files had
purpose: user_data
- Tested the same image individually through
/v1/images/edits
- Confirmed that the individual API request worked successfully
However, Batch requests using:
"images": [
{
"file_id": "file-..."
}
]
continued returning:
{
"error": {
"message": "Unable to authorize file access.",
"type": "invalid_request_error"
}
}
Workaround that worked for me
Instead of passing the uploaded image using file_id, I changed the Batch request to use the image data encoded as Base64.
The workflow is now:
PDF page
↓
Render to PNG
↓
Read image bytes
↓
Base64 encode image
↓
Create JSONL Batch request
↓
/v1/images/edits
↓
gpt-image-2
The JSONL request contains the image directly rather than relying on Batch to authorize access to a separate uploaded image file.
For example, the working request structure is essentially:
{
"custom_id": "page-121",
"method": "POST",
"url": "/v1/images/edits",
"body": {
"model": "gpt-image-2",
"images": [
{
"...": "base64 image data"
}
],
"prompt": "...",
"quality": "medium",
"output_format": "jpeg",
"n": 1
}
}
I then submit the JSONL normally through the Batch API.
Result
This workaround is currently working for me.
I tested it with the same type of scanned pages that were previously returning:
Unable to authorize file access
The Batch completed successfully:
status: completed
completed: 1
failed: 0
total: 1
The generated image was successfully downloaded from the Batch output and the image quality was essentially the same as the successful individual Image Edit request.
So, at least for my workflow, the problem appears to be avoided by embedding the image data in the Batch request instead of referencing the uploaded image through file_id.
Has anyone else encountered the same Unable to authorize file access issue with /v1/images/edits in Batch API recently?
I’m particularly interested in knowing whether this is a temporary Batch file-access issue or whether there has been a recent change to how image files are authorized/referenced in Batch requests.
Current workaround: Base64 image data → JSONL → /v1/images/edits → Batch API.
This has allowed me to continue processing my remaining pages while avoiding the file authorization error.