websearch.fast
ConsoleGet a key

Knowledge

The knowledge panel of one entity.

Returns the encyclopedia card of one person, place, organization or thing: its name, a short label, a short description with the article it comes from, its website and key facts. The same card comes with page 1 of a web search as knowledge_panel; this endpoint is for a caller that wants only the card.

q is the name of the entity, at most 256 bytes and 200 characters; runs of spaces become one space. language is detected from q when it is not sent.

panel has title always, and type, description, description_url, description_site_name, website and attributes (at most 30 facts as {name: value}, in a stable order) when they are known. attribution lists the open data sets the card comes from; show it with the card, and link to description_url when you show the description. There is no image. When no entity matches, panel is absent and the warning is no_results.

What is charged

One knowledge unit when a card comes back. No card (warning no_results) is free, as is every error.

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

Request

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

Body

NameTypeDescription
qrequiredstringThe name of the entity, at most 200 characters. Runs of spaces become one space. 1 to 256 characters.
languagestringBCP 47 language tag. Detected from q when absent. At most 12 characters.

Example request

curl https://api.websearch.fast/v1/web/knowledge \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "Marie Curie"}'
import os
import httpx

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

Example response

{
  "object": "web.knowledge",
  "request_id": "20261128120000323456789a1b2c3d4Kx7Qm2Pa",
  "created": 1795867200,
  "input": {"q": "Marie Curie"},
  "panel": {
    "title": "Marie Curie",
    "type": "Physicist",
    "description": "Marie Curie was a Polish and naturalised French physicist and chemist.",
    "description_url": "https://encyclopedia.example.org/wiki/Marie_Curie",
    "description_site_name": "Example Encyclopedia",
    "attributes": {
      "Born": "7 November 1867, Warsaw",
      "Died": "4 July 1934"
    },
    "attribution": [
      {
        "source": "Open encyclopedic data",
        "url": "https://encyclopedia.example.org/wiki/Marie_Curie",
        "license": "CC BY-SA 4.0"
      }
    ]
  },
  "usage": {"charged": true, "items": [{"unit": "knowledge", "count": 1}]}
}

Response fields

The card, or no panel with the warning no_results.

NameTypeDescription
objectrequiredstringAlways web.knowledge.
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
warningsarray of object
Show fields
NameTypeDescription
coderequiredstringFor example no_results, content_partial, answer_unavailable, partial, all_failed, reach_reduced.
messagestring
paramstring
panelobjectAn encyclopedia card from open data. In a search it comes only on page 1 of a search with results and is included in the search price.
Show fields
NameTypeDescription
titlerequiredstring
typestringShort label, for example Physicist or City.
descriptionstringA short text from the encyclopedia article.
description_urlstringThe article the description comes from.
description_site_namestringName of the encyclopedia, with description_url.
websitestringOfficial website of the entity.
attributesobjectKey facts as name: value, in a stable order.
attributionrequiredarray of objectThe open data projects the data comes from, with their licences. Show it with the data.
Show fields
NameTypeDescription
sourcerequiredstringName of the open data set the fact comes from.
urlrequiredstring
licenserequiredstringFor example CC BY-SA 4.0 or CC0 1.0.

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.
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.