websearch.fast
ConsoleGet a key

Search by image

Pages that show the same or a similar image.

Finds pages that show the same or a similar image, and names what the image shows when that is known. Send a public http(s) URL of a JPEG, PNG, WebP or GIF of at most 10 MB, or a data:image/...;base64, URL of at most 5 MB.

What is charged

Charged when at least one result comes back. An image that cannot be loaded or decoded returns 400 invalid_image and is free.

Units: lens. usage.items in the response lists them.

Request

POST https://api.websearch.fast/v1/web/lens

Planned. Until it ships, calls return 501 api_not_implemented.

Body

NameTypeDescription
image_urlrequiredstringPublic http(s) URL (JPEG, PNG, WebP, GIF, at most 10 MB) or data:image URL (at most 5 MB).
qstringAt most 256 characters.
countrystringISO 3166-1 alpha-2 country code, case-insensitive.
languagestringBCP 47 language tag. At most 12 characters.
numinteger1 to 50. Default 20.

Example request

curl https://api.websearch.fast/v1/web/lens \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://images.example.com/products/kettle-k2.jpg",
    "num": 10
  }'
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/lens",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "image_url": "https://images.example.com/products/kettle-k2.jpg",
        "num": 10,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.websearch.fast/v1/web/lens", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    image_url: "https://images.example.com/products/kettle-k2.jpg",
    num: 10,
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());

Response fields

Matches.

NameTypeDescription
objectrequiredstringAlways web.lens.
request_idrequiredstringSame as the X-Request-Id header.
createdrequiredintegerUnix seconds (UTC).
inputrequiredobjectThe parameters as applied, defaults filled in.
usagerequiredobject
Show fields
NameTypeDescription
chargedrequiredboolean
itemsrequiredarray of object
Show fields
NameTypeDescription
unitrequiredstringBillable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge.
countrequiredinteger
cacheobject
Show fields
NameTypeDescription
hitrequiredbooleanThe response, or every page in it, came from a stored copy.
data_age_secondsrequiredintegerAge of the oldest part of the response.
fetched_atrequiredintegerUnix seconds when the oldest part was read.
warningsarray of object
Show fields
NameTypeDescription
coderequiredstringFor example no_results, content_partial, answer_unavailable, partial, all_failed, reach_reduced.
messagestring
paramstring
resultsrequiredarray of object
Show fields
NameTypeDescription
positionrequiredinteger1-based rank across pages. At least 1.
titlerequiredstring
urlrequiredstringReal destination URL, never a redirect link.
domainrequiredstringHost of url, lowercase, without www.
snippetstringAt most 400 characters.
published_atstringISO 8601 UTC, when known.
site_namestringThe publisher's own name, when known.
originrequiredstringOur neutral label of how the result reached you. New values can appear. One of index, live, open_data.
image_urlstring
thumbnail_urlstring
priceobject
Show fields
NameTypeDescription
amountnumber
currencystringISO 4217.
textrequiredstring
entitiesarray of object
Show fields
NameTypeDescription
namerequiredstring
kindstring

Errors

StatusCodes
400invalid_request, invalid_url, invalid_schema or invalid_image. Not charged.
401invalid_token. Not charged.
403pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged.
404not_found or invalid_endpoint. Not charged.
413read_request_body_failed: the request body is over the limit. Not charged.
429rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged.
500internal_error. Not charged.
501api_not_implemented: the endpoint, type or option has not shipped. Not charged.
503source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged.
504timeout. Not charged.