Skip to content
Plumb
Light theme onCheck a URL

DocsSearch Appearance

Knowledge Graph

Search Google's Knowledge Graph for the entities behind a name, with each entity's machine ID (MREID), types and relevance score.
  • Up to 20 queries
  • Filter by type and language
  • Knowledge Graph Search API

What it Checks

Each query goes to Google's Knowledge Graph Search API, which returns the entities Google knows by that name: people, organisations, places, works and more. For each entity you get its name, Schema.org types, short and detailed descriptions, official URL, image, machine ID and the score the API gives it for your query.

The machine ID (/m/… for older Freebase entities, /g/… for newer ones) is what identifies an entity across Google. It tells you whether your brand or person exists as an entity, and lets you open its knowledge panel directly.

Run a Test

  1. Enter one query per line, such as a person's name, a company or a place. A machine ID on its own line (/m/0dl567, /g/11b6…) looks that entity up directly.
  2. Optionally narrow the search by entity type or language, and set how many results each query returns.
  3. Press Search. The result opens with the count, for example 14 entities found for 2 queries., and the best match for each query.
Open Knowledge Graph Search

Options

  • Entity type. Restricts results to one Schema.org type, such as Person, Organization, LocalBusiness, Place, Event, Movie or SportsTeam. Any returns every type.
  • Language. The language of names and descriptions, as an ISO code (en, de…). Any lets the API choose.
  • Results per query. 1 to 500, 20 by default. The API rarely has more than a few dozen good matches for a name.

Reading the Result

  • Best match per query: the highest-scoring entity of each query, with its description and MREID. No entity lists the queries that returned nothing, Failed the queries the API refused or didn't answer.
  • Entities: every entity returned, with query, name, types, description, MREID (with a copy button), score and URL. The table can be searched, sorted and exported as CSV or Excel.
  • Open a row for the image, the detailed description and its source (usually Wikipedia), and a link that opens the entity's knowledge panel in Google (google.com/search?kgmid=…).

Score is the API's relevance of the entity to that query. It compares entities within one query; it is not a measure of how important the entity is in general, and scores from different queries can't be compared.

Good to Know

  • The tool needs GOOGLE_KG_API_KEY on the server: a free key from Google Cloud with the Knowledge Graph Search API enabled (100,000 calls a day by default). Without it, the tool says so above the input, with the steps to create one, and searches answer with the same explanation. A refused key (invalid, API not enabled) or a used-up quota stops the whole search with Google's reason.
  • Repeated lines are searched once; lines after the 20th are ignored. The type Thing, which every entity has, is left out of the types.

API

POST /api/knowledge-graph

Send the queries as one string, one per line. type (a Schema.org type, or Any), language and limit (results per query, 1 to 500, default 20) are optional. The response is a flat list of entities, each tagged with its query, plus errors (queries that failed while others worked) and the limit used. When every query fails, or the key is missing or refused, the answer is an HTTP 400 with an error message.

Request
curl -X POST https://plumb.reacthive.dev/api/knowledge-graph \
  -H "content-type: application/json" \
  -d '{
    "queries": "Taylor Swift",
    "type": "Person",
    "language": "en",
    "limit": 5
  }'
Response (Trimmed)
{
  "rows": [
    {
      "query": "Taylor Swift",
      "name": "Taylor Swift",
      "types": "Person",
      "description": "American singer-songwriter",
      "detailed": "Taylor Alison Swift is an American singer-songwriter…",
      "source": "https://en.wikipedia.org/wiki/Taylor_Swift",
      "url": "http://www.taylorswift.com/",
      "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:…",
      "mreid": "/m/0dl567",
      "score": 5631.47,
      "searchUrl": "https://www.google.com/search?kgmid=%2Fm%2F0dl567"
    }
  ],
  "errors": [],
  "limit": 5
}
Response Without a Key (HTTP 400)
{
  "error": "Knowledge Graph lookups are off: the server has no GOOGLE_KG_API_KEY. Add a Google Cloud API key with the Knowledge Graph Search API enabled to .env.local and restart the server (see .env.example)."
}