惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
IT之家
IT之家
F
Full Disclosure
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
B
Blog
H
Help Net Security
The Cloudflare Blog
Recorded Future
Recorded Future
P
Proofpoint News Feed
P
Proofpoint News Feed
C
Cisco Blogs
T
Tailwind CSS Blog
P
Palo Alto Networks Blog
D
Docker
爱范儿
爱范儿
Know Your Adversary
Know Your Adversary
博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Y
Y Combinator Blog
雷峰网
雷峰网
AWS News Blog
AWS News Blog
D
DataBreaches.Net
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
Blog — PlanetScale
Blog — PlanetScale
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
阮一峰的网络日志
阮一峰的网络日志
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
小众软件
小众软件
G
Google Developers Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
O
OpenAI News

SerpApi

Decoding Protobuf Messages Without Access to the Schema Introducing SerpTrail: A self-hosted SEO and GEO rank tracker for your business Introducing SerpApi’s Hermes Agent Plugin Loop Engineering Visualized: A World Cup Fan Journey with SerpApi and Codex Google v. SerpApi: The Court Granted Our Motion to Dismiss SerpApi Weekly Changelog: July 13-19, 2026 The State of the SERP in the Age of AI What is an API? Part 2: Feeding the Machine (JSON) Building an Accessibility Search Experience with Google Flights, Hotels, and Maps APIs SerpApi Weekly Changelog: July 06-12, 2026 How to Scrape Google Flights Deals with a simple API Monitoring FIFA World Cup 2026 scores with a simple API How to scrape Google sports results Build Smarter Pydantic AI Agents with Real-Time Search A complete guide to web scraping with Ruby (2026) SerpApi Weekly Changelog: June 29- July 05, 2026 Make no mistakes: agent usability testing Semantic Image Search with Elasticsearch What is an API? Part 1: The Secret Life of a Web Browser MCP Apps with FastMCP: Turning Tool Output Into Interactive UI How to Scrape Naver AI Briefings with SerpApi Connect Sakana AI (Fugu) with Web Search API SerpApi Weekly Changelog: June 22-28, 2026 Trending Travel Destinations using Python & SerpApi How to scrape Bing reverse image search results Measuring Brand Presence Across AI Answer Engines SerpApi Weekly Changelog: June 15-21, 2026 How I Built a Star Wars Grogu Product Research Agent with Codex, Lark, and SerpApi How to scrape Bing web search results Categorizing hotels using Google Hotels images How to scrape Bing Images search results How to scrape Bing Copilot answers Build A No Code AI-Powered Local Lead Outreach System SerpApi Weekly Changelog: June 08-14, 2026 How to Do SEO Research with Claude Desktop and SerpApi MCP Track and Compare Product Prices Across Stores and Locations (SerpApi & Python) How to Extract Full Opinion Text from Google Scholar Case Law with SerpApi How to scrape Bing Maps search results SerpApi Weekly Changelog: June 01-07, 2026 Amazon ASIN Lookup API: Find and Fetch Product Details The State of MCP: Everything That Changed in H1 2026 How to scrape Bing News search results How to Connect Your Local LLM with Web Search Data SerpApi on Postman: One Unified Collection for Faster API Exploration SerpApi Weekly Changelog: May 25-31, 2026 Building an AI Agent in Python How to scrape Google Case Law API for Legal Research, Analytics, AI, and more SerpApi Achieves SOC 2 Type 2 and ISO 27001 Certification How to find your next product idea with Google Trends and SerpApi Scrape Competitors' Google Ads Data (Tutorial 2026) Using SerpApi and DeepSeek to Break Down Dan Koe’s Content Strategy SerpApi Weekly Changelog: May 18-24, 2026 How to scrape Bing Videos search results How to Scrape Instagram Profile Data with SerpApi How to scrape Bing Shopping search results How to Scrape Google Hotels Reviews SerpApi Weekly Changelog: May 11-17, 2026 5 Things You Can Build with Claude Code and Live Search Data Real Estate Data API for PropTech Developers How to Scrape Apple Maps with SerpApi How to scrape Google Trends
How to find the Google Knowledge Graph ID (kgmid) for anything
Corbin Davenport · 2026-07-16 · via SerpApi

