API reference
Complete reference for the img.pro REST API. All requests go to https://test.api.img.pro/v1. Create, get, and update return the Image object; list and batch-update endpoints wrap Image objects in stable envelopes, while batch delete wraps deletion tombstones.
On this page
Authenticate with Authorization: Bearer YOUR_API_KEY. An App-wide key uses its App storage by default; add X-Img-User to select a connected user’s storage. A key whose reach is App storage only always uses its own storage. Authentication covers reach, permissions, and selector errors.
Changed September 29, 2026 (spec 4.6.0). GET /v1/billing/status no longer answers with an img.pro plan and usage, with or without X-Img-User (your App storage’s, or that user’s). It reads one user’s subscription to the plans your App sells, with an App-wide key and X-Img-User or with that user’s own key, and its billing_url opens that user’s billing card. With a user, its body is new: plan, usage, limits_enforced and available_plans are gone; read access and subscription. Called without a user, it answers 403 forbidden with a message that says so. Your App’s img.pro plan and usage are at GET /v1/usage (plan and limits), and you manage the plan on Billing in the console. New: GET /v1/billing/plans lists the plans your App sells, each with its prices on sale, in the Display order you set in Pricing (display_order).
Changed September 29, 2026 (spec 4.4.0). Every image loads from its url for anyone holding the link, and the viewer page is retired. Responses no longer include public or page_url. Requests that still send public were accepted and ignored until November 1, 2026; from that date they get 422 validation_error naming the field, so remove it from the request. A page_url you saved no longer opens the image, so show or share url instead. GET /v1/images/{id} now needs a key with read access to the image’s App, like every other endpoint; without one it answers 401 unauthorized.
POST /v1/images
Create an image from a file (multipart/form-data) or a URL (application/json): one endpoint, two sources, chosen by Content-Type. Returns the Image object; url in the response is the live CDN link. A file that is too large or can’t be decoded returns 422 validation_error under details.file; a failure on img.pro’s side while processing it returns a retryable 500 upload_failed or import_failed. Neither failure stores anything. On multipart, send each field once: a field or file part sent twice returns 422.
- file File required
- An upload is a JPEG, PNG, GIF, WebP, AVIF or HEIC file of at most 20 MB (20,000,000 bytes), and it must decode before anything is stored. A HEIC must be HEVC-based, and
.heifis accepted only as a filename or MIME alias for one. SVG, BMP and ICO are not accepted. The stored filename comes from the multipart file part. - ttl string|integer|null
- Time-to-live, after which the image is deleted: seconds (e.g.
3600) or a duration (5m–90d, e.g.24hor7d). Omit it for no expiry, or sendnever, an empty multipart field, or JSONnull. - caption string
- Free-text caption / description for the image, up to 5,000 characters. A longer value, or one that is not text, returns
422. - published_at string
- Publish date: a unix timestamp (seconds) or ISO-8601 date like
2024-06-01. Backdate it to sort the image under the photo’s date (a 2024 photo uploaded in 2026 sorts under 2024). Omit it, or send it empty ornull, to default to the upload time; any other value that does not read as a date (a millisecond timestamp included) returns422. - metadata object
- Your attribution fields (
author,license, …) as a nested string→string map, identical to the response: the only channel for custom fields. On multipart, JSON-encode it into a singlemetadataform field ({"author":"Jane Doe","license":"cc-by-4.0"}). See Custom fields.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X POST "https://test.api.img.pro/v1/images" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@photo.jpg" \
-F "caption=Hero shot from launch day"
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"id": "abc12345",
"object": "image",
"url": "https://test.src.img.pro/4j2/abc12345.jpg",
"sizes": {
"small": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=s",
"width": 426,
"height": 320
},
"medium": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=m",
"width": 853,
"height": 640
},
"large": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=l",
"width": 1440,
"height": 1080
}
},
"filename": "hero-shot.jpg",
"format": "jpg",
"width": 4000,
"height": 3000,
"bytes": 245678,
"status": "ready",
"published_at": "2024-01-01T00:00:00Z",
"expires_at": null,
"created_at": "2024-01-01T00:00:00Z",
"caption": "Hero shot from launch day",
"metadata": {},
"labels": {},
"nsfw": false
}
Uploads return status: "ready" or fail in the same request. Once the App holds its plan’s images limit (5,000 on Free, 50,000 on Pro) a create (a file or a URL import) returns 403 quota_exceeded and stores nothing; see Usage and limits.
Import from a URL
Send Content-Type: application/json with a url instead of a multipart file, and img.pro fetches the image server-side: it must be publicly accessible, redirects are followed, and the fetch times out after 30 seconds. Every other field works as a JSON key, with custom fields in a nested metadata object (see Custom fields). The filename comes from the URL’s path, metadata.source_url is set to the imported URL, and the response is a file upload’s.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X POST "https://test.api.img.pro/v1/images" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/image.jpg",
"caption": "Imported from example.com"
}'
Idempotent retries
To make a create safe to retry, send an Idempotency-Key header with a unique value of your choosing.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X POST "https://test.api.img.pro/v1/images" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: order-58213-hero" \
-F "file=@photo.jpg"
A retry with the same key and body returns or recovers the original response (a replay from cache carries Idempotent-Replayed: true) instead of creating a duplicate. The same key with a different body returns 409 idempotency_key_conflict, and a retry while the original is still processing returns 409 idempotency_key_in_progress. While img.pro can’t yet confirm whether a create was saved, 503 create_outcome_ambiguous asks you to retry that identical request, which never makes a duplicate. Honor Retry-After for both wait outcomes. A key whose earlier create can no longer be replayed returns 409 idempotency_recovery_conflict: stop retrying and use a new key. metadata is part of the hashed body, so a changed custom field is a different body: metadata is attribution, not a dedup key, and there is no external_id upsert.
Use a fresh globally unique key for each logical create. Idempotency state is kept for 24 hours; retry only the identical request during that window. After 24 hours, replay and duplicate prevention are not guaranteed, so do not retry the old operation or repurpose its key. A completed URL import replays without another fetch during that window; if retained cache state is unavailable, a URL import may need its source URL to remain fetchable.
GET /v1/images/{id}
Get a single image from the storage your key reaches: an App-wide key reads its App storage, or a connected user’s storage with X-Img-User. A key is required; the image itself loads from its url without one. An id outside that storage, another App’s included, returns 404 exactly as an id that doesn’t exist.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY"
Returns the Image object. A blocked image returns 403 media_blocked with the coarse reason; see Lifecycle.
PATCH /v1/images/{id}
Update an image’s editable fields: caption, ttl and published_at, your attribution metadata and your selector labels. An omitted field is left unchanged. metadata and labels are the nested objects the response returns, so you can GET an image, edit either map and PATCH it straight back. Use if_labels when the update is a state transition: every supplied label must still match when the update commits, or nothing changes and the API returns 409 state_conflict; reload the image before deciding whether to retry. Top-level nsfw, tool, defaults and filename, like any other unrecognized top-level field, return 422 (see Field-name safety).
- caption string
- Free-text caption / description, up to 5,000 characters. Send
""ornullto clear it; a longer value returns422. - ttl string
- New TTL (e.g.
7d), ornullto make the image permanent. - published_at string
- Publish date: a unix timestamp or ISO-8601 date like
2024-06-01. Backdate it to re-sort the image.nullreturns422: every image keeps a publish date. - metadata object
- Your attribution fields as a nested string→string map, the same shape as the response, merged with the existing metadata; a
nullvalue removes a key. See Custom fields. - labels object
- Your selector labels as a nested string→string map, the same shape as the response, merged with the existing labels; a
nullvalue removes a key. See Labels. - if_labels object
- Optional atomic precondition: every supplied label must still equal its string value when the update commits, or the image is left unchanged and reported as
state_conflict. Uses the same bounds aslabels; null and empty values are rejected.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X PATCH "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"labels": {"state": "liked"}, "if_labels": {"state": "pending"}}'
Returns the updated Image object. A moderation-locked image returns 403 media_locked.
DELETE /v1/images/{id}
Delete an image: it leaves the API, and the CDN stops serving its url and every variant. A delete is final: the API cannot restore the image, and it stops counting toward limits.images.used at once. What happens to the stored file afterwards is in the Privacy Policy’s retention section. Returns a tombstone confirming the deletion: the id and object, plus deleted: true. Deleting an already-deleted image returns 404.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X DELETE "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY"
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"id": "abc12345",
"object": "image",
"deleted": true
}
GET /v1/images
List images with cursor-based pagination (cursor only, no offset), ordered by published_at newest-first. Backdate an image to sort it under the photo’s date, or re-stamp published_at via PATCH to move it to the head of the list. Lists carry only servable status: ready images: blocked images are left out (see Lifecycle).
- ids string
- Comma-separated IDs to fetch specific items. Cannot be combined with
label[…]filters. - label[key] string
- Filter by labels:
?label[state]=pending. A comma-separated value isIN(?label[state]=pending,likedmatches either), distinct keysANDtogether, and?label[!state]matches images with nostatelabel (it takes no value). - limit integer default 50
- Images per page,
1–100. - cursor string
- Opaque pagination cursor: the previous page’s
next_cursor.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl "https://test.api.img.pro/v1/images?limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
# filtered by label (see Labels below)
curl "https://test.api.img.pro/v1/images?label%5Bstate%5D=pending&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"object": "list",
"data": [
{
"id": "abc12345",
"object": "image",
"url": "https://test.src.img.pro/4j2/abc12345.jpg",
"sizes": {
"small": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=s",
"width": 426,
"height": 320
},
"medium": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=m",
"width": 853,
"height": 640
},
"large": {
"url": "https://test.src.img.pro/4j2/abc12345.jpg?size=l",
"width": 1440,
"height": 1080
}
},
"filename": "hero-shot.jpg",
"format": "jpg",
"width": 4000,
"height": 3000,
"bytes": 245678,
"status": "ready",
"published_at": "2024-01-01T00:00:00Z",
"expires_at": null,
"created_at": "2024-01-01T00:00:00Z",
"caption": "Hero shot from launch day",
"metadata": {},
"labels": {},
"nsfw": false
}
],
"pagination": {
"has_more": true,
"next_cursor": "eyJ2IjoxLCJzdG9yYWdlIjoiazNkOXgybXciLCJwdWJsaXNoZWRfYXQiOjE3MDQwNjcyMDAsImlkIjo0Mn0",
"next_url": "https://test.api.img.pro/v1/images?cursor=eyJ2IjoxLCJzdG9yYWdlIjoiazNkOXgybXciLCJwdWJsaXNoZWRfYXQiOjE3MDQwNjcyMDAsImlkIjo0Mn0&limit=20"
}
}
The pagination object holds has_more, the opaque next_cursor, and a ready-to-call next_url for the next page: follow next_url, or pass next_cursor as cursor. On the final page all three are terminal: has_more: false, next_cursor: null, next_url: null.
PATCH /v1/images/batch
Update editable fields on up to 100 images at once (more than 100 ids returns 422 validation_error), with the same field restrictions and ready-only lifecycle gate as the single-image PATCH. caption, ttl and published_at apply uniformly to every id in the batch, and metadata and labels merge into each image. Optional if_labels applies the same atomic precondition to every image; lifecycle and precondition failures appear as per-item errors while eligible images still update.
- ids string[] required
- The images’ ids, at most 100.
- caption string
- Free-text caption / description, up to 5,000 characters. Send
""ornullto clear it; a longer value returns422. - ttl string
- New TTL (e.g.
7d), ornullto make the image permanent. - published_at string
- Publish date: a unix timestamp or ISO-8601 date like
2024-06-01. Backdate it to re-sort the image.nullreturns422: every image keeps a publish date. - metadata object
- Your attribution fields as a nested string→string map, the same shape as the response, merged with the existing metadata; a
nullvalue removes a key. See Custom fields. - labels object
- Your selector labels as a nested string→string map, the same shape as the response, merged with the existing labels; a
nullvalue removes a key. See Labels. - if_labels object
- Optional atomic precondition: every supplied label must still equal its string value when the update commits, or the image is left unchanged and reported as
state_conflict. Uses the same bounds aslabels; null and empty values are rejected.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X PATCH "https://test.api.img.pro/v1/images/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["abc12345", "def45678"], "ttl": "7d"}'
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"object": "batch_result",
"data": [
{ "id": "abc12345", "object": "image", "url": "https://test.src.img.pro/4j2/abc12345.jpg", "expires_at": "2024-01-08T00:00:00Z" },
{ "id": "def45678", "object": "image", "url": "https://test.src.img.pro/4j2/def45678.jpg", "expires_at": "2024-01-08T00:00:00Z" }
],
"errors": []
}
Every batch response is one batch_result envelope: 200 when every item succeeds, 207 when some were skipped (a moderation-locked image, for example). For an update, data holds one complete Image object per updated item, and errors one entry per skipped item, its id and the nested error object every other error uses (a coarse type, a specific code and a human-readable message); errors is empty when every item succeeds.
The examples abbreviate each Image object. With a moderation-locked image in the batch:
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"object": "batch_result",
"data": [
{ "id": "abc12345", "object": "image", "url": "https://test.src.img.pro/4j2/abc12345.jpg", "expires_at": "2024-01-08T00:00:00Z" }
],
"errors": [
{ "id": "def45678", "error": { "type": "permission_error", "code": "media_locked", "message": "Media cannot be modified" } }
]
}
DELETE /v1/images/batch
Delete up to 100 images by id (more than 100 ids returns 422 validation_error). The body takes ids and nothing else: any other field returns 422 validation_error and deletes nothing. A delete is final: the API cannot restore the image, and it stops counting toward limits.images.used at once.
- ids string[] required
- The images’ ids, at most 100.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X DELETE "https://test.api.img.pro/v1/images/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["abc12345", "def45678"]}'
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"object": "batch_result",
"data": [
{ "id": "abc12345", "object": "image", "deleted": true },
{ "id": "def45678", "object": "image", "deleted": true }
],
"errors": []
}
In the same envelope, a delete’s data holds a tombstone per requested id. Batch deletion is idempotent: every id reports deleted: true, whether it was removed now or was already gone, unlike a single DELETE /v1/images/{id}, which returns 404 for an image already gone.
GET /v1/usage
The selected storage’s usage (monthly, totals), and the App’s plan with its limits (plan, limits_enforced, limits). limits counts the whole App, its storage and every connected user’s, whichever storage the key selects. On Free and Pro (limits_enforced: true) a create is refused with 403 quota_exceeded once limits.images.used reaches limits.images.limit (5,000 on Free, 50,000 on Pro), and a new user’s first sign-in once limits.users.used reaches limits.users.limit (50 on Free, 500 on Pro). On Unlimited both limit values are null. plan is free, pro or unlimited; treat a value you don’t know as a safe default and read limits. used is null for a key a connected user issued for their own storage. monthly.uploads_limit and totals.storage_limit_bytes, with their remaining counts, are informational: they never refuse an upload, so don’t use them to block one.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl "https://test.api.img.pro/v1/usage" \
-H "Authorization: Bearer YOUR_API_KEY"
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"object": "usage",
"monthly": {
"uploads": 42,
"uploads_limit": 1000,
"uploads_remaining": 958,
"resets_at": "2024-03-01T00:00:00Z"
},
"totals": {
"images_stored": 142,
"storage_used_bytes": 52428800,
"storage_limit_bytes": 10737418240,
"storage_remaining_bytes": 10684989440
},
"plan": "free",
"limits_enforced": true,
"limits": {
"images": { "used": 3210, "limit": 5000 },
"users": { "used": 12, "limit": 50 }
}
}
Response headers
Authenticated responses include the selected storage’s usage in headers. Their monthly upload and storage limit values are informational and never refuse anything, so don’t use them to block an upload: the App’s plan limits are limits on GET /v1/usage.
- X-Limits-Enforced
- Whether the App’s plan limits apply:
trueon Free (5,000 images and 50 users per App) and Pro (50,000 images and 500 users per App),falseon Unlimited. Sent on creates and onGET /v1/usage, the responses that read the App’s plan. - X-Monthly-Uploads-Used
- Uploads used this calendar month (UTC).
- X-Monthly-Uploads-Limit
- Monthly upload limit (informational; it never refuses an upload).
- X-Monthly-Uploads-Remaining
- Uploads left against that limit (informational).
- X-Storage-Used
- Storage used, in bytes.
- X-Storage-Limit
- Storage limit in bytes (informational; it never refuses an upload).
- X-Storage-Remaining
- Bytes left against that limit (informational).
Depending on the endpoint and the request, you may also see these headers:
- Retry-After
- Back-off seconds on
app_context_unavailable,idempotency_key_in_progress,create_outcome_ambiguous, the503 server_errorofGET /v1/billing/statuswhile a renewal is confirmed, and the503 server_errorof a write during scheduled maintenance. - Idempotent-Replayed
truewhen a create was replayed from an earlierIdempotency-Key.- X-Processing-Time
- Server processing time in milliseconds, set on every create response.
All headers above are exposed for cross-origin reads.
Custom fields
Your own fields live in the nested metadata object: the single channel for custom data, on input and output alike. The request shape mirrors the response, so the round-trip is symmetric: GET an image, edit metadata, and send it straight back. A custom field sent at the top level is rejected with 422, never silently stored. Custom fields are stored with the image record and never written into the file.
Set fields
On a JSON request (URL import or PATCH), send a nested metadata object:
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X POST "https://test.api.img.pro/v1/images" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.jpg",
"caption": "Sunset over the Pacific",
"metadata": { "author": "Jane Doe", "license": "cc-by-4.0" }
}'
On a multipart upload a form field can’t hold a nested object, so JSON-encode your fields into a single metadata form field. Custom fields sent as bare top-level form fields are rejected with 422:
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X POST "https://test.api.img.pro/v1/images" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@photo.jpg" \
-F "caption=Sunset over the Pacific" \
-F 'metadata={"author":"Jane Doe","license":"cc-by-4.0"}'
Read fields
Custom fields come back nested under metadata. What you send is what you get back:
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">{
"id": "abc12345",
"object": "image",
"url": "https://test.src.img.pro/4j2/abc12345.jpg",
"format": "jpg",
"status": "ready",
"caption": "Sunset over the Pacific",
"created_at": "2024-01-01T00:00:00Z",
"metadata": {
"author": "Jane Doe",
"license": "cc-by-4.0"
}
}
Update fields
PATCH the nested metadata object; it merges with the existing map. Set a key to null to remove it (keys you don’t mention are left unchanged):
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X PATCH "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata": {"alt_text": "A vivid sunset", "camera": null}}'
Field-name safety
The Image object’s own field names round-trip into a create: GET a response, tweak it and POST it back, and those keys (id, url, format, status, …) are accepted and ignored rather than rejected. A PATCH ignores them too, except filename and nsfw, read-only fields it refuses with 422 as it refuses top-level tool and defaults: strip them before you send a whole object back. Any other unrecognized top-level field is rejected with 422. Custom fields, your own tool attribution included, belong in the nested metadata object.
One caveat on that round-trip: caption and published_at are Image field names that are also editable, so replaying a GET body into a POST or PATCH writes them rather than ignoring them. That symmetry is deliberate: a copied response carries the source image’s caption and date.
metadata is a flat string→string map with limits: ≤ 50 keys, each key ≤ 64 chars and value ≤ 1024 chars. Exceeding any returns 422 validation_error with the offending field in details.
Labels
metadata describes an image; labels select images. When your App needs to fetch images by machine state (a review queue, a kind, a workflow step), write a label and filter the list on it, instead of listing everything and filtering client-side.
Write labels
Labels are written exactly like metadata: a nested object on upload or PATCH, with merge semantics: keys you don’t send are preserved, and a null value clears one key. On multipart, JSON-encode them into a single labels form field.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)">curl -X PATCH "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"labels": {"state": "liked"}}' # merges; other labels untouched
# clear one key
curl -X PATCH "https://test.api.img.pro/v1/images/abc12345" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"labels": {"state": null}}'
Filter a list
Add label[key]=value params to GET /v1/images. A comma-separated value matches any of the alternatives (IN); distinct keys must all match (AND).
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)"># state == pending
curl "https://test.api.img.pro/v1/images?label%5Bstate%5D=pending" \
-H "Authorization: Bearer YOUR_API_KEY"
# state IN (pending, liked): CSV is OR
curl "https://test.api.img.pro/v1/images?label%5Bstate%5D=pending,liked" \
-H "Authorization: Bearer YOUR_API_KEY"
# state == pending AND kind == generated: distinct keys AND
curl "https://test.api.img.pro/v1/images?label%5Bstate%5D=pending&label%5Bkind%5D=generated" \
-H "Authorization: Bearer YOUR_API_KEY"
Find images without a label
Prefix the key with ! to match images that have no such label: the Kubernetes !key (does-not-exist) selector. It takes no value. This is the only way to reach images created outside your App (an img.pro web or plain-API upload your App never labeled): a value filter can’t, because an absent key never matches a value. It composes with value filters, so “uploads I haven’t triaged yet” is one call.
$el.scrollLeft + $el.clientWidth)" @resize.window="$el.toggleAttribute('data-overflow', $el.scrollWidth - 1 > $el.scrollLeft + $el.clientWidth)"># images with no "state" label at all
curl "https://test.api.img.pro/v1/images?label%5B%21state%5D" \
-H "Authorization: Bearer YOUR_API_KEY"
# kind == upload AND no "state" label: the "unlabeled inbox"
curl "https://test.api.img.pro/v1/images?label%5Bkind%5D=upload&label%5B%21state%5D" \
-H "Authorization: Bearer YOUR_API_KEY"
Value filters are equality + IN. Filtering a value on a key you never set returns an empty page, not an error. A filter can carry at most 50 value alternatives across all keys and 20 keys total (label[!key] counts as a key, carries no value), and cannot be combined with ids. Keep the same filter across every page of one walk: the cursor is a position in that filtered ordering, and next_url carries your filter forward automatically.
Bounds
labels is deliberately tighter than metadata. The bound is what makes it safe to promise a filter contract on: at most 20 labels per image, keys matching ^[a-z0-9_.-]{1,64}$, values ≤ 128 chars with no commas (the filter’s IN separator) and no leading/trailing whitespace (the filter trims values). Violations return 422 validation_error naming the offending key. Keep rich, human-facing data in metadata; keep short machine selectors in labels.
Errors
Every error, top-level and per batch item, is one nested error object. Branch on error.type (a coarse category) or switch on error.code (specific). It carries a human-readable error.message and, on some errors, error.action (what to do next) and error.details (per-field messages), both inside the error object. Success responses never carry an error or an action. See the Error reference for full details.
- unauthorized 401
- Missing or invalid API key.
- forbidden 403
- Key lacks the required ability (read / write), or
GET /v1/billing/statusread without a user; the message says what to send. - media_locked 403
- Image is moderation-locked and can’t be modified.
- media_blocked 403
- Image is blocked and can’t be retrieved.
- app_blocked 403
- The App is blocked: every write from one of its App-storage keys is refused until the block is lifted, and those keys keep reading. App-wide keys get
app_suspendedinstead, and a connected user’s own key keeps working as it does while the App is paused. Write to support@img.pro. - quota_exceeded 403
- The App holds its plan’s images limit (5,000 on Free, 50,000 on Pro): the create stores nothing. It takes new images again once it holds fewer or is on a higher plan; its owner upgrades it in Billing.
- not_found 404
- No image with this id in the storage your key reaches.
- workspace_unavailable 409
- The storage this request writes to (an App’s, or a connected user’s) is being deleted, so it takes no new images. Don’t retry into it.
- state_conflict 409
- An
if_labelsprecondition no longer matches; reload before deciding whether to retry. - idempotency_key_conflict 409
- Idempotency-Key reused with a different body.
- idempotency_key_in_progress 409
- Same Idempotency-Key still processing; wait for Retry-After.
- idempotency_recovery_conflict 409
- This Idempotency-Key belongs to an earlier upload that can no longer be replayed. Stop retrying, and use a new key for new work.
- validation_error 422
- Invalid parameters (per-field errors in
details). - rate_limited 429
- Reserved: the API does not send it today. If you see it, back off and honor
Retry-After. - server_error 500 / 503
- Something unexpected failed on img.pro’s side; retry in a moment. On
GET /v1/billing/status, a 503 with awaitaction means img.pro is still confirming this user’s renewal: keep the access you last read for the user and retry afterRetry-After, so a moment of doubt never reads as no access. On a write, it means scheduled maintenance: retry afterRetry-After. - upload_failed 500
- Server error during upload.
- import_failed 500
- Server error during import.
- update_failed 500
- Server error during an update.
- delete_failed 500
- Server error during a deletion.
- fetch_failed 502 / 504
- The import could not fetch its upstream or exceeded the 30-second deadline. Disallowed URL redirects return
422 validation_errorunderdetails.url. - create_outcome_ambiguous 503
- img.pro can’t confirm yet whether this upload was saved. Retry the identical request after Retry-After; it never makes a duplicate.