There is no public endpoint that turns a gen_id into image bytes. Use the recovery path that matches what you still have.
Choose a model, enter your prompt, and see the result.
HiAPI Blog
HiAPI
Generate it with HiAPI
If you are looking for a ChatGPT gen_id download endpoint, the short answer is that no public endpoint turns a gen_id into image bytes. The recovery path depends on what you still have.
| What you still have | Best recovery path | What not to do |
|---|---|---|
| The original conversation is still available | Open the image in ChatGPT, download it, then re-host the file | Do not copy a backend-api URL into your app |
A complete data export with conversations.json and asset files | Match the file-service:// pointer to the exported file | Do not try to fetch the internal URI with curl |
Only a gen_id | Recreate the image from the prompt or conversation context | Do not guess private id-to-file endpoints |
| You need a repeatable automated workflow | Generate through a documented API, download the output, and store your own URL | Do not automate against ChatGPT's browser session |
The distinction matters: gen_id records which generation a conversation is referring to. It is not a storage key, a public URL, or an API parameter that retrieves the original file.
ChatGPT may store several references around one generated image:
gen_id identifies a generation inside the conversation so a later turn can refer back to it.file-service://file-... is an internal asset pointer, not an HTTP address.chatgpt.com/backend-api/... and files.oaiusercontent.com/... are temporary, signed pickup URLs used by the ChatGPT web app.These identifiers solve different internal jobs. None is a permanent public file URL.
That is why common experiments end in two different errors:
HTTP 422
missing query fields such as p or ts
The signed URL was copied without all of its query parameters, or a tool stripped them while pasting.
HTTP 404
ResourceNotFound
The link has expired, the asset is no longer stored, or the request is outside the session that issued it. Reconstructing a plausible URL from gen_id does not restore the signature or the file.
Open the conversation in ChatGPT and use the download control on the image. Save the bytes immediately and upload them to storage you control.
If a copied link still works only in your browser, treat that as a last chance to download, not as a link you can publish. Your browser may still have the relevant session and a fresh signature; a backend worker, another user, or a later visit will not.
After recovery, replace every stored ChatGPT link with your own S3, R2, CDN, or application URL.
A complete export can contain conversations.json plus separate asset files. The JSON may describe an image like this:
{
"content_type": "image_asset_pointer",
"asset_pointer": "file-service://file-A1b2C3d4E5f6",
"metadata": {
"dalle": {"gen_id": "aBcD3fGh1jKl"}
}
}
Search the extracted archive for a filename containing file-A1b2C3d4E5f6. The file id after file-service:// is the useful join key; the gen_id is not.
The detailed matching procedure, including missing-asset cases, is in the conversation-export asset recovery guide.
An export is not guaranteed to resurrect every historical image. If the archive contains the pointer but no matching file, the bytes were not included and the pointer alone cannot recreate them.
There is no conversion step from gen_id to PNG, WebP, or a signed URL. If the original conversation and file are gone, regenerate from the prompt and any saved context.
Keep the failed identifier only as diagnostic metadata. Do not make it the primary key for an image in your own system. A safer record stores:
Use an API designed to return output files. With hiapi's async task API, the stable workflow is create, poll, download, and re-host:
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2/text-to-image",
"input": {
"prompt": "a paper crane on a desk in soft morning light",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'
The create response contains a task id. Poll GET /v1/tasks/{taskId} until the task succeeds, then read data.output[0].url and its expireAt value.
curl -s "https://api.hiapi.ai/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $HIAPI_API_KEY"
curl -s -o generated-image.webp "<data.output[0].url>"
The API output URL is also temporary. Its advantage is that it is an explicit part of the API contract and includes an expiry time. Download before expiry, verify the response, upload the bytes to your own storage, and persist that URL.
For model inputs and current pricing, use the gpt-image-2 model page and live pricing page. The task creation reference documents the request envelope.
For each successful task:
output[0].url is valid.This pattern works whether the source is ChatGPT, hiapi, or another provider with signed output links.
No. ChatGPT does not expose a public endpoint that accepts gen_id and returns the generated image. The identifier only has meaning in the original conversation context.
No. A working ChatGPT asset URL also depends on an internal file reference, session context, and a valid signature. Guessing the path does not produce those values.
The signed link is usually missing required query fields such as its timestamp or signature. Copying only the path, or using a tool that strips the query string, invalidates it.
Signed URLs and underlying assets are temporary. Once the link or file expires, ResourceNotFound is expected and gen_id cannot restore it.
Download the bytes while a valid source link exists, upload them to storage you control, and save your own URL. Permanence comes from your storage policy, not from the provider's pickup URL.