When you search for a person, place, movie, TV show, city, or other topic with Google Search, you might get a card the top of the page with organized details. For movie searches, the card might contain ratings, where to watch it, the release date, the genre, and other information. That's called the Knowledge Graph, and under the hood, it's powered by the Knowledge Graph ID (kgmid) database.

Every person, place, or thing that Google can identify has a Knowledge Graph ID. It's a bit like ISBN numbers for books or ISMN numbers for music releases, but not restricted to any certain category, and (usually) not something a person would ever directly read.

Google search for Canada, with pictures, a "Country in North America" label, the capital, and other information at the top of the page.
The country of Canada has a Knowledge Graph with an ID of /m/0d060g.

These IDs help Google organize different topics, even if they have similar or identical names. Apple the fruit has a different ID than Apple the tech company. The name "Superman" matches the comic book character, the 1978 film with Christopher Reeve, the 2025 film with David Corenswet, the song by Eminem, and the theme song for Scrubs by Lazlo Bane, but they all have different IDs.

If you have the Knowledge Graph ID for a given topic, you can use it to look up all available details for that topic using SerpApi's Google APIs, Google's enterprise cloud APIs (which also use Machine IDs in addition to Graph IDs), and other services. For example, once you know the Knowledge Graph ID for a football team, you can check its current and upcoming games on a regular basis with the SerpApi Google Sports Results API.

How to find the Knowledge Graph ID (kgmid)

There are a few ways to find the Knowledge Graph ID for a given person, place, or thing.

The first option for finding a Knowledge Graph ID is from Google's own search results. If a card (or just the title) appears for a search result, click the three-dot menu next to the title, then click the Share menu option.

This will give you a share.google URL, which is a shortlink that redirects to the full URL containing the Knowledge Graph ID. You need to open that link in your web browser, and then the ID will be in the address bar as the text between kgmid= and & strings, like /m/05qtj in this example:

https://www.google.com/search?kgmid=/m/05qtj&hl=en-US&q=Paris&she...

The ID might be in URL-encoded format, like %2Fm%2F04jpl in this example:

https://www.google.com/search?kgmid=%2Fm%2F04jpl&hl=en-US&q=London&she...

For those encoded strings, a URL decode tool can give you the original form, or you can run decodeURIComponent("put-the-id-here") in your browser's JavaScript console.

You can also fetch the share.google link with cURL, set it to follow the first redirect, and look for the kgmid parameter in the final location:

curl -iL --max-redirs 1 https://share.google/examplelink

Some pages on Google Search can have two Knowledge Graph IDs. For example, if you search for "recent nfl games" and click the "See more" button with the arrow icon, it opens a new page using data from two Knowledge Graph topics.

Screenshot of recent NFL games on Google
The full page for recent NFL games on Google.

These pages will have the Knowledge Graph IDs in the #sie section of the URL, instead of a kgmid parameter:

https://www.google.com/search?q=recent+nfl+games&sca_esv=b3f...&sclient=gws-wiz-serp#sie=lg;/g/11lyp42zk1;6;/m/059yj;mt;fp;1;;;;-1

In this example, the first ID is /g/11lyp42zk1 and represents the 2025 NFL season, while the second ID is /m/059yj and represents the NFL organization. If you're not sure which ID is for which topic, read the section on checking IDs.

For league/tournament pages, the first ID is the current season, and the second ID is the league. For sports teams, the first ID is the team, and the second is the current league/tournament season. For sports games, the first ID is the individual game, and the second ID is the league.

Find the ID with Wikidata

