An OCaml 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 OCaml library. Cohttp_lwt_unix.Client sends the request. Yojson parses the envelope, then parses the body string a second time. Pulled on 2026-09-22, Google Search for ocaml programming scored 30.0 for the week of 2026-09-19, up 20.0% from 25.0. ocaml language scored 37.0, down 46.38% from 69.0. YouTube for ocaml programming scored 18.0, up 63.64% from 11.0. Do not treat ocaml compiler Search 30.0, up 100.0% from 15.0, as language adoption. Do not treat opam 73.0, down 17.05% from 88.0, as language adoption. The same helper that stores those rows also pulls a live Google Trends board; a rank-22 token that weekly Search printed at 86.0 versus 40.0 is documented in five guys live rank versus weekly Search.
How does an OCaml client call Trends API?
POST https://api.trendsapi.ai/api
Authorization: Bearer <api_key>
Content-Type: application/json
{"mode":"get_growth","source":"google search","keyword":"ocaml programming","percent_growth":["7D","30D","3M","12M"]}
open Lwt.Infix
let trends_post payload =
let uri = Uri.of_string "https://api.trendsapi.ai/api" in
let headers =
Cohttp.Header.of_list
[
("Authorization", "Bearer " ^ Sys.getenv "TRENDSAPI_API_KEY");
("Content-Type", "application/json");
]
in
let body = Cohttp_lwt.Body.of_string payload in
Cohttp_lwt_unix.Client.post ~headers ~body uri >>= fun (_resp, body) ->
Cohttp_lwt.Body.to_string body >>= fun text ->
let envelope = Yojson.Safe.from_string text in
(* body is a JSON string; parse it a second time *)
let inner =
envelope |> Yojson.Safe.Util.member "body" |> Yojson.Safe.Util.to_string
in
Lwt.return (Yojson.Safe.from_string inner)
let () =
let payload =
{|{"mode":"get_growth","source":"google search","keyword":"ocaml programming","percent_growth":["7D","30D","3M","12M"]}|}
in
let parsed = Lwt_main.run (trends_post payload) in
print_endline (Yojson.Safe.to_string parsed)
Cohttp_lwt_unix.Client.post and Yojson.Safe.from_string are the HTTP and JSON packages used here. Package docs live at:
https://ocaml.org/p/cohttp-lwt-unix/latest
https://ocaml.org/p/yojson/latest
The response envelope is {"statusCode": int, "body": string}. body is a JSON string and must be parsed a second time before reading recent_value. A Zig client that does the same double parse with std.http.Client is on Zig Trends API. A Python client is on Python Trends API.
What did get_growth return for OCaml language tokens?
get_growth for ocaml programming on google search tips on 2026-09-19. Store the exact strings. Bare ocaml is a different series. The compiler token and the language phrase closed at the same 30.0 and different 7D percents.
| Keyword | Period | Recent date | Recent | Baseline date | Baseline | Growth |
|---|---|---|---|---|---|---|
| ocaml programming | 7D | 2026-09-19 | 30.0 | 2026-09-12 | 25.0 | +20.0% |
| ocaml programming | 14D | 2026-09-19 | 30.0 | 2026-09-05 | 57.0 | -47.37% |
| ocaml programming | 30D | 2026-09-19 | 30.0 | 2026-08-22 | 43.0 | -30.23% |
| ocaml programming | 3M | 2026-09-19 | 30.0 | 2026-06-20 | 47.0 | -36.17% |
| ocaml programming | 12M | 2026-09-19 | 30.0 | 2025-09-20 | 39.0 | -23.08% |
| ocaml programming | YTD | 2026-09-19 | 30.0 | 2026-01-03 | 31.0 | -3.23% |
| ocaml language | 7D | 2026-09-19 | 37.0 | 2026-09-12 | 69.0 | -46.38% |
| ocaml language | 14D | 2026-09-19 | 37.0 | 2026-09-05 | 62.0 | -40.32% |
| ocaml language | 3M | 2026-09-19 | 37.0 | 2026-06-20 | 43.0 | -13.95% |
| ocaml language | YTD | 2026-09-19 | 37.0 | 2026-01-03 | 41.0 | -9.76% |
| ocaml | 7D | 2026-09-19 | 45.0 | 2026-09-12 | 53.0 | -15.09% |
| ocaml | YTD | 2026-09-19 | 45.0 | 2026-01-03 | 21.0 | +114.29% |
| opam | 7D | 2026-09-19 | 73.0 | 2026-09-12 | 88.0 | -17.05% |
| opam | 3M | 2026-09-19 | 73.0 | 2026-06-20 | 67.0 | +8.96% |
| opam | YTD | 2026-09-19 | 73.0 | 2026-01-03 | 40.0 | +82.5% |
| ocaml compiler | 7D | 2026-09-19 | 30.0 | 2026-09-12 | 15.0 | +100.0% |
| ocaml compiler | 3M | 2026-09-19 | 30.0 | 2026-06-20 | 60.0 | -50.0% |
| ocaml dune | 7D | 2026-09-19 | 20.0 | 2026-09-12 | 11.0 | +81.82% |
| ocaml dune | 3M | 2026-09-19 | 20.0 | 2026-06-20 | 31.0 | -35.48% |
get_time_series for ocaml programming on Google Search closed at 30 on 2026-09-19, matching get_growth 30.0. Adjacent weeks: 25 on 2026-09-12, 57 on 2026-09-05, 35 on 2026-08-29, 43 on 2026-08-22. Peak in this pull is 100 on 2026-05-16, with 97 on 2026-05-23, 80 on 2026-06-06, 64 on 2026-07-11, and 61 on 2026-07-25. Tip 30 is not that May high. 3M versus 47.0 is the week of 2026-06-20, five Saturdays after the 100 close. A job that alerts on 7D +20.0% while 14D sits at -47.37% is reading a bounce off a post-peak floor, not a new peak.
Bare ocaml closed at 45.0, down 15.09% from 53.0, the opposite 7D sign from ocaml programming. YTD was 45.0 versus 21.0 (+114.29%) while the programming phrase YTD was 30.0 versus 31.0 (-3.23%). Do not copy 45.0 onto ocaml programming 30.0.
ocaml language closed at 37.0, down 46.38% from 69.0. 14D was 37.0 versus 62.0 (-40.32%). 12M was 37.0 versus 34.0 (+8.82%). Language versus programming-phrase windows diverge on 7D, not only on 3M.
opam closed at 73.0, down 17.05% from 88.0. 30D was 73.0 versus 59.0 (+23.73%). 12M was 73.0 versus 58.0 (+25.86%). YTD was 73.0 versus 40.0 (+82.5%). Package-manager Search can rise on 3M while the programming phrase falls. Do not treat 73.0 as language adoption.
ocaml compiler closed at 30.0, up 100.0% from 15.0. The recent score matches ocaml programming 30.0. The 7D percent does not. 30D, 12M, and YTD printed growth 999999 versus 0.0. Report 30.0 versus 0.0. Do not treat a compiler 7D doubling as language adoption. ocaml dune closed at 20.0, up 81.82% from 11.0. 12M and YTD printed growth 999999 versus 0.0. Report 20.0 versus 0.0. Language versus toolchain windows diverge on 7D.
Neighbor languages on the same pull, same source, same 7D window:
| Keyword | 7D recent | 7D baseline | 7D growth | 3M recent | 3M baseline | 3M growth |
|---|---|---|---|---|---|---|
| ocaml programming | 30.0 | 25.0 | +20.0% | 30.0 | 47.0 | -36.17% |
| f# programming | 26.0 | 15.0 | +73.33% | 26.0 | 69.0 | -62.32% |
| haskell programming | 38.0 | 25.0 | +52.0% | 38.0 | 65.0 | -41.54% |
| elixir programming | 31.0 | 19.0 | +63.16% | 31.0 | 100.0 | -69.0% |
| clojure programming | 21.0 | 12.0 | +75.0% | 21.0 | 44.0 | -52.27% |
| rust programming | 14.0 | 14.0 | 0.0% | 14.0 | 37.0 | -62.16% |
| zig programming | 14.0 | 10.0 | +40.0% | 14.0 | 55.0 | -74.55% |
| python programming | 46.0 | 38.0 | +21.05% | 46.0 | 84.0 | -45.24% |
| java programming | 21.0 | 22.0 | -4.55% | 21.0 | 45.0 | -53.33% |
| go programming | 33.0 | 31.0 | +6.45% | 33.0 | 83.0 | -60.24% |
| scala programming | 23.0 | 26.0 | -11.54% | 23.0 | 33.0 | -30.3% |
Do not copy haskell programming 38.0 or elixir programming 31.0 onto ocaml programming 30.0. f# programming scored 26.0 versus 15.0 (+73.33%). YTD for that token printed growth 999999 versus 0.0. Report 26.0 versus 0.0. fsharp programming printed 0.0 versus 0.0 on 7D, 3M, 12M, and YTD, with data_quality low. Store the zeros. Do not fill fsharp programming from f# programming 26.0. A Haskell Trends API helper stores the functional-language neighbor on the same 7D window. python programming YTD was 46.0 versus 20.0 (+130.0%). ocaml programming YTD was 30.0 versus 31.0 (-3.23%). Same calendar, opposite YTD signs. clojure programming 12M printed growth 999999 versus 0.0. Report 21.0 versus 0.0.
What did YouTube, News, and Wikipedia return?
YouTube for ocaml programming closed lower than Search on the 0-100 score and higher on the 7D percent. Keyword Google News printed zeros. Wikipedia titles resolve on their own. Compare Wikipedia on volume.
YouTube for ocaml programming tipped 18.0 on 2026-09-19, up 63.64% from 11.0, while Search rose 20.0% to 30.0. 14D, 30D, 3M, 12M, and YTD printed growth 999999 versus 0.0. Report 18.0 versus 0.0. The payload marked data_quality low with a warning that the underlying signal is over 90% zeros. get_time_series closed at 18 on 2026-09-19, matching get_growth. Adjacent week: 11 on 2026-09-12. Peak in this pull is 100 on 2026-07-25. Every earlier week in this pull printed 0, from 2021-09-25 through 2026-07-18, then 0 again from 2026-08-01 through 2026-09-05. Tip 18 is not that July spike. YouTube 18.0 is not Search 30.0. Do not treat the 7D YouTube bounce as language adoption while Search sits at 30.0 after a 100 close in May.
Keyword Google News for ocaml programming tipped 0.0 versus 0.0 on 7D, 14D, 30D, 3M, 12M, and YTD. The payload marked data_quality low with a warning that the underlying signal is over 90% zeros. Store the zeros. Do not fill News from Search 30.0. Keyword News and the Google News Top News board are different feeds. Mode docs sit at https://trendsapi.ai/docs.
Wikipedia for OCaml resolved to Ocaml. 7D and 14D collapsed (collapsed_range: recent and baseline resolved to the same monthly point). August 2026 scored 12.5 with 297 pageviews versus July 20.8 with 441 (score -39.9%, volume -32.65%). 3M was 12.5 / 297 versus May 20.0 / 426 (volume -30.28%). 12M was 12.5 / 297 versus August 2025 25.1 / 515 (volume -42.33%). YTD was 12.5 / 297 versus January 22.0 / 462 (volume -35.71%). Peak in this pull is 100.0 / 1,810 in August 2023, with 73.9 / 1,358 in June 2023 and 75.1 / 1,380 in September 2023. Keyword OCaml (programming language) returned 404 no_data. Store the miss. Compare Wikipedia on volume. Do not join 297 views onto Search 30.0. Wikipedia source docs sit at https://trendsapi.ai/trends/wikipedia-trends.
There is no Opam registry source on this API. npm covers npmjs. python covers PyPI. An OCaml watchlist that wants package downloads has no third source to join onto Search 30.0.
How does a watchlist store live boards next to weekly scores?
get_top_trends has no keyword. Pair the live Google Trends board with get_growth on the exact board string. Live rank, 1-day rank_change, and 7-day rank_change are three feeds.
POST https://api.trendsapi.ai/api
Authorization: Bearer <api_key>
Content-Type: application/json
{"mode":"get_top_trends","type":"Google Trends","limit":25}
On 2026-09-22T10:01:34Z the live Google Trends board ranked five guys at 22. The 1-day rank_change sort returned 80 rows (baseline 2026-09-21T02:01:38Z) and listed it at +4 from prev_rank 26. The 7-day sort returned 7 rows (baseline 2026-09-15T02:01:31Z) and omitted it. Weekly Search for that exact string scored 86.0 versus 40.0, up 115.0%. five guys burger scored 92.0, up 217.24% from 29.0. The helper that stores those rows is the blog in this batch: five guys live rank versus weekly Search. Board-shape notes for Google Trends live feeds sit at https://trendsapi.ai/trends/google-trends.
Free tier is 100 successful 200s per month. Only 200 responses count against quota. Six language tokens plus one live board is 7 calls. A Monday run that also pulls YouTube and Wikipedia for the programming phrase is 9 calls. Four weeks is 36 calls and still fits the free cap. Starter is 5,000, Pro 25,000, Business 100,000.
Envelope checklist
POSThttps://api.trendsapi.ai/apiwithAuthorization: Bearer <api_key>.- Parse the transport JSON, then parse the
bodystring a second time. - Store
ocaml programming,ocaml language,ocaml,ocaml compiler,opam, andocaml duneas separate series. - Compare Wikipedia
Ocamlon volume (297 August views), not on 12.5. - Pair
get_top_trendsrank with bothrank_changewindows andget_growthon the exact board string.
A Clojure client that uses clj-http for the same envelope is on Clojure Trends API.