Generator

Menu

AI GeneratorImages, video, audio and 3D

Browse categories

Docs menu
Authentication and spending

Start

Authentication and spending

API keys, OAuth apps, scopes, letting a key spend AI balance, and the try-it panel.

View as Markdown
For your agent https://imgsearch.com/llms.txt
On this page

Every call but the public ones (the index, status, models, licenses and the OpenAPI document) needs a bearer credential:

http
Authorization: Bearer <key or token>

A missing or broken one answers 401 unauthenticated; an expired one token_expired, a revoked one token_revoked. Each 401 carries WWW-Authenticate: Bearer realm="ImgSearch API".

API keys #

  • Made on the website only, at Account → API keys, by an account with a verified email address. No API call makes a key.
  • Confirmed with your password. An account made with Google that never set a password signs in again first instead.
  • Shown once. The page that answers the form is the only place the key appears. Copy it then.
  • Lasts 30, 90 or 365 days, as you choose. An account can have 10 working keys.
  • A mail for every new key, with its name, permissions and expiry (never the key itself), so you notice one you did not make.
  • Stops when you revoke it on the keys page, at once, or when it expires. A new password leaves keys working.
  • Its permissions are fixed when it is made (they are inside the signed key). To give a key more, make a new one.

The keys page shows when each key was last used.

OAuth apps #

AI tools that connect through the MCP server use OAuth 2.1 with PKCE and dynamic client registration. The person signs in on ImgSearch and approves the app; the app gets its own token, sent as Authorization: Bearer like a key. People see and disconnect their apps at Account → Connected apps.

The consent screen lists what the app may do. ChatGPT gets search, download and generations:read; other apps can also get generations:write, account:read and, only when the person ticks the spending box, generate. No app gets webhooks. The app’s spending limit is set on its page under Connected apps.

If you build an app that serves other people, sign each person in with OAuth rather than sharing one key: ImgSearch licenses files for the account holder’s own projects, as the website does.

Scopes #

Scope Allows On a key
search Search the catalogue, read asset cards, models and estimates Yes
download Download files, under the same fair use as the website Yes
generations:read List and read your generations and their files Yes
generations:write Rename, star, delete or cancel your generations, and run the free side actions Yes
account:read Read your balance, usage and limits Yes
generate Spend AI balance on generations Only when the key is made with spending allowed
webhooks Manage webhook endpoints and read the events feed Yes

An endpoint that needs a scope the credential lacks answers 403 insufficient_scope with details.required. The reference lists each operation’s scope.

Spending #

A new key may spend the account's AI balance (its plan allowance and top-ups) unless you untick that when you make it, on the website:

  1. When you make the key, "This key may spend your AI balance" is ticked, with a monthly limit in US dollars: $10 unless you change it, from $0.01 to $100. Untick it for a key that only searches and downloads.
  2. The first time, the website also asks you to confirm that you are 18 or older and that you have the rights to the pictures you upload. Each is asked once per account.
  3. The key then carries generate, and generations:read so it can follow what it starts and fetch the files. The keys page shows its limit and how much it spent this month, and lets you change the limit or stop and allow spending again.

Every paid call (POST /generations and POST /generations/{id}/upscale) also carries max_usd, the most the user allows that one call to cost, in US dollars. A higher price answers 409 price_above_max and charges nothing; a lower one is charged as it is.

Over the key’s limit a call answers 402 spend_cap_reached with details.limit (monthly or per_job), cap_usd, spent_usd and resets_at. The month is a calendar month in UTC, so it starts again on the 1st at 00:00 UTC. The count comes from the balance’s ledger: refunds give back to it, deleting a generation does not. GET /account shows the key’s monthly_cap_usd, spent_this_month_usd and resets_at.

A key made without spending has no generate scope, so its paid calls answer 403 insufficient_scope (details.required: ["generate"]); make a new key with spending allowed. A key whose spending you stopped answers 403 spending_not_enabled with details.settings_url. Either way, the price check (POST /generations/estimate) and every search’s estimate say can_generate: false, so your code can stop before it tries. Their reason names the first thing in the way: account checks (adult_confirmation_required, plan_required, insufficient_balance and others) come before spending_not_enabled.

Who can generate #

Generating needs a paid plan, or AI balance the account bought. Bought balance works without a plan; buying more needs a paid plan. A plan’s balance and gifts wait, on hold, while the account has no paid plan. Prices are the website’s, in US dollars: see account, balance and pricing.

GET /account answers can_generate and, when it is false, generate_blocked_reason. A price check (POST /generations/estimate) answers the same for one generation, before you spend anything.

Keeping keys safe #

  • Keep keys on servers and in environment variables (the examples read IMGSEARCH_API_KEY). Never put one in a web page, an app you ship, or a repository.
  • The API sends no CORS headers, so a web page on another site cannot call it with a key.
  • Keys have no fixed prefix, so secret scanners will not recognise one. Treat any key you pasted somewhere public as leaked and revoke it.
  • Make one key per app or machine, with only the scopes it needs, so you can revoke one without stopping the others.
  • Signed links (download links, generation files, previews) work without a key for 10 or 60 minutes, and only while the key that asked for them works: they stop when it is revoked or expires (a try-it key lasts 15 minutes).

Try it #

The API reference has a try-it panel on each operation that takes a key or none (signed links and the webhook have none). It calls the API from the page itself:

  • Public operations need no sign-in. The others need you to be signed in on the website, with an account the API lets in.
  • The panel uses a key made for this browser that lasts 15 minutes. The page never sees it: your browser holds only an encrypted handle that works on this site. It is not listed on the keys page, sends no mail, and signing out revokes it.
  • Its calls are your account’s own: they count in your limits and fair use like any key, a file you download counts as a download, and the history shows them as playground. They never count toward savings.
  • Spending is off. The switch "Allow spending in this session" asks for your password, a limit for this session in US dollars ($0.10 unless you change it, from $0.01 to $2), and, while missing, the 18+ and upload-rights confirmations. A paid call then needs max_usd within what the session has left, and the panel asks you to confirm the most it can cost.