A Roc job talks to Trends API with one POST to https://api.trendsapi.ai/api, a Bearer key, and a JSON body that names a mode. There is no official Roc library. basic-cli Http.send_json! sends the request. Http.decode_json_response reads JSON. The first decode reads the envelope, then a second decode reads the body string. Pulled on 2026-11-16, Google Search for roc lang scored 35.0 for the week of 2026-11-14, versus 27.0, up 29.63%. roc programming scored 5.0 versus 6.0, down 16.67%. roc language scored 6.0 versus 5.0, up 20.0%. YouTube for roc lang scored 100.0 versus 71.0, up 40.85%. Do not copy roc lang 35.0 onto a Roc adoption alert that only watches the phrase token at 5.0. Neighbors in the same session still sat on 2026-11-07, so do not join php 25.0 onto roc lang 35.0 as the same week.
How does a Roc client POST get_growth?
The documented HTTP helpers live in basic-cli. Request.from_method(POST) builds the request. Http.send_json! encodes the payload and sends it. Env.var_str! reads the key. Http.decode_json_response turns the response body into a Roc value.
POST https://api.trendsapi.ai/api
Authorization: Bearer <api_key>
Content-Type: application/json
{"mode":"get_growth","source":"google search","keyword":"roc lang","percent_growth":["7D","30D","3M","12M"]}
app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.28.1/placeholder.tar.zst" }
import pf.Http
import pf.Env
import pf.Stdout
Envelope : { statusCode : I64, body : Str }
GrowthBody : {
mode : Str,
source : Str,
keyword : Str,
percent_growth : List(Str),
}
main! = |_args| {
api_key = Env.var_str!("TRENDSAPI_API_KEY")?
payload : GrowthBody = {
mode: "get_growth",
source: "google search",
keyword: "roc lang",
percent_growth: ["7D", "30D", "3M", "12M"],
}
request =
Request.from_method(POST)
.with_uri("https://api.trendsapi.ai/api")
.with_header("Authorization", "Bearer ${api_key}")
.with_header("Content-Type", "application/json")
response = Http.send_json!(request, payload, {})?
if response.status() != 200 {
return Err(UnexpectedStatus(response.status()))
}
envelope : Envelope = Http.decode_json_response(response)?
inner = Decode.from_bytes(Str.to_utf8(envelope.body), Json.utf8)?
Stdout.line!(Inspect.to_str(inner))
}
Package names and docs belong next to the code, not in prose as live links:
https://roc-lang.github.io/basic-cli/main/Http/
https://roc-lang.github.io/basic-cli/main/Env/
https://github.com/roc-lang/basic-cli
https://www.roc-lang.org
Every successful response is {"statusCode": int, "body": string}. Http.decode_json_response is the first parse. envelope.body is still a string. Decode.from_bytes on that string is the second parse. Skipping it leaves recent_value unreachable. Docs for the envelope sit at https://trendsapi.ai/docs. Google Search series docs sit at https://trendsapi.ai/trends/google-trends.
What did roc lang Search print against the phrase tokens?
roc lang Search closed at 35.0 versus 27.0 on the 2026-11-14 tip, matching the series close of 35.0. Adjacent weeks were 27.0, then 0.0, then 0.0, then 54.0. 14D compared 35.0 versus 0.0 and printed growth 999999.0 because the 2026-10-31 baseline was a zero floor. 30D was 35.0 versus 54.0, down 35.19%. 3M was 35.0 versus 52.0, down 32.69%. 12M was 35.0 versus 62.0, down 43.55%. YTD compared 35.0 versus 0.0 and printed growth 999999.0. Peak was 100.0 on 2024-12-07, then 99.0 on 2024-10-19, 93.0 on 2025-12-20, and 88.0 on 2026-05-16. Tip 35.0 is not a new high.
roc programming Search closed at 5.0 versus 6.0, down 16.67%, matching the series close of 5.0. Adjacent weeks were 6.0, then 0.0, then 0.0, then 0.0. 14D, 30D, 3M, 12M, and YTD each compared 5.0 versus 0.0 and printed growth 999999.0. Peak was 100.0 on 2026-05-16, then 92.0 on 2026-06-13, 82.0 on 2026-05-30, 81.0 on 2026-06-06, 78.0 on 2026-06-20, 74.0 on 2026-09-26, and 68.0 on 2026-04-18. On 2026-05-16, the week the phrase printed 100.0, roc lang printed 88.0. Opposite 7D signs are not matching series. A helper that only stores 7D then reports 5.0 and misses the May 100.0.
roc language Search closed at 6.0 versus 5.0, up 20.0%, matching the series close of 6.0. Adjacent weeks were 5.0, then 9.0, then 10.0, then 0.0. 14D was 6.0 versus 9.0, down 33.33%. 30D compared 6.0 versus 0.0 and printed growth 999999.0. 3M was 6.0 versus 37.0, down 83.78%. 12M was 6.0 versus 39.0, down 84.62%. YTD was 6.0 versus 29.0, down 79.31%. Peak was 100.0 on 2026-06-13, then 93.0 on 2026-05-16, and 84.0 on 2026-03-28. On 2026-06-13 language printed 100.0 while programming printed 92.0 and roc lang printed 69.0. Opposite weeks are not matching series.
roc compiler Search closed at 0.0 versus 0.0 on every window, data_quality low. There is no Roc package-registry download-count source on Trends API. Do not join a missing registry row onto roc lang 35.0.
| Keyword | 7D close | 7D baseline | 7D growth | Tip Saturday |
|---|---|---|---|---|
| roc lang | 35.0 | 27.0 | +29.63% | 2026-11-14 |
| roc language | 6.0 | 5.0 | +20.0% | 2026-11-14 |
| roc programming | 5.0 | 6.0 | -16.67% | 2026-11-14 |
| roc compiler | 0.0 | 0.0 | 0.0% | 2026-11-14 |
| gleam programming | 11.0 | 9.0 | +22.22% | 2026-11-07 |
| zig programming | 15.0 | 17.0 | -11.76% | 2026-11-07 |
| hare programming | 8.0 | 7.0 | +14.29% | 2026-11-07 |
| php | 25.0 | 38.0 | -34.21% | 2026-11-07 |
php volume on that 2026-11-07 tip was 556000 versus 844000. gleam, zig, hare, and php had not rolled to 2026-11-14 when roc lang had. Store recent_date per keyword. The Gleam client pattern is at https://trendsapi.ai/gleam-trends-api.
Did YouTube, News, and Wikipedia agree with Search?
YouTube for roc lang closed at 100.0 versus 71.0, up 40.85%, matching the series close of 100.0 on the 2026-11-14 tip, data_quality low. Adjacent weeks were 71.0, then 0.0, then 0.0, then 0.0. 14D, 30D, 3M, 12M, and YTD each compared 100.0 versus 0.0 and printed growth 999999.0. Peak was 100.0 on 2026-11-14, then 71.0 on 2026-11-07. Tip 100.0 is a new high. The series has two non-zero weeks. Same 7D sign as Search roc lang (+29.63% versus +40.85%), different magnitude, and Search peak year 2024 versus YouTube peak week 2026-11-14. YouTube for roc programming closed at 0.0 versus 0.0 on every window, data_quality low. Do not copy YouTube 100.0 onto a helper that only stores the phrase token at 0.0.
Google News for roc programming closed at 0.0 versus 0.0 on every window, data_quality low. Google News for roc lang also closed at 0.0 versus 0.0 on 7D, 14D, and 30D, data_quality low. Absence of News coverage is a finding. Do not treat 0.0 as a timeout to hide.
Wikipedia title Roc (programming language) returned 404 no_data. Bare title Roc resolved October 0.5 / 1171 views versus September 0.7 / 1219 (volume -3.94%). 3M was 0.5 / 1171 versus July 1.3 / 1328 (volume -11.82%). That title is not the language page. Neighbor titles in the same session: Elm (programming language) October 12.2 / 2498 versus September 0.0 / 2071 (volume +20.62%); Zig (programming language) October 40.2 / 13533 versus September 29.0 / 10554 (volume +28.23%); Gleam (programming language) October 48.1 / 3005 versus September 52.4 / 3127 (volume -3.9%). The language Wikipedia title at 404 is the finding. Search roc lang 35.0 is not Wikipedia Roc 1171.
A live-rank check on a different query, such as https://trendsapi.ai/blog/susan-collins-live-rank-vs-weekly-search, still needs get_top_trends with no keyword. Add that call to the same helper rather than inferring rank from get_growth.
How should the helper store the Saturday tip?
Call sources one at a time. Multi-source get_growth can 504. Retry a 502 source_unavailable once and store the miss if the retry still returns 0.0. Keep recent_date on every row. roc lang Search, YouTube, and News tipped 2026-11-14 in this session. gleam programming, zig programming, hare programming, and php tipped 2026-11-07. Two Saturday tips in one run means two calendars.
Store the exact keyword string. roc lang 35.0 is not roc programming 5.0 is not roc language 6.0 is not roc compiler 0.0. A 14D growth of 999999.0 off a 0.0 floor is not a 7D rise of 29.63%. A YouTube peak of 100.0 on 2026-11-14 is not a Search peak of 100.0 on 2024-12-07. Wikipedia title Roc at 1171 October views is not the missing language page. There is no Roc package-registry source to join onto any of those rows.