API reference
Generations
The AI Generator, for keys made with spending allowed: estimate, start (Idempotency-Key and max_usd), poll, cancel, the files by 10-minute links, the free side actions and uploads.
https://imgsearch.com/llms.txt
On this page
- What a generation would cost, and whether this key could start it now
- Your generations, newest first
- Start a generation (spends AI balance)
- Upload a picture to use as a reference
- One generation
- Delete a finished generation and its files
- Rename, star, or change a meme's captions
- Cancel a generation that has not started
- An output's file, to the bearer
- Upscale one of a generation's pictures 2× (spends AI balance)
- A 3D model in another format (free)
- One export's state and links
- View a 3D model in AR (free)
- Put one of your tracks (and a voiceover) on a clip (free)
- Lay a finished voiceover on one of your clips (free)
- Fetch one of your generation files by its signed link
- Upload a reference picture to a signed upload link
/generations/estimate
What a generation would cost, and whether this key could start it now #
generations.estimate-
search
The same body as POST /generations without max_usd. Writes nothing and charges nothing. can_generate is false with a reason when the account, the model, the site or this key's spending allowance stands in the way. price_usd equals what create charges, except a clip with aspect_ratio auto from a reference.url: its file's size is unknown here, so it is priced at the widest shape and the charge can be lower.
Request body
application/json, GenerationEstimateRequest
| Field | Type | Description |
|---|---|---|
kindrequired |
string |
One of:
image, video, audio, meme, music, sound, 3d, vector
|
model |
string or null | A model id from /models; the kind's default when left out. |
prompt |
string or null | |
options |
object or null | The model's options, as /models/{id} lists them. |
reference |
GenerationReference | At most one picture to start from. |
Responses
- 200 The price in US dollars. (GenerationEstimateResponse)
- Error Error envelope (error codes)
Examples
# What this generation would cost, and whether this key could start it now. Charges nothing.
# Needs IMGSEARCH_API_KEY.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/estimate" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"model": "openai/gpt-image-2.5-sunburst",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"options": {
"aspect_ratio": "16:9"
}
}'
# What this generation would cost, and whether this key could start it now. Charges nothing.
# Needs IMGSEARCH_API_KEY.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(
f"{base}/generations/estimate",
headers=headers,
json={
"kind": "image",
"model": "openai/gpt-image-2.5-sunburst",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"options": {"aspect_ratio": "16:9"},
},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// What this generation would cost, and whether this key could start it now. Charges nothing.
// Needs IMGSEARCH_API_KEY.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/estimate`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
kind: "image",
model: "openai/gpt-image-2.5-sunburst",
prompt: "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
options: { aspect_ratio: "16:9" },
}),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation_estimate",
"kind": "image",
"model": {
"id": "local/echo",
"name": "Local echo (test)"
},
"options": {
"aspect_ratio": "16:9",
"count": 1,
"style": "none"
},
"price_usd": 0.01,
"per_output_usd": 0.01,
"outputs": 1,
"typical_seconds": 3,
"can_generate": true,
"reason": null
}
Try it
The try-it panel needs JavaScript.
/generations
Your generations, newest first #
generations.index-
generations:read
Filters by kind, status, starred, model and words of the prompt or name (q; with the personal index on, close matches join). With ids (up to 20, comma separated) it answers those generations in that order instead, the cheap way to poll several at once; ids that are not yours are left out.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
ids |
query | string | |
kind |
query | string |
One of: image, video, audio, meme, music, sound, 3d, vector
|
status |
query | GenerationStatus |
One of: queued, running, succeeded, failed, canceled
|
starred |
query | boolean | true (or 1) lists the starred generations, false (or 0) the others. |
model |
query | string | |
q |
query | string | |
limit |
query | integer | Items per page. |
cursor |
query | string | The next_cursor of the previous page, as it came. It works only for the same list, filter and account. |
Responses
- 200 One page of generations. (List)
- Error Error envelope (error codes)
Examples
# Your generations by id (up to 20, comma separated): the cheap way to poll several.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations?ids=$GENERATION_ID" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# Your generations by id (up to 20, comma separated): the cheap way to poll several.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.get(f"{base}/generations", headers=headers, params={"ids": os.environ["GENERATION_ID"]}, timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Your generations by id (up to 20, comma separated): the cheap way to poll several.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations?ids=${process.env.GENERATION_ID}`, {
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "list",
"data": [
{
"object": "generation",
"id": "01m8bky93c0jbbax10h5qnjj0m",
"kind": "image",
"model": "local/echo",
"model_name": "Local echo (test)",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"title": null,
"starred": false,
"options": {
"count": 1,
"style": "none",
"aspect_ratio": "16:9"
},
"status": "succeeded",
"created_at": "2026-11-26T09:45:43Z",
"started_at": "2026-11-26T09:45:43Z",
"finished_at": "2026-11-26T09:45:44Z",
"estimate_seconds": 3,
"poll_after_seconds": null,
"waiting": null,
"error": null,
"notice": null,
"quoted_usd": 0.01,
"charged_usd": 0.01,
"refunded_usd": 0,
"reference": null,
"outputs": [
{
"n": 0,
"mime": "image/png",
"width": 1344,
"height": 768,
"duration": null,
"bytes": 6627,
"triangles": null,
"lyrics": null,
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"expires_at": "2026-11-26T09:55:44Z",
"upscale": {
"width": 2688,
"height": 1536,
"price_usd": 0.006
},
"upscaled": null
}
],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
],
"has_more": false,
"next_cursor": null
}
Try it
The try-it panel needs JavaScript.
/generations
Start a generation (spends AI balance) #
generations.store-
generate - Idempotency-Key required
- Spends AI balance
Follow these four steps for every need:
- Search first. For any need for an image, illustration, icon, video, sound, music, voice or 3D model, search once per distinct need, in the user’s own generations and the ImgSearch library. Searching is free.
- Inspect. Read each result’s description, size and license, and its band where one is given: strong usually fits when the description shows what was asked for; possible needs a closer look. Prefer results the user made or already owns, which cost nothing. If a search says it is incomplete, search again before deciding.
- Reuse if one fits. Download only the items you chose.
- Generate only if nothing fits, and only where generating is offered. Check the estimate first and stay within the most the user allowed; ask the user before going higher. If a request is refused for its content, tell the user; do not rephrase or retry it. Needs a key made with spending allowed on the website, an Idempotency-Key header and max_usd, the most the user allows this to cost in US dollars (a higher price answers 409 price_above_max; ask the user before raising it). The same key and body again answers 200 with Idempotent-Replayed and the same generation, charging nothing; the same key with another body answers 409 idempotency_conflict. The price is charged now and refunded in full if it fails. Poll GET /generations/{id} after poll_after_seconds. content_refused means the content checks refused the request: never retry it or rephrase it. Uploads and reference.url must be pictures the account holder has the rights to use. Memes come without drawn captions: the captions come back in options.captions for you to draw.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Keyrequired |
header | string | A value of your own, 1 to 255 printable ASCII characters, new for every new request. The same key and body again returns the same generation and charges nothing. |
Request body
application/json, GenerationCreate
| Field | Type | Description |
|---|---|---|
kindrequired |
string |
One of:
image, video, audio, meme, music, sound, 3d, vector
|
model |
string or null | A model id from /models; the kind's default when left out. |
prompt |
string or null | |
options |
object or null | The model's options, as /models/{id} lists them. |
reference |
GenerationReference | At most one picture to start from. |
max_usdrequired |
number | The most the user allows this generation to cost, in US dollars, with at most three decimals. At least 0, At most 1000. |
Responses
- 201 Started and charged. (Generation)
- 200 The same request again; nothing was charged. (Generation)
- 402 plan_required, insufficient_balance or spend_cap_reached. (Error)
- Error Error envelope (error codes)
Examples
# Starts a generation. max_usd is the most the user allows it to cost, in US dollars.
# Needs IMGSEARCH_API_KEY.
# To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
IDEMPOTENCY_KEY="${IDEMPOTENCY_KEY:-$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)}"
echo "Idempotency-Key: $IDEMPOTENCY_KEY" >&2
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"model": "openai/gpt-image-2.5-sunburst",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"options": {
"aspect_ratio": "16:9"
},
"max_usd": 0.02
}'
# Starts a generation. max_usd is the most the user allows it to cost, in US dollars.
# Needs IMGSEARCH_API_KEY.
import json
import os
import sys
import uuid
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
# To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
idempotency_key = os.environ.get("IDEMPOTENCY_KEY") or str(uuid.uuid4())
print("Idempotency-Key:", idempotency_key, file=sys.stderr)
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}", "Idempotency-Key": idempotency_key}
r = httpx.post(
f"{base}/generations",
headers=headers,
json={
"kind": "image",
"model": "openai/gpt-image-2.5-sunburst",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"options": {"aspect_ratio": "16:9"},
"max_usd": 0.02,
},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Starts a generation. max_usd is the most the user allows it to cost, in US dollars.
// Needs IMGSEARCH_API_KEY.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
// To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
const idempotencyKey = process.env.IDEMPOTENCY_KEY || crypto.randomUUID();
console.error("Idempotency-Key:", idempotencyKey);
const r = await fetch(`${base}/generations`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Idempotency-Key": idempotencyKey,
"Content-Type": "application/json",
},
body: JSON.stringify({
kind: "image",
model: "openai/gpt-image-2.5-sunburst",
prompt: "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
options: { aspect_ratio: "16:9" },
max_usd: 0.02,
}),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bky93c0jbbax10h5qnjj0m",
"kind": "image",
"model": "local/echo",
"model_name": "Local echo (test)",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"title": null,
"starred": false,
"options": {
"count": 1,
"style": "none",
"aspect_ratio": "16:9"
},
"status": "queued",
"created_at": "2026-11-26T09:45:43Z",
"started_at": null,
"finished_at": null,
"estimate_seconds": 3,
"poll_after_seconds": 2,
"waiting": {
"reason": "busy",
"ahead": 0
},
"error": null,
"notice": null,
"quoted_usd": 0.01,
"charged_usd": 0.01,
"refunded_usd": 0,
"reference": null,
"outputs": [],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
Try it
The try-it panel needs JavaScript.
/uploads
Upload a picture to use as a reference #
uploads.store-
generate
A JPEG, PNG or WebP of 64 to 4,096 pixels a side and at most 10 MB, as the multipart field file. It is kept for an hour; send its id as reference.upload_id. Only a key that may spend can upload, and only pictures the account holder has the rights to use, with everyone in them (or their parent or guardian) agreeing.
Request body
multipart/form-data
| Field | Type | Description |
|---|---|---|
filerequired |
string |
Responses
- 201 The upload. (Upload)
- Error Error envelope (error codes)
Examples
# Uploads a reference picture (JPEG, PNG or WebP) the account holder has the rights to use.
# Needs IMGSEARCH_API_KEY and UPLOAD_FILE.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/uploads" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-F "file=@$UPLOAD_FILE"
# Uploads a reference picture (JPEG, PNG or WebP) the account holder has the rights to use.
# Needs IMGSEARCH_API_KEY and UPLOAD_FILE.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(f"{base}/uploads", headers=headers, files={"file": open(os.environ["UPLOAD_FILE"], "rb")}, timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Uploads a reference picture (JPEG, PNG or WebP) the account holder has the rights to use.
// Needs IMGSEARCH_API_KEY and UPLOAD_FILE.
import { readFile } from "node:fs/promises";
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const form = new FormData();
form.append("file", new Blob([await readFile(process.env.UPLOAD_FILE)]), "reference.png");
const r = await fetch(`${base}/uploads`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
body: form,
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "upload",
"id": "upl_01m8bky8xvhq169j1n8hme6ea0",
"mime": "image/png",
"width": 640,
"height": 360,
"bytes": 2064,
"expires_at": "2026-11-26T10:45:43Z"
}
Try it
The try-it panel needs JavaScript.
/generations/{id}
One generation #
generations.show-
generations:read
Its status, outputs and their 10-minute file links. Send If-None-Match with the last ETag to get 304 while nothing changed. While it is queued or running, wait poll_after_seconds before the next read.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
If-None-Match |
header | string | The last ETag you read; 304 while nothing changed. |
Responses
- 200 The generation. (Generation)
- 304 Not changed since that ETag.
- Error Error envelope (error codes)
Examples
# One generation. Read it again after poll_after_seconds while it is queued or running.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# One generation. Read it again after poll_after_seconds while it is queued or running.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.get(f"{base}/generations/{os.environ['GENERATION_ID']}", headers=headers, timeout=60)
print(r.status_code, r.headers.get("etag"))
print(json.dumps(r.json(), indent=2))
// One generation. Read it again after poll_after_seconds while it is queued or running.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}`, {
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
console.log(r.status, r.headers.get("etag"));
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bky93c0jbbax10h5qnjj0m",
"kind": "image",
"model": "local/echo",
"model_name": "Local echo (test)",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"title": null,
"starred": false,
"options": {
"count": 1,
"style": "none",
"aspect_ratio": "16:9"
},
"status": "succeeded",
"created_at": "2026-11-26T09:45:43Z",
"started_at": "2026-11-26T09:45:43Z",
"finished_at": "2026-11-26T09:45:44Z",
"estimate_seconds": 3,
"poll_after_seconds": null,
"waiting": null,
"error": null,
"notice": null,
"quoted_usd": 0.01,
"charged_usd": 0.01,
"refunded_usd": 0,
"reference": null,
"outputs": [
{
"n": 0,
"mime": "image/png",
"width": 1344,
"height": 768,
"duration": null,
"bytes": 6627,
"triangles": null,
"lyrics": null,
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"expires_at": "2026-11-26T09:55:44Z",
"upscale": {
"width": 2688,
"height": 1536,
"price_usd": 0.006
},
"upscaled": null
}
],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}
Delete a finished generation and its files #
generations.destroy-
generations:write
409 still_running while it is queued or running. Deleting frees its Idempotency-Key.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Responses
- 200 Deleted. (Deleted)
- Error Error envelope (error codes)
Examples
# Deletes a finished generation and its files.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS -X DELETE \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# Deletes a finished generation and its files.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.delete(f"{base}/generations/{os.environ['GENERATION_ID']}", headers=headers, timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Deletes a finished generation and its files.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}`, {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bkybpmrf86wntgby7kg6sg",
"deleted": true
}
Try it
The try-it panel needs JavaScript.
/generations/{id}
Rename, star, or change a meme's captions #
generations.update-
generations:write
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Request body
application/json, GenerationUpdate
| Field | Type | Description |
|---|---|---|
title |
string or null | Up to 80 characters; empty goes back to the prompt. |
starred |
boolean | |
captions |
object or null | A meme's captions, each plain text of up to 120 characters; null keeps the saved ones, {} clears them. |
layout |
string |
One of:
classic, modern
|
Responses
- 200 The generation. (Generation)
- Error Error envelope (error codes)
Examples
# Renames and stars a generation.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS -X PATCH \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Fox hero for the winter issue",
"starred": true
}'
# Renames and stars a generation.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.patch(
f"{base}/generations/{os.environ['GENERATION_ID']}",
headers=headers,
json={"title": "Fox hero for the winter issue", "starred": True},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Renames and stars a generation.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ title: "Fox hero for the winter issue", starred: true }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bky93c0jbbax10h5qnjj0m",
"kind": "image",
"model": "local/echo",
"model_name": "Local echo (test)",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"title": "Fox hero for the winter issue",
"starred": true,
"options": {
"count": 1,
"style": "none",
"aspect_ratio": "16:9"
},
"status": "succeeded",
"created_at": "2026-11-26T09:45:43Z",
"started_at": "2026-11-26T09:45:43Z",
"finished_at": "2026-11-26T09:45:44Z",
"estimate_seconds": 3,
"poll_after_seconds": null,
"waiting": null,
"error": null,
"notice": null,
"quoted_usd": 0.01,
"charged_usd": 0.01,
"refunded_usd": 0,
"reference": null,
"outputs": [
{
"n": 0,
"mime": "image/png",
"width": 1344,
"height": 768,
"duration": null,
"bytes": 6627,
"triangles": null,
"lyrics": null,
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"expires_at": "2026-11-26T09:55:44Z",
"upscale": {
"width": 2688,
"height": 1536,
"price_usd": 0.006
},
"upscaled": null
}
],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/cancel
Cancel a generation that has not started #
generations.cancel-
generations:write
Only while it is queued; its price is refunded in full. Anything else answers 409 not_cancelable.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Responses
- 200 The canceled generation. (Generation)
- Error Error envelope (error codes)
Examples
# Cancels a queued generation; its price comes back in full.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/cancel" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# Cancels a queued generation; its price comes back in full.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(f"{base}/generations/{os.environ['GENERATION_ID']}/cancel", headers=headers, timeout=60)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Cancels a queued generation; its price comes back in full.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/cancel`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bkybpmrf86wntgby7kg6sg",
"kind": "image",
"model": "local/echo",
"model_name": "Local echo (test)",
"prompt": "Examples replay to cancel",
"title": null,
"starred": false,
"options": {
"count": 1,
"style": "none",
"aspect_ratio": "1:1"
},
"status": "canceled",
"created_at": "2026-11-26T09:45:46Z",
"started_at": null,
"finished_at": "2026-11-26T09:45:46Z",
"estimate_seconds": 3,
"poll_after_seconds": null,
"waiting": null,
"error": {
"code": "canceled",
"message": "Canceled before it started. Your $0.01 was refunded.",
"retryable": false
},
"notice": null,
"quoted_usd": 0.01,
"charged_usd": 0,
"refunded_usd": 0.01,
"reference": null,
"outputs": [],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/outputs/{n}
An output's file, to the bearer #
generations.outputs-
generations:read
The same file as its file_url. download=1 sends it as an attachment; format=png gives an SVG as PNG, format=wav a track as WAV, and a 3D model's exports by format and height once they are made.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
nrequired |
path | string | An output's n (its place in outputs, counting from 0, so the first is 0), or soundtrack, video-clip, video-loop, video-bounce or video-hold. |
download |
query | boolean | |
format |
query | string | |
height |
query | string |
Responses
- 200 The file.
- Error Error envelope (error codes)
Examples
# Saves one output's file (OUTPUT_N is its n, usually 0).
# Needs IMGSEARCH_API_KEY, GENERATION_ID and OUTPUT_N.
curl -sS -OJ \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/outputs/$OUTPUT_N?download=1" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# Saves one output's file (OUTPUT_N is its n, usually 0).
# Needs IMGSEARCH_API_KEY, GENERATION_ID and OUTPUT_N.
import os
import re
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.get(
f"{base}/generations/{os.environ['GENERATION_ID']}/outputs/{os.environ['OUTPUT_N']}",
headers=headers,
params={"download": "1"},
timeout=60,
)
match = re.search(r'filename="?([^";]+)', r.headers.get("content-disposition", ""))
name = match.group(1) if match else "output"
if r.status_code == 200:
open(name, "wb").write(r.content)
print(r.status_code, r.headers.get("content-type"), len(r.content), "bytes", name if r.status_code == 200 else r.text)
// Saves one output's file (OUTPUT_N is its n, usually 0).
// Needs IMGSEARCH_API_KEY, GENERATION_ID and OUTPUT_N.
import { writeFile } from "node:fs/promises";
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/outputs/${process.env.OUTPUT_N}?download=1`, {
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
const match = /filename="?([^";]+)/.exec(r.headers.get("content-disposition") ?? "");
const name = match ? match[1] : "output";
const bytes = Buffer.from(await r.arrayBuffer());
if (r.status === 200) await writeFile(name, bytes);
console.log(r.status, r.headers.get("content-type"), bytes.length, "bytes", r.status === 200 ? name : bytes.toString());
Try it
The try-it panel needs JavaScript.
/generations/{id}/upscale
Upscale one of a generation's pictures 2× (spends AI balance) #
generations.upscale-
generate - Idempotency-Key required
- Spends AI balance
Its price is the output's upscale.price_usd. Needs an Idempotency-Key and max_usd, like POST /generations. A picture already upscaled or being upscaled answers 200 with that generation, without Idempotent-Replayed, and charges nothing.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Idempotency-Keyrequired |
header | string | A value of your own, 1 to 255 printable ASCII characters, new for every new request. The same key and body again returns the same generation and charges nothing. |
Request body
application/json
| Field | Type | Description |
|---|---|---|
n |
integer |
At least 0, At most 9. Default 0. |
max_usdrequired |
number | The most the user allows this to cost, in US dollars, with at most three decimals. At least 0, At most 1000. |
Responses
- 201 The upscale, started and charged. (Generation)
- 200 The same request again (Idempotent-Replayed), or the picture's existing upscale. (Generation)
- 402 plan_required, insufficient_balance or spend_cap_reached. (Error)
- Error Error envelope (error codes)
Examples
# Upscales picture n 2x. Its price is the output's upscale.price_usd.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
# To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
IDEMPOTENCY_KEY="${IDEMPOTENCY_KEY:-$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)}"
echo "Idempotency-Key: $IDEMPOTENCY_KEY" >&2
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/upscale" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{
"n": 0,
"max_usd": 0.1
}'
# Upscales picture n 2x. Its price is the output's upscale.price_usd.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import sys
import uuid
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
# To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
idempotency_key = os.environ.get("IDEMPOTENCY_KEY") or str(uuid.uuid4())
print("Idempotency-Key:", idempotency_key, file=sys.stderr)
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}", "Idempotency-Key": idempotency_key}
r = httpx.post(
f"{base}/generations/{os.environ['GENERATION_ID']}/upscale",
headers=headers,
json={"n": 0, "max_usd": 0.1},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Upscales picture n 2x. Its price is the output's upscale.price_usd.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
// To retry this same request without paying twice, run it again with the same IDEMPOTENCY_KEY.
const idempotencyKey = process.env.IDEMPOTENCY_KEY || crypto.randomUUID();
console.error("Idempotency-Key:", idempotencyKey);
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/upscale`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Idempotency-Key": idempotencyKey,
"Content-Type": "application/json",
},
body: JSON.stringify({ n: 0, max_usd: 0.1 }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "generation",
"id": "01m8bkyafh25zkcvsn64kg08we",
"kind": "image",
"model": "fal-ai/seedvr/upscale/image",
"model_name": "Upscale 2×",
"prompt": "A red fox standing in fresh snow at sunrise, wide shot, empty space on the left for a headline",
"title": null,
"starred": false,
"options": {
"upscale": 2
},
"status": "queued",
"created_at": "2026-11-26T09:45:45Z",
"started_at": null,
"finished_at": null,
"estimate_seconds": 15,
"poll_after_seconds": 5,
"waiting": {
"reason": "busy",
"ahead": 1
},
"error": null,
"notice": null,
"quoted_usd": 0.006,
"charged_usd": 0.006,
"refunded_usd": 0,
"reference": {
"type": "generation",
"id": "01m8bky93c0jbbax10h5qnjj0m",
"n": 0
},
"outputs": [],
"exports": null,
"soundtrack": null,
"voiceover_video": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/exports
A 3D model in another format (free) #
generations.exports.store-
generations:write
202 while it is being made (read it again), 200 once it is ready.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Request body
application/json
| Field | Type | Description |
|---|---|---|
formatrequired |
string |
One of:
fbx, obj, usdz, glb, glb-1k
|
height_m |
number or null | At least 0.05, At most 100. |
Responses
- 200 Ready. (Export)
- 202 Being made. (Export)
- Error Error envelope (error codes)
Examples
# Asks for a 3D model as FBX (free). 202 while it is made, 200 once it is ready.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/exports" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "fbx"
}'
# Asks for a 3D model as FBX (free). 202 while it is made, 200 once it is ready.
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(
f"{base}/generations/{os.environ['GENERATION_ID']}/exports",
headers=headers,
json={"format": "fbx"},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Asks for a 3D model as FBX (free). 202 while it is made, 200 once it is ready.
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/exports`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ format: "fbx" }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "export",
"key": "fbx-asis",
"format": "fbx",
"height_m": null,
"status": "succeeded",
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"expires_at": "2026-11-26T09:55:45Z",
"bytes": 12156,
"error": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/exports/{key}
One export's state and links #
generations.exports.show-
generations:read
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
keyrequired |
path | string | The format and height, such as fbx-asis or glb-1.80. |
Responses
- 200 The export. (Export)
- Error Error envelope (error codes)
Examples
# One export's state and links (EXPORT_KEY as fbx-asis).
# Needs IMGSEARCH_API_KEY, GENERATION_ID and EXPORT_KEY.
curl -sS \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/exports/$EXPORT_KEY" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY"
# One export's state and links (EXPORT_KEY as fbx-asis).
# Needs IMGSEARCH_API_KEY, GENERATION_ID and EXPORT_KEY.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.get(
f"{base}/generations/{os.environ['GENERATION_ID']}/exports/{os.environ['EXPORT_KEY']}",
headers=headers,
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// One export's state and links (EXPORT_KEY as fbx-asis).
// Needs IMGSEARCH_API_KEY, GENERATION_ID and EXPORT_KEY.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/exports/${process.env.EXPORT_KEY}`, {
headers: { Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}` },
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "export",
"key": "fbx-asis",
"format": "fbx",
"height_m": null,
"status": "succeeded",
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"expires_at": "2026-11-26T09:55:45Z",
"bytes": 12156,
"error": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/ar
View a 3D model in AR (free) #
generations.ar-
generations:write
Signed 30-minute links for iOS Quick Look and Android Scene Viewer; 202 while they are being made.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Request body
application/json
| Field | Type | Description |
|---|---|---|
height_m |
number or null | |
retry |
boolean |
Responses
- 200 Ready. (ArLinks)
- 202 Being made. (ArLinks)
- Error Error envelope (error codes)
Examples
# View in AR links for a 3D model, 1.2 m tall (free).
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/ar" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"height_m": 1.2
}'
# View in AR links for a 3D model, 1.2 m tall (free).
# Needs IMGSEARCH_API_KEY and GENERATION_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(
f"{base}/generations/{os.environ['GENERATION_ID']}/ar",
headers=headers,
json={"height_m": 1.2},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// View in AR links for a 3D model, 1.2 m tall (free).
// Needs IMGSEARCH_API_KEY and GENERATION_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/ar`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ height_m: 1.2 }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "ar_links",
"status": "succeeded",
"ios_url": "https://imgsearch.com/generator/ar/01m8bkxnmvbtztw64v4jc0b3jb/0.usdz?expires=EXAMPLE&height=1.20&user=22378&signature=EXAMPLE",
"android_url": "https://imgsearch.com/generator/ar/01m8bkxnmvbtztw64v4jc0b3jb/0.glb?expires=EXAMPLE&height=1.20&user=22378&signature=EXAMPLE",
"expires_at": "2026-11-26T10:15:45Z",
"error": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/soundtrack
Put one of your tracks (and a voiceover) on a clip (free) #
generations.soundtrack-
generations:write
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Request body
application/json
| Field | Type | Description |
|---|---|---|
music_idrequired |
string | |
voice_id |
string or null | |
n |
integer | At least 0, At most 9. |
volume |
integer | At least 0, At most 100. |
music_start |
number | At least 0. |
fade |
boolean | |
duck |
boolean | |
clip_sound |
boolean |
Responses
- 200 Ready. (Soundtrack)
- 202 Being mixed. (Soundtrack)
- Error Error envelope (error codes)
Examples
# Lays one of your tracks (MUSIC_ID) on a clip (GENERATION_ID). Free.
# Needs IMGSEARCH_API_KEY, GENERATION_ID and MUSIC_ID.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/soundtrack" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<EOF
{
"music_id": "$MUSIC_ID",
"volume": 60,
"fade": true
}
EOF
# Lays one of your tracks (MUSIC_ID) on a clip (GENERATION_ID). Free.
# Needs IMGSEARCH_API_KEY, GENERATION_ID and MUSIC_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(
f"{base}/generations/{os.environ['GENERATION_ID']}/soundtrack",
headers=headers,
json={"music_id": os.environ["MUSIC_ID"], "volume": 60, "fade": True},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Lays one of your tracks (MUSIC_ID) on a clip (GENERATION_ID). Free.
// Needs IMGSEARCH_API_KEY, GENERATION_ID and MUSIC_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/soundtrack`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ music_id: process.env.MUSIC_ID, volume: 60, fade: true }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "soundtrack",
"status": "succeeded",
"n": 0,
"music_id": "01m8bkxncmn3vg8hfznkpy1f65",
"voice_id": null,
"volume": 60,
"music_start": 0,
"fade": true,
"duck": false,
"clip_sound": true,
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"error": null
}
Try it
The try-it panel needs JavaScript.
/generations/{id}/voiceover-video
Lay a finished voiceover on one of your clips (free) #
generations.voiceover-video-
generations:write
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired |
path | string | A generation's id. |
Request body
application/json
| Field | Type | Description |
|---|---|---|
video_id |
string or null | |
n |
integer or null | At least 0, At most 9. |
Responses
- 200 Ready. (VoiceoverVideo)
- 202 Being made. (VoiceoverVideo)
- Error Error envelope (error codes)
Examples
# Lays a finished voiceover (GENERATION_ID) on one of your clips (VIDEO_ID). Free.
# Needs IMGSEARCH_API_KEY, GENERATION_ID and VIDEO_ID.
curl -sS -X POST \
"${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/generations/$GENERATION_ID/voiceover-video" \
-H "Authorization: Bearer $IMGSEARCH_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<EOF
{
"video_id": "$VIDEO_ID"
}
EOF
# Lays a finished voiceover (GENERATION_ID) on one of your clips (VIDEO_ID). Free.
# Needs IMGSEARCH_API_KEY, GENERATION_ID and VIDEO_ID.
import json
import os
import httpx
base = os.environ.get("IMGSEARCH_API_BASE", "https://imgsearch.com/api/v2")
headers = {"Authorization": f"Bearer {os.environ['IMGSEARCH_API_KEY']}"}
r = httpx.post(
f"{base}/generations/{os.environ['GENERATION_ID']}/voiceover-video",
headers=headers,
json={"video_id": os.environ["VIDEO_ID"]},
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Lays a finished voiceover (GENERATION_ID) on one of your clips (VIDEO_ID). Free.
// Needs IMGSEARCH_API_KEY, GENERATION_ID and VIDEO_ID.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";
const r = await fetch(`${base}/generations/${process.env.GENERATION_ID}/voiceover-video`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ video_id: process.env.VIDEO_ID }),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "voiceover_video",
"status": "succeeded",
"video_id": "01m8bkxnatzr40rjsk4hk318eb",
"n": 0,
"files": [
{
"fit": "clip",
"file_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK",
"download_url": "https://imgsearch.com/api/v2/generation-files/EXAMPLE-SIGNED-LINK"
}
],
"error": null
}
Try it
The try-it panel needs JavaScript.
/generation-files/{token}
Fetch one of your generation files by its signed link #
generation-files.show- No key needed
A file_url or download_url of a generation: it works for 10 minutes, for the account and the key or token that read it, and stops when either is revoked.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
tokenrequired |
path | string |
Responses
- 200 The file.
- Error Error envelope (error codes)
Examples
# Fetches a generation's file_url or download_url. The link is the credential.
# Needs LINK_URL.
curl -sS -o generation-file -w '%{http_code} %{content_type}\n' \
"$LINK_URL"
# Fetches a generation's file_url or download_url. The link is the credential.
# Needs LINK_URL.
import os
import re
import httpx
r = httpx.get(os.environ["LINK_URL"], timeout=60)
match = re.search(r'filename="?([^";]+)', r.headers.get("content-disposition", ""))
name = match.group(1) if match else "generation-file"
if r.status_code == 200:
open(name, "wb").write(r.content)
print(r.status_code, r.headers.get("content-type"), len(r.content), "bytes", name if r.status_code == 200 else r.text)
// Fetches a generation's file_url or download_url. The link is the credential.
// Needs LINK_URL.
import { writeFile } from "node:fs/promises";
const r = await fetch(process.env.LINK_URL);
const match = /filename="?([^";]+)/.exec(r.headers.get("content-disposition") ?? "");
const name = match ? match[1] : "generation-file";
const bytes = Buffer.from(await r.arrayBuffer());
if (r.status === 200) await writeFile(name, bytes);
console.log(r.status, r.headers.get("content-type"), bytes.length, "bytes", r.status === 200 ? name : bytes.toString());
/upload-links/{token}
Upload a reference picture to a signed upload link #
upload-links.store- No key needed
The upload_url that MCP 3.0's prepare_upload returns: the link is the credential. PUT the picture's bytes as the body, with the Content-Type the link was made for (image/jpeg, image/png or image/webp) and at most its size, within 15 minutes. A link works once: a second PUT answers 404. The answer is the upload; send its id as reference.upload_id within an hour. It counts toward the upload limit (429 rate_limited) and passes the same checks as POST /uploads (422 invalid_request, fields.file).
Parameters
| Name | In | Type | Description |
|---|---|---|---|
tokenrequired |
path | string |
Request body
image/jpeg
Responses
- 201 The upload. (Upload)
- Error Error envelope (error codes)
Examples
# Sends a picture to an upload_url from the MCP server's prepare_upload, with the type the link was made for.
# Needs LINK_URL and UPLOAD_FILE.
curl -sS -X PUT \
"$LINK_URL" \
-H "Content-Type: image/png" \
--data-binary "@$UPLOAD_FILE"
# Sends a picture to an upload_url from the MCP server's prepare_upload, with the type the link was made for.
# Needs LINK_URL and UPLOAD_FILE.
import json
import os
import httpx
headers = {"Content-Type": "image/png"}
r = httpx.put(
os.environ["LINK_URL"],
headers=headers,
content=open(os.environ["UPLOAD_FILE"], "rb").read(),
timeout=60,
)
print(r.status_code)
print(json.dumps(r.json(), indent=2))
// Sends a picture to an upload_url from the MCP server's prepare_upload, with the type the link was made for.
// Needs LINK_URL and UPLOAD_FILE.
import { readFile } from "node:fs/promises";
const r = await fetch(process.env.LINK_URL, {
method: "PUT",
headers: { "Content-Type": "image/png" },
body: await readFile(process.env.UPLOAD_FILE),
});
console.log(r.status);
console.log(JSON.stringify(await r.json(), null, 2));
{
"object": "upload",
"id": "upl_01m6v2m7ah186jeyq7nb8e3m7r",
"mime": "image/png",
"width": 640,
"height": 360,
"bytes": 2064,
"expires_at": "2026-11-07T14:19:35Z"
}