Turn a Base64 image source into a direct URL
To turn a Base64 image source into a URL, decode the string into image bytes, upload those bytes as multipart field `file`, then map the returned `url` into the next AI, OCR, CMS, or publishing API.
- Reviewed by
- GetFileURL technical team
- Updated
- Input
- Base64 image source
- Action
- Decode to image bytes, then POST multipart file
- Output
- Direct image URL
- Source
- Base64 string or data URI from webhook, AI, or app JSON
- Conversion
- Decode to bytes and preserve filename plus content_type
- Upload
- POST /v1/files multipart field file
What this page answers
It turns a file already inside a workflow into a direct public URL that another API can fetch.
- Reviewed by
- GetFileURL technical team
- Last updated
Make the file handoff visible.
A useful Base64 image recipe shows the encoded source, decode step, multipart upload request, returned image URL, and cleanup handle.
Capture the file
Start from the Base64 string or data URI your source provides, such as an AI image response, webhook JSON field, canvas export, or low-code app output.
Upload and parse JSON
Decode the Base64 content into image bytes, set a real filename and content type, then upload those bytes to `POST /v1/files` as multipart field `file`.
Send onward
Pass `url` to the next image, vision, OCR, CMS, or publishing API, then keep `file_id`, `content_type`, and `expires_at` for cleanup.
Validate the URL before the destination retries.
Most Base64 image URL issues come from one of four places: malformed encoding, data URI prefixes, missing filename or content type, or payloads too large for the source platform.
Direct response
The URL should return file bytes, not an app preview, permission page, or redirect loop.
Useful headers
Content type, size, and disposition should match what the destination expects.
Enough retention
Expiry should account for queue delays, async processing, and retry branches.
Treat Base64 as the source format, not the final upload transport.
The public upload endpoint expects a multipart file field. If your source gives Base64, decode it before calling GetFileURL so the hosted URL is based on real image bytes.
Strip wrappers
Handle prefixes such as `data:image/png;base64,` before decoding.
Keep metadata
Carry a filename and MIME type such as `image/png` into the decoded file object.
Upload bytes
Send the decoded image as multipart field `file` to `POST /v1/files`.
Prove the decoded upload serves image bytes.
After upload, the returned URL should behave like a normal public image URL for AI, OCR, CMS, and publishing tools.
Check headers
Run `curl -I <returned-url>` and confirm `200 OK` with `Content-Type: image/png`, `image/jpeg`, or `image/webp`.
Map the URL
Use only the returned `url` where the next API asks for an image URL.
Clean up
Keep `file_id`, `expires_at`, and `delete_url` beside the image job so public access has an end state.
Copy the same upload shape into code
Base64 image source
-> strip data:image/png;base64, prefix if present
-> decode into image bytes
-> POST /v1/files as multipart field file
-> map response.url to the next APICommon questions
What does this recipe solve?
It turns a file already inside a workflow into a direct public URL that another API can fetch.
Should the URL be permanent?
Not by default. Use the shortest retention window that gives the destination enough time to fetch the file.
What should I log?
Log the returned URL, file ID, content type, size, expiry, and destination response status.