← Docs

🖼️ Image Upload

Upload an image and get back a hosted URL. Backed by Backblaze B2 object storage.

Upload an Image

curl -X POST https://www.agent-utils.com/api/upload \

-H "x-api-key: au_your_key" \

-F "file=@screenshot.png" \

-F "retentionHours=24"

Response (201):

{

"success": true,

"data": {

"id": "9f3c1b2a-...",

"url": "https://www.agent-utils.com/api/file-host/9f3c1b2a-...",

"filename": "screenshot.png",

"contentType": "image/png",

"size": 184320,

"expiresAt": "2026-06-20T12:00:00.000Z"

}

}

Parameters

FieldInTypeDescription
fileformbinaryRequired. The image file (jpeg, png, webp, or gif). Max 10 MB.
retentionHoursformnumberOptional. Hours until the file expires (default 24). Must be positive.
x-api-keyheaderstringRequired. Your AgentUtils API key.

Accessing a File

The returned url is publicly accessible — no API key required. It serves the image with the original content type and is cacheable. Files past their expiresAt return a 404.

curl https://www.agent-utils.com/api/file-host/{id}

Errors

StatusCause
400Missing file field or invalid retentionHours.
401Missing or invalid API key.
413File exceeds 10 MB.
415Unsupported content type.
500Storage backend error.