IMAGES
Download Image Content
Fetch an image returned as a URL. Available for 24 hours after generation, and only to the organization that generated it.
Authorization
AuthorizationstringheaderrequiredBearer token — your API key. Example: Bearer sk-...
This is the endpoint the url values in a
generation or
edit response point at. You do not normally
construct the URL yourself — take it from the response.
The URL is authenticated, not public. Fetching it carries the same
credential as every other endpoint on this API, and only the organization that
generated the image can read it. From your own code that means your API key. A
URL pasted into a browser address bar, or dropped into an <img src>, will
not load: neither carries an origin we recognise, so the request is refused
before it reaches the image.
Images live for 24 hours. After that this endpoint returns 404 and the
image is unreachable. There is no delete endpoint — expiry is the only removal
path, and it is why url delivery is not a storage product. Requests made
with the default response_format: "b64_json" store nothing at all and have
no URL to fetch.
image_id is the UUID carried in the url field of the generation or
edit response. Every way of missing — an unknown id, a malformed one, an image
that has expired, and one belonging to another organization — returns the same
404, so a 404 never confirms that an id exists.
HEAD is supported and answers the image's exact byte length; the GET
body is streamed and therefore chunked, so it carries no Content-Length.
Because the body streams, the 200 is committed before the first byte is
read. A storage failure therefore shortens the body rather than changing the
status: you can receive a truncated image, or in principle an empty one, under
a 200. HEAD answers from the recorded length rather than from storage,
so comparing the bytes you received against it catches both — worth doing if a
partial image would be a problem for you.
Range requests are not supported and not advertised — a Range header is
ignored and the whole image comes back with 200, rather than a 416.
Downloading is free and unmetered. This endpoint is authenticated but not rate-limited, not credit-gated and not billed: you were charged for the image when it was generated, so fetching it — or retrying a failed fetch — costs nothing and consumes none of your request quota. An organization with a zero credit balance can still download images it has already paid for.
Request
const res = await fetch(
"https://api.scx.ai/v1/images/8f14e45f-ea6e-4d1f-9b6b-3c2a1d7e4b90/content",
{ headers: { Authorization: "Bearer your-scx-api-key" } },
);
await Bun.write("kite.jpg", await res.arrayBuffer());const res = await fetch(
"https://api.scx.ai/v1/images/8f14e45f-ea6e-4d1f-9b6b-3c2a1d7e4b90/content",
{ headers: { Authorization: "Bearer your-scx-api-key" } },
);
await Bun.write("kite.jpg", await res.arrayBuffer());Response
HTTP/1.1 200 OK
Content-Type: image/png
Transfer-Encoding: chunked
<the image bytes>HTTP/1.1 200 OK
Content-Type: image/png
Transfer-Encoding: chunked
<the image bytes>