# Search first

> One search over your own generations and the ImgSearch library, with comparable scores and what generating instead would cost.

Follow these four steps for every need, whether your code or an agent makes the calls:

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.

Why this order: a file that already exists is ready in a second, costs nothing if the account owns it, and otherwise only uses fair use. A generation takes from seconds to minutes and spends AI balance. Every search answer says what generating instead would cost, so the choice is never blind.

## The request

`POST /search` with a JSON body ([reference](https://imgsearch.com/developers/reference/search.md#search)):

| Field | What it is |
|---|---|
| `query` | What you need, in plain words: subject, setting, purpose and constraints. At most 500 characters. |
| `types` | The sources to search (below). Leave it out to search every source. |
| `kind` | What you would generate instead, for the estimate: `image`, `video`, `audio`, `meme`, `music`, `sound`, `3d` or `vector`. Inferred when every type maps to one kind. |
| `filters` | Hard filters (below). |
| `limit` | Results per page, 1 to 30. 10 when left out. |
| `include_scores` | `true` adds each result’s raw `score` and its `score_space`. |
| `cursor` | The previous page’s `next_cursor`, with the same body. |

The sources, and the kind each one’s estimate uses:

| Type | What it is | Estimate kind |
|---|---|---|
| `photo` | Photos | `image` |
| `video` | Videos | `video` |
| `svg` | SVG illustrations | `vector` |
| `svg_pack` | SVG illustration packs, game icon packs and UI kits | `vector` |
| `brand` | Brand logos | — |
| `sound_effect` | Sound effects | — |
| `sfx_pack` | Game sound packs | — |
| `3d_model` | 3D models | `3d` |
| `3d_kit` | 3D model kits | `3d` |
| `generation` | The account’s own AI Generator results | — |

Search once per distinct need. Two different needs (a hero photo and an icon set) are two searches; two wordings of the same need are not.

## Sources and complete

Each requested type answers in `sources.{type}`:

| `status` | Meaning | What to do |
|---|---|---|
| `ok` | Searched, with results | Read them |
| `no_results` | Searched, nothing matched | Nothing |
| `unavailable` | Failed just now (`retryable: true`) | Search again |
| `not_available` | Closed or not offered (`retryable: false`) | Do not retry; `note` may say why |

`complete` is `false` only when a source is `unavailable`. Such a search is not cached, so searching again really asks again. Do not generate after an incomplete search: search again first.

## Relevance and bands

Each result has a `relevance` from 0 to 1 and a `band`:

| `band` | `relevance` | Meaning |
|---|---|---|
| `strong` | 0.75 or more | Usually fits when the description shows what was asked for |
| `possible` | 0.50 or more | A partial match: look at the description and the preview |
| `weak` | below 0.50 | Rarely what you asked for |

Relevance is a ranking guide that means roughly the same across sources, not a verdict: an SVG or sound in the same style as the query can rate `strong` without showing its subject, so read the title and description before you use a result. Each source’s raw similarity is mapped through anchors fitted from marked sample searches. For photos, SVGs, 3D models and your own pictures the raw score barely tells a full fit from a partial one, so their `possible` boundary is provisional. Your own creations are also at least `possible` when one clearly stands out from the rest of your creations for the query, so a synonym (“dog” for a golden retriever puppy) is not marked weak. A source without fitted anchors answers `relevance: null` and `band: null`; its results come after scored ones. Packs and kits score by their best member.

The list is sorted by relevance, then owned items, then your own, then finer ties. When a search is about brands (`types: ["brand"]`, or a query ending in logo, icon or svg), an exact brand name comes first.

Always read `description`: it says what the item actually shows. Look at `preview_url` (a signed link for up to 60 minutes, while the key that asked for it works) when a `possible` result might do.

## Filters

A filter that does not apply to a source is ignored there, and that source lists it in `ignored_filters`.

| Filter | Value | Applies to |
|---|---|---|
| `orientation` | `landscape`, `portrait` or `square` | photos, videos, SVGs, brands, own generations |
| `aspect_ratio` | `"W:H"`, such as `"16:9"`, within 3% | photos, videos, SVGs, brands, own generations |
| `min_width` | pixels; photos count at the size this account downloads | photos, videos, own generations |
| `transparent` | `true` keeps items with a transparent version (a pack only when every member has one); `false` filters nothing | SVGs, brands, SVG packs (photos and videos have none, so `true` leaves them out) |
| `duration_s` | `{"min": …, "max": …}` in seconds, 0 to 600 | videos, sound effects, own generations |
| `has_sound` | `true` or `false`; a clip whose sound is not known matches neither | videos |
| `max_triangles` | the most triangles | 3D models and kits |
| `license` | `imgsearch_content`, `game_asset`, `mit` or `brand` | every source |
| `min_band` | `possible` or `strong` | every source |
| `community` | `false` leaves out contributors’ items | photos, videos |

With a filter, photos, videos and your own generations look at their best 300 candidates (100 without one), and the other sources at their best 120, so a narrow filter can leave fewer results than `limit`.

## Paging and depth

A page has at most 30 results. Send `next_cursor` back as `cursor`, with the same body, for the next page. One query goes at most 100 results deep: past that, `next_cursor` is null and `depth_limited` is true. A better query beats a deeper page.

The first page builds the list and keeps it 60 minutes for this account and body, so later pages read the list page one was cut from: no repeats or gaps when a creation is added between pages. Later pages read ownership again, and an item withdrawn since drops out. A cursor used with another body, list or account, or after its 60 minutes, answers `422 invalid_request` (`details.fields.cursor`); search again without it.

## What a search counts

- Every page is one search, and its cards are result cards, in one budget per person shared with the website and the MCP server. See [limits](https://imgsearch.com/developers/limits.md).
- 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.
- Searching never counts toward fair use or spends anything. Only downloads count, and only new ones.

## The estimate

Every answer has `generation_estimate` (except for an app connected as ChatGPT): the default model and options of the kind you named (or the one kind every requested type maps to), priced in US dollars:

- `per_output_usd`: the price of one output.
- `can_generate`: whether this key could start it now; when false, `reason` says why, such as `spending_not_enabled`, `plan_required` or `insufficient_balance`.
- `typical_seconds`: how long it usually takes.

It is null when there is nothing to price, and `generation_estimate_reason` says why:

| Reason | Meaning |
|---|---|
| `kind_ambiguous` | The types map to different kinds (the default types do). Send `kind`. |
| `no_generator_for_type` | The types have no generator (brands, sound effects, sound packs). |
| `no_model_available` | No model of that kind is offered right now. |
| `no_results` | A search of your own generations alone found none. |

For a price with other options or another model, call `POST /generations/estimate` ([generation](https://imgsearch.com/developers/generation.md#starting-one)).

## Licenses

Each card has a `license` block (`key`, `name`, `license_url`, `terms_url`, `attribution`, `not_allowed`, `notes`). What each source allows, as `GET /licenses` answers it (each row names its `key`, the key cards carry in `license.key`, and `variants` for the other keys of that source: MIT sounds and kits, game icon packs):

| Source | License | Allowed | Not allowed | Attribution |
|---|---|---|---|---|
| `photo` | [ImgSearch content license](https://imgsearch.com/legal) | Personal and commercial use; Changes and edits | 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 | optional |
| `video` | [ImgSearch content license](https://imgsearch.com/legal) | Personal and commercial use; Changes and edits | 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 | optional |
| `svg` | [ImgSearch content license](https://imgsearch.com/legal) | Personal and commercial use; Changes and edits | 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 | optional |
| `svg_pack` | [ImgSearch content license](https://imgsearch.com/legal) (varies per item) | Personal and commercial use; Changes and edits | 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 | optional |
| `brand` | [Per asset: the artwork license, attribution and trademark conditions on each asset page and in its ZIP](https://imgsearch.com/legal) (varies per item) | What the asset's own license allows | Removing the license and source notices in the ZIP; Suggesting endorsement by the brand | as the asset states |
| `sound_effect` | [ImgSearch content license](https://imgsearch.com/legal) (varies per item) | Personal and commercial use; Changes and edits | 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 | optional |
| `sfx_pack` | [ImgSearch Game Asset License](https://imgsearch.com/game-assets/license) | Use in any number of games and other interactive projects, commercial or not; Changing, recoloring, cutting and combining them; Shipping them in builds, trailers, store pages and marketing | Selling, sharing or giving the assets away on their own or as a pack, template or starter kit; Training or improving AI models; Removing provenance metadata or watermarks; Registering them as a trademark or logo | optional |
| `3d_model` | [ImgSearch Game Asset License](https://imgsearch.com/game-assets/license) (varies per item) | Use in any number of games and other interactive projects, commercial or not; Changing, recoloring, cutting and combining them; Shipping them in builds, trailers, store pages and marketing | Selling, sharing or giving the assets away on their own or as a pack, template or starter kit; Training or improving AI models; Removing provenance metadata or watermarks; Registering them as a trademark or logo | optional |
| `3d_kit` | [ImgSearch Game Asset License](https://imgsearch.com/game-assets/license) (varies per item) | Use in any number of games and other interactive projects, commercial or not; Changing, recoloring, cutting and combining them; Shipping them in builds, trailers, store pages and marketing | Selling, sharing or giving the assets away on their own or as a pack, template or starter kit; Training or improving AI models; Removing provenance metadata or watermarks; Registering them as a trademark or logo | optional |
| `generation` | [Terms of Use Art. 8 and the model's terms](https://imgsearch.com/legal/terms) (varies per item) | Commercial use in line with the model's terms (each model's rights_note in /v2/models/{id}) | Removing the AI label; Training AI models; Presenting results as made by a person or as real | not required |

`varies per item` means the card’s own block is the one that counts.
