SerpBase
Back to Blog

Google Trends Category Filter API: Tell Apple the Fruit from Apple the Brand

Pass a Google Trends category ID as cat to count interest only within that category. apple in all categories, Food & Drink and Computers & Electronics compared.

November 30, 2026
By SerpBase Team2 min read

Short answer: add a Google Trends category ID as cat to a /google/trends request. Interest is then counted only among searches in that category, so an ambiguous word such as "apple" can be read as the fruit ("cat":"71", Food & Drink) or the company ("cat":"5", Computers & Electronics).

The request

curl -X POST 'https://api.serpbase.dev/google/trends' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"q":"apple","geo":"US","cat":"71"}'

cat takes the number Google Trends shows in its own URL when you pick a category (&cat=71). Leave it out for all categories.

What changed in our test

We asked for "apple" in the US over the past 12 months three times on 1 December 2026. Each answer had 53 weekly points:

catAverage of the 53 weeksPeak week (value 100)
none (all categories)74.85 April 2026
71 Food & Drink37.622 November 2026
5 Computers & Electronics66.86 September 2026

The three series are clearly different searches. Food & Drink peaks in Thanksgiving week and averages well under half its peak the rest of the time; Computers & Electronics peaks in early September, around Apple's autumn product launches. Without a category the two are mixed together.

The response has the same shape with or without cat:

{
  "status": 0,
  "credits_charged": 2,
  "trends": {
    "query": "apple",
    "geo": "US",
    "time_range": "today 12-m",
    "series": [
      {
        "term": "apple",
        "points": [
          {"timestamp": "2025-11-30T00:00:00Z", "value": 36},
          {"timestamp": "2025-12-07T00:00:00Z", "value": 35}
        ]
      }
    ]
  }
}

Python: the same term in two categories

import requests

def weekly(q, cat=None, geo="US"):
    body = {"q": q, "geo": geo}
    if cat:
        body["cat"] = cat
    r = requests.post("https://api.serpbase.dev/google/trends",
                      headers={"X-API-Key": "YOUR_API_KEY"},
                      json=body, timeout=60).json()
    if r["status"] != 0:
        raise RuntimeError(r.get("error"))
    return r["trends"]["series"][0]["points"]

for cat in (None, "71", "5"):
    pts = weekly("apple", cat)
    peak = max(pts, key=lambda p: p["value"])
    print(cat or "all", peak["timestamp"][:10])

Things that trip people up

  • The response does not repeat the category. trends carries query, geo and time_range but not cat, so store the category next to the data yourself.
  • Send the ID, not the name. Copy it from the Trends website URL after choosing a category there.
  • Each series is scaled on its own. A 37.6 average in Food & Drink is not "half the searches" of the all-categories 74.8; both are 0–100 within their own request.
  • A topic is the other way to disambiguate. Trends topics ("Apple Inc." as a company) count every spelling of the entity; see topic IDs.

Related

Cost and docs

Each Trends request costs 2 credits, with or without a category. Failed requests are not charged, and new accounts get 500 free credits.