A Jupyter cell talks to Trends API the same way a script does: POST https://api.trendsapi.ai/api with a Bearer key. The envelope body is a JSON string and must be parsed a second time unless the official SDK already decoded it. This page is the interactive loop. A scheduled DataFrame job is on pandas ETL. Fields: the API reference. Caps: pricing.

The key is not a cell literal

import os, json, getpass
import requests

key = os.environ.get("TRENDSAPI_API_KEY") or getpass.getpass("Trends API key")
resp = requests.post(
    "https://api.trendsapi.ai/api",
    headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
    json={"mode": "get_time_series", "source": "google search", "keyword": "bitcoin"},
    timeout=60,
)
resp.raise_for_status()
points = json.loads(resp.json()["body"])

getpass keeps the token out of the input history that a shared notebook would show. Official docs say not to ship the key in frontend code or a public repo. A .ipynb in git is a public repo. Strip outputs before commit.

pip install trendsapi skips the second loads. Raw requests must not. That split is on parse the body.

Plot the array, not the envelope

import matplotlib.pyplot as plt
xs = [p["date"] for p in points]
ys = [p["value"] for p in points]
plt.plot(xs, ys)

value is 0-100. 100 is the peak of that series. A growth cell is a different mode. Request shape for the line is on get_time_series.

Do not print headers or key in the next cell. Kernel restart clears getpass. It does not unsaved a committed notebook.

Notebook versus pipeline

Restart and run all should rebuild the chart from the POST. A pipeline writes parquet or BigQuery and does not keep a UI session. Move that job to pandas ETL or cron when the cell starts needing retries and a lockfile.