# Search

> One search over every public source, with comparable scores and what generating instead would cost.


## Search every public source at once

<a id="search"></a>`search`

`POST /search`

Scope: `search`

One query over photos, videos, SVGs, SVG packs, brands, sound effects and their packs, 3D models and kits.
Follow these four steps for every need:
1. 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.
2. 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.
3. Reuse if one fits. Download only the items you chose.
4. 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.
If complete is false, a source failed just now: search again
before generating. relevance (0–1) and band are a ranking guide that means roughly the same across sources,
not a verdict. Every response says what generating instead would cost (generation_estimate). Results page
30 at most and 100 deep per query (depth_limited). Each page counts as one search, and its cards as result
cards. A query text not searched recently also counts toward a limit of 20 new queries a minute (429
rate_limited); repeating a query is not limited by it. While the personal index is on, your own AI Generator
results join too: they come with made_by_you and owned true and license own_generation; edits, upscales and
memes of one picture come back as one result, its best output; their relevance is the higher of the text and
picture scores. A result you then download through the API counts toward GET /account/savings.

### Request body

`application/json`, [`SearchRequest`](https://imgsearch.com/developers/reference/schemas.md#SearchRequest)

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | Yes | What you need, in plain English: subject, setting, purpose and constraints. At most 500 characters. |
| `types` | array of string | No | The sources to search. Default: own generations (while the personal index is on) and every public type. generation answers not_available while the personal index is off, or with a note while the account's Search my creations is off. One of: "photo", "video", "svg", "svg_pack", "brand", "sound_effect", "sfx_pack", "3d_model", "3d_kit", "generation". At least 1 items, At most 10 items. |
| `kind` | string or null | No | What you would generate instead, for the estimate. Inferred when every type maps to one kind. One of: "image", "video", "audio", "meme", "music", "sound", "3d", "vector", null. |
| `filters` | object | No | Hard filters. A source a filter does not apply to is searched without it and lists it in ignored_filters. With a filter, photos and videos look at their best 300 candidates; SVGs, brands, sounds and 3D models at their best 120. |
| `limit` | integer | No | At least 1, At most 30. Default 10. |
| `include_scores` | boolean | No | Adds the raw score and its space to each result. Default false. |
| `cursor` | string or null | No | The next_cursor of the previous page; repeat the same body with it. It works for 60 minutes; after that the answer is 422 invalid_request (details.fields.cursor), so search again without it. At most 512 characters. |

### Responses

- `200` One page of merged results with each source's status. ([`SearchResult`](https://imgsearch.com/developers/reference/schemas.md#SearchResult))
- `default` Error envelope ([`Error`](https://imgsearch.com/developers/reference/schemas.md#Error))

### Examples

**curl**

```bash
# One search over every source, with what generating instead would cost.
# Needs IMGSEARCH_API_KEY.
curl -sS -X POST \
  "${IMGSEARCH_API_BASE:-https://imgsearch.com/api/v2}/search" \
  -H "Authorization: Bearer $IMGSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "a red fox standing in fresh snow looking straight at the camera, shallow depth of field, early morning golden light, landscape",
  "kind": "image",
  "filters": {
    "orientation": "landscape"
  },
  "limit": 5
}'
```

**Python**

```python
# One search over every source, with what generating instead would cost.
# 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}/search",
    headers=headers,
    json={
        "query": "a red fox standing in fresh snow looking straight at the camera, shallow depth of field, early morning golden light, landscape",
        "kind": "image",
        "filters": {"orientation": "landscape"},
        "limit": 5,
    },
    timeout=60,
)
print(r.status_code)
data = r.json()
print("complete:", data["complete"])
for item in data["results"]:
    print(item["band"], item["relevance"], item["owned"], item["type"], item["id"], item["title"])
print("generating instead:", json.dumps(data["generation_estimate"]))
```

**JavaScript**

```js
// One search over every source, with what generating instead would cost.
// Needs IMGSEARCH_API_KEY.
const base = process.env.IMGSEARCH_API_BASE ?? "https://imgsearch.com/api/v2";

const r = await fetch(`${base}/search`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.IMGSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "a red fox standing in fresh snow looking straight at the camera, shallow depth of field, early morning golden light, landscape",
    kind: "image",
    filters: { orientation: "landscape" },
    limit: 5,
  }),
});
const data = await r.json();
console.log(r.status, "complete:", data.complete);
for (const item of data.results) {
  console.log(item.band, item.relevance, item.owned, item.type, item.id, item.title);
}
console.log("generating instead:", JSON.stringify(data.generation_estimate));
```

**Response 200**

```json
{
    "object": "search_result",
    "id": "srch_01m8bky7fv20mg1qk2fwk4aza5",
    "complete": true,
    "sources": {
        "photo": {
            "status": "ok",
            "retryable": false
        },
        "video": {
            "status": "ok",
            "retryable": false
        },
        "svg": {
            "status": "ok",
            "retryable": false
        },
        "svg_pack": {
            "status": "ok",
            "retryable": false,
            "ignored_filters": [
                "orientation"
            ]
        },
        "brand": {
            "status": "no_results",
            "retryable": false
        },
        "sound_effect": {
            "status": "no_results",
            "retryable": false,
            "ignored_filters": [
                "orientation"
            ]
        },
        "sfx_pack": {
            "status": "no_results",
            "retryable": false,
            "ignored_filters": [
                "orientation"
            ]
        },
        "3d_model": {
            "status": "no_results",
            "retryable": false,
            "ignored_filters": [
                "orientation"
            ]
        },
        "3d_kit": {
            "status": "no_results",
            "retryable": false,
            "ignored_filters": [
                "orientation"
            ]
        }
    },
    "results": [
        {
            "type": "photo",
            "id": "majestic-red-fox-in-a-frosty-landscape-141601326",
            "title": "Majestic red fox in a frosty landscape",
            "description": "Explore the beauty of a majestic red fox captured in a frost-covered meadow, showcasing its fur keen demeanor amidst a winter landscape. Perfect for nature lovers wildlife enthusiasts.",
            "relevance": 1,
            "band": "strong",
            "owned": true,
            "made_by_you": false,
            "community": false,
            "preview_url": "https://imgsearch.com/api/v2/previews/EXAMPLE-SIGNED-LINK",
            "page_url": "https://imgsearch.com/image/majestic-red-fox-in-a-frosty-landscape-141601326",
            "format": "jpg",
            "width": 2560,
            "height": 1440,
            "aspect_ratio": 1.7777777777777777,
            "orientation": "landscape",
            "tags": [
                "red fox",
                "frosty landscape",
                "wildlife photography",
                "nature",
                "animal portrait",
                "winter",
                "meadow"
            ],
            "delivered_size": "2560x1440",
            "license": {
                "key": "imgsearch_content",
                "name": "ImgSearch content license",
                "license_url": "https://imgsearch.com/legal",
                "terms_url": "https://imgsearch.com/legal/terms",
                "attribution": "optional",
                "attribution_text": null,
                "usage_conditions": null,
                "not_allowed": [
                    "Files not obtained through a download",
                    "Showing identifiable people in a negative or offensive way",
                    "Suggesting endorsement by people or brands shown",
                    "Redistributing or selling the files on other stock-content or wallpaper platforms"
                ],
                "ai_generated": true,
                "community": false,
                "notes": null
            },
            "download": {
                "fair_use_units": 0,
                "free": true,
                "counter": "files"
            }
        },
        {
            "type": "video",
            "id": "01kvptgeys1xt2vwk225f4xwqk",
            "title": "Close-up of red fox looking up in forest",
            "description": "A close-up view of a red fox in a natural outdoor setting. The fox turns its head to face forward, making direct eye contact, before tilting its snout upward to look at the sky. The background features soft, out-of-focus green foliage, highlighting the animal's bright orange and white fur.",
            "relevance": 1,
            "band": "strong",
            "owned": false,
            "made_by_you": false,
            "community": false,
            "preview_url": "https://imgsearch.com/api/v2/previews/EXAMPLE-SIGNED-LINK",
            "page_url": "https://imgsearch.com/video/01kvptgeys1xt2vwk225f4xwqk",
            "format": "mp4",
            "width": 1280,
            "height": 720,
            "duration_seconds": 10,
            "has_sound": true,
            "tags": [
                "nature",
                "other"
            ],
            "orientation": "landscape",
            "poster_url": "https://cdn.imgsearch.com/batches/3/thumbnails/md/31930.webp?token=EXAMPLE&expires=EXAMPLE",
            "license": {
                "key": "imgsearch_content",
                "name": "ImgSearch content license",
                "license_url": "https://imgsearch.com/legal",
                "terms_url": "https://imgsearch.com/legal/terms",
                "attribution": "optional",
                "attribution_text": null,
                "usage_conditions": null,
                "not_allowed": [
                    "Files not obtained through a download",
                    "Showing identifiable people in a negative or offensive way",
                    "Suggesting endorsement by people or brands shown",
                    "Redistributing or selling the files on other stock-content or wallpaper platforms"
                ],
                "ai_generated": true,
                "community": false,
                "notes": null
            },
            "download": {
                "fair_use_units": 1,
                "free": false,
                "counter": "videos"
            }
        },
        {
            "type": "video",
            "id": "01kys82vwayth5gmvhgc36zck2",
            "title": "Red fox in a lush green forest",
            "description": "A red fox sits on a forest path surrounded by green foliage and white flowers. The fox looks around its environment before standing up and walking forward. Dappled sunlight filters through the trees, illuminating the fox's orange fur against the woodland backdrop.",
            "relevance": 1,
            "band": "strong",
            "owned": false,
            "made_by_you": false,
            "community": false,
            "preview_url": "https://imgsearch.com/api/v2/previews/EXAMPLE-SIGNED-LINK",
            "page_url": "https://imgsearch.com/video/01kys82vwayth5gmvhgc36zck2",
            "format": "mp4",
            "width": 1280,
            "height": 720,
            "duration_seconds": 5,
            "has_sound": true,
            "tags": [
                "nature",
                "landscape"
            ],
            "orientation": "landscape",
            "poster_url": "https://cdn.imgsearch.com/batches/17/thumbnails/md/522528.webp?token=EXAMPLE&expires=EXAMPLE",
            "license": {
                "key": "imgsearch_content",
                "name": "ImgSearch content license",
                "license_url": "https://imgsearch.com/legal",
                "terms_url": "https://imgsearch.com/legal/terms",
                "attribution": "optional",
                "attribution_text": null,
                "usage_conditions": null,
                "not_allowed": [
                    "Files not obtained through a download",
                    "Showing identifiable people in a negative or offensive way",
                    "Suggesting endorsement by people or brands shown",
                    "Redistributing or selling the files on other stock-content or wallpaper platforms"
                ],
                "ai_generated": true,
                "community": false,
                "notes": null
            },
            "download": {
                "fair_use_units": 1,
                "free": false,
                "counter": "videos"
            }
        },
        {
            "type": "photo",
            "id": "majestic-winter-fox-in-snowfall-4934566",
            "title": "Majestic winter fox in snowfall",
            "description": "Stunning close-up of a red fox in snowy surroundings, highlighting its fur expressive eyes, perfect for wildlife photography enthusiasts.",
            "relevance": 1,
            "band": "strong",
            "owned": false,
            "made_by_you": false,
            "community": false,
            "preview_url": "https://imgsearch.com/api/v2/previews/EXAMPLE-SIGNED-LINK",
            "page_url": "https://imgsearch.com/image/majestic-winter-fox-in-snowfall-4934566",
            "format": "jpg",
            "width": 2560,
            "height": 1440,
            "aspect_ratio": 1.7777777777777777,
            "orientation": "landscape",
            "tags": [
                "fox",
                "winter",
                "snow",
                "wildlife",
                "red fox",
                "nature",
                "animal photography",
                "serene landscape"
            ],
            "delivered_size": "2560x1440",
            "license": {
                "key": "imgsearch_content",
                "name": "ImgSearch content license",
                "license_url": "https://imgsearch.com/legal",
                "terms_url": "https://imgsearch.com/legal/terms",
                "attribution": "optional",
                "attribution_text": null,
                "usage_conditions": null,
                "not_allowed": [
                    "Files not obtained through a download",
                    "Showing identifiable people in a negative or offensive way",
                    "Suggesting endorsement by people or brands shown",
                    "Redistributing or selling the files on other stock-content or wallpaper platforms"
                ],
                "ai_generated": true,
                "community": false,
                "notes": null
            },
            "download": {
                "fair_use_units": 1,
                "free": false,
                "counter": "files"
            }
        },
        {
            "type": "photo",
            "id": "majestic-winter-fox-in-snowy-landscape-71035802",
            "title": "Majestic winter fox in snowy landscape",
            "description": "Explore the beauty of nature with this captivating close-up of a red fox in a winter wonderland. This striking portrait showcases the fox's orange fur expressive eyes against a backdrop of soft white snow, making it a perfect representation of wildlife in winter.",
            "relevance": 1,
            "band": "strong",
            "owned": false,
            "made_by_you": false,
            "community": false,
            "preview_url": "https://imgsearch.com/api/v2/previews/EXAMPLE-SIGNED-LINK",
            "page_url": "https://imgsearch.com/image/majestic-winter-fox-in-snowy-landscape-71035802",
            "format": "jpg",
            "width": 2560,
            "height": 1440,
            "aspect_ratio": 1.7777777777777777,
            "orientation": "landscape",
            "tags": [
                "fox",
                "wildlife",
                "snow",
                "nature",
                "portrait",
                "animal",
                "red fox",
                "winter",
                "photography"
            ],
            "delivered_size": "2560x1440",
            "license": {
                "key": "imgsearch_content",
                "name": "ImgSearch content license",
                "license_url": "https://imgsearch.com/legal",
                "terms_url": "https://imgsearch.com/legal/terms",
                "attribution": "optional",
                "attribution_text": null,
                "usage_conditions": null,
                "not_allowed": [
                    "Files not obtained through a download",
                    "Showing identifiable people in a negative or offensive way",
                    "Suggesting endorsement by people or brands shown",
                    "Redistributing or selling the files on other stock-content or wallpaper platforms"
                ],
                "ai_generated": true,
                "community": false,
                "notes": null
            },
            "download": {
                "fair_use_units": 1,
                "free": false,
                "counter": "files"
            }
        }
    ],
    "generation_estimate": {
        "kind": "image",
        "model": {
            "id": "openai/gpt-image-2.5-sunburst",
            "name": "GPT Image 2.5 Sunburst"
        },
        "options": {
            "aspect_ratio": "16:9",
            "quality": "medium",
            "count": 1,
            "style": "none"
        },
        "per_output_usd": 0.015,
        "typical_seconds": 23,
        "can_generate": true,
        "reason": null
    },
    "fair_use": {
        "status": "ok",
        "videos_status": "ok",
        "resets_at": "2026-12-07T14:57:00Z"
    },
    "next_cursor": "EXAMPLE-CURSOR",
    "depth_limited": false
}
```

## Open a search result's preview

<a id="previews.show"></a>`previews.show`

`GET /previews/{token}`

No key needed

A 1-hour link from a search card. It redirects to the small preview the website shows (watermarked where the website watermarks); for your own generations, which have no public page, it is a 10-minute link that answers the 384-pixel thumbnail itself. A preview grants no usage rights; download the file for that.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `token` | path | string | Yes |  |

### Responses

- `200` An own generation's thumbnail.
- `302` The preview.
- `default` Error envelope ([`Error`](https://imgsearch.com/developers/reference/schemas.md#Error))

### Examples

**curl**

```bash
# Opens a search result's preview_url without following it. A preview grants no usage rights.
# Needs LINK_URL.
curl -sS -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  "$LINK_URL"
```

**Python**

```python
# Opens a search result's preview_url without following it. A preview grants no usage rights.
# Needs LINK_URL.
import os

import httpx

r = httpx.get(os.environ["LINK_URL"], timeout=60)
print(r.status_code, r.headers.get("location") or r.headers.get("content-type"))
```

**JavaScript**

```js
// Opens a search result's preview_url without following it. A preview grants no usage rights.
// Needs LINK_URL.

const r = await fetch(process.env.LINK_URL, { redirect: "manual" });
console.log(r.status, r.headers.get("location") ?? r.headers.get("content-type"));
```