Wikidata is a collaborative knowledge database with over 100 million items, and each item usually includes a linked Google Knowledge Graph ID. Wikidata is one of the main information sources for Google's Knowledge Graph services, and some of its data originated from the Google-owned Freebase, which shut down in 2015.

You can start a search on Wikidata to check if a matching result is available. The number in parentheses for each item is the Wikidata number, not a Knowledge Graph ID.

Screenshot of Wikidata
Wikidata search for "London."

From the search results, select the page for the topic you want, and look for either a "Google Knowledge Graph ID" or "Freebase ID" on the page.

Wikidata screenshot
London has a Freebase ID of /m/04jpl.
Wikidata screenshot
The 2026 FIFA World Cup has a Google Knowledge Graph ID of /g/1pznmpnqh.

You can also use the Wikidata Query Service to programmatically fetch the IDs for a given topic or item.

Find the ID with SerpApi

Finally, you can use the Google Search Engine Results API from SerpApi to obtain a Knowledge Graph ID from a text search. If you don't have one already, you need to create an account and verify your email and other details. After that, get the API key from your account dashboard.

First, if you perform a search with the SerpApi Playground in your web browser, the JSON results include kgmid values. They might be under the knowledge_graph object.

Playground screenshot for a Google Search for Paris.
SerpApi Playground will show any kgmid values in the JSON preview.

For sports-related topics, the values can be in the sports_results object. The query "recent NFL games" in Playground includes an ID for each team, game, and stadium/location.

Playground screenshot for a Google Search for recent NFL games.
More kgmid and venue_kgmid values in the SerpApi Playground.

You can also programmatically fetch the main kgmid value for a search, using any of SerpApi's official integrations. Here's how to find the kgmid for London using simple GET request, combined with the JSON Restrictor feature:

https://serpapi.com/search.json?engine=google&q=london&gl=us&json_restrictor=knowledge_graph.kgmid&api_key=YOUR_KEY_GOES_HERE

Here's the same search in a Python script, using the official SerpApi Python library:

import serpapi
client = serpapi.Client(api_key=YOUR_KEY_GOES_HERE)

response = client.search({
  "engine": "google",
  "q": "london"
})

if response.get("knowledge_graph", {}).get("kgmid", {}):
  print(f"Found ID: {response['knowledge_graph']['kgmid']}")
else:
  print("No ID found!")

This is the search in Ruby, with the official Ruby gem installed:

require "serpapi"

response = SerpApi::Client.new(
  engine: "google",
  q: "london",
  api_key: YOUR_KEY_GOES_HERE
)

if response.search.dig(:knowledge_graph, :kgmid)
  puts "Found ID: #{response.search[:knowledge_graph][:kgmid]}"
else
  puts "No ID found!"
end

Finally, here's the search in Node.js with the SerpApi JavaScript library:

import { getJson } from 'serpapi';

const search = await getJson({
  engine: "google",
  q: "london",
  api_key: YOUR_KEY_GOES_HERE
});

if (search?.knowledge_graph?.kgmid) {
  console.log(`Found ID: ${search.knowledge_graph.kgmid}`);
} else {
  console.log("No ID found!")
}

You can also make API requests with SerpApi with Make.comN8N, and other low-code tools. If you need help, please contact us.

How to check a Knowledge Graph ID

If you already have a Knowledge Graph ID and you need to check what it represents, there are a few ways to do that.

First, you can try using it in a Google Search by placing the kgmid in the URL, like this ID for New York City:

https://www.google.com/search?kgmid=/m/02_286

The resulting search page should contain a Knowledge Graph card. The text in the search bar will also be filled by the topic's title.

Google search results for New York City.
A Google web search using a kgmid value instead of a q text search.

That method doesn't always work, but you can also try searching the ID on the Wikidata website, Wikidata Query Service, or Google Knowledge Graph Search API. For sports topics, try the Google Sports API Playground from SerpApi.