Every Trends API POST returns an envelope: {"statusCode": int, "body": string}. Official docs and https://trendsapi.ai/llms.txt state that first. statusCode is the job code. body is JSON text, not an object with results already on it. Parse body before reading points, source_results, or data. The second parse is on parse the body. The URL is POST https://api.trendsapi.ai/api.
statusCode and body
{"statusCode": 200, "body": "[{\"date\":\"2026-08-22\",\"value\":35,...}]"}
statusCode 200 is a completed call. Official usage notes say only successful 200 responses count against the monthly quota. Current caps sit on pricing. This page does not restate a number.
Do not read body.results on the envelope. body is a string until the second parse.
What body contains per mode
mode |
Inner JSON |
|---|---|
get_time_series |
Array of points |
get_trends |
Same array (REST alias) |
get_growth |
Object (results or source_results) |
get_top_trends |
Object (as_of_ts, data) |
Live examples of those inner objects sit on get_time_series, get_growth, and get_top_trends.
200 with an inner error
A multi-source growth call can return statusCode 200 while one results item is date_out_of_range. That is a usable envelope. Log the inner message. Do not retry the whole POST as if the key failed.
401 (missing Bearer) and 429 (rate_limited) are not "empty charts." They are on errors. Auth header shape is on authentication.