A Scala 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 Scala library. Java 11 HttpClient sends the request. ujson parses the envelope, then parses the body string a second time. Pulled on 2026-09-13, Google Search for scala programming scored 22.0 for the week of 2026-09-12, down 15.38% from 26.0. akka scored 78.0, down 7.14% from 84.0. apache spark scored 21.0, up 5.0% from 20.0. Do not treat the Spark 7D rise as language adoption. The same helper that stores those rows also pulls a live Google Trends board; a 1-day climber on that board is documented in Lady Gaga live rank versus weekly Search.

How does a Scala 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":"scala programming","percent_growth":["7D","30D","3M","12M"]}
//> using dep com.lihaoyi::ujson::3.3.1

import java.net.URI
import java.net.http.{HttpClient, HttpRequest, HttpResponse}
import java.nio.charset.StandardCharsets

def trendsPost(payload: String): ujson.Value = {
  val key = sys.env.getOrElse("TRENDSAPI_API_KEY", sys.error("TRENDSAPI_API_KEY is unset"))
  val req = HttpRequest.newBuilder(URI.create("https://api.trendsapi.ai/api"))
    .header("Authorization", s"Bearer $key")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(payload))
    .build()
  val resp = HttpClient.newHttpClient.send(req, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8))
  if (resp.statusCode() != 200) sys.error(s"HTTP ${resp.statusCode()}")
  val envelope = ujson.read(resp.body())
  // body is a JSON string; parse it a second time
  ujson.read(envelope("body").str)
}

val inner = trendsPost(
  """{"mode":"get_growth","source":"google search","keyword":"scala programming","percent_growth":["7D","30D","3M","12M"]}"""
)
println(inner)

The first mistake most clients make is treating the body field as an object after one parse. It is still a JSON string. Parse the envelope, then parse body a second time. Library docs:

https://docs.oracle.com/en/java/javase/21/docs/api/java.net.http/java/net/http/HttpClient.html
https://com-lihaoyi.github.io/upickle/

Free tier allows 100 successful requests per month. Only HTTP 200 responses count against quota. Starter is 5,000, Pro is 25,000, Business is 100,000. There is no Scala-specific source on this API. npm covers npmjs package names. python covers PyPI project names. A Scala watchlist that needs Maven Central or Coursier download counts has to pull those from somewhere else.

What did get_growth return for Scala language tokens?

Pulled on 2026-09-13 with source set to google search. get_growth tips on 2026-09-12. The prior Saturday 2026-09-05 is the last full week in the same series. Bare scala is a polluted token (the town, the language, other homonyms). Store the phrase tokens.

Keyword Period Recent Baseline date Baseline Growth
scala programming 7D 22.0 2026-09-05 26.0 -15.38%
scala programming 14D 22.0 2026-08-29 26.0 -15.38%
scala programming 30D 22.0 2026-08-15 36.0 -38.89%
scala programming 3M 22.0 2026-06-13 37.0 -40.54%
scala programming 12M 22.0 2025-09-13 23.0 -4.35%
scala programming YTD 22.0 2026-01-03 47.0 -53.19%
scala language 7D 27.0 2026-09-05 34.0 -20.59%
scala 3 7D 40.0 2026-09-05 56.0 -28.57%
akka 7D 78.0 2026-09-05 84.0 -7.14%
apache spark 7D 21.0 2026-09-05 20.0 +5.0%
play framework 7D 10.0 2026-09-05 11.0 -9.09%
scalalang 7D 0.0 2026-09-05 0.0 0.0%
scala 7D 56.0 2026-09-05 61.0 -8.2%
kotlin 7D 32.0 2026-09-05 33.0 -3.03%
java programming 7D 20.0 2026-09-05 22.0 -9.09%

scala programming and apache spark closed at opposite 7D directions. The phrase token fell 15.38%. Spark rose 5.0% to 21.0. akka fell 7.14% to 78.0. scala 3 scored 40.0, down 28.57% from 56.0. play framework scored 10.0. scalalang sat at 0.0 with data_quality low. Bare scala scored 56.0. That is not the language series. A job that alerts "Scala is up" off Spark 7D is reading the compute series. Store each string.

3M is a summer drop on Spark and Play, milder on the language phrase. scala programming is 22.0 versus 37.0 on 2026-06-13 (-40.54%). scala language is 27.0 versus 90.0 (-70.0%). scala 3 is 40.0 versus 73.0 (-45.21%). akka is 78.0 versus 78.0 (flat). apache spark is 21.0 versus 89.0 (-76.4%). play framework is 10.0 versus 65.0 (-84.62%). kotlin is 32.0 versus 93.0 (-65.59%). java programming is 20.0 versus 46.0 (-56.52%). Do not alert language adoption off a Spark or Play 3M crash. YouTube for the same phrase token is sparser (next section).

get_time_series for scala programming on Google Search closed at 22 on 2026-09-12, matching get_growth 22.0. Adjacent weeks: 26 on 2026-09-05, 26 on 2026-08-29, 33 on 2026-08-22, 36 on 2026-08-15, 35 on 2026-08-08. The series hit 100 on 2025-12-27, with 94 on 2025-12-20. The 2026-01-03 close was 47. The 2025-09-13 close was 23. The 7D drop from 26 to 22 sits after that December spike, not at a new high.

get_time_series for akka closed at 78 on 2026-09-12, matching get_growth 78.0. Adjacent weeks: 84 on 2026-09-05, 82 on 2026-08-29, 70 on 2026-08-22. Peak 100 on 2026-01-31, with 97 on 2026-01-03. 12M was 78.0 versus 63.0 on 2025-09-13 (+23.81%). Flat 3M at 78.0 is not the January peak.

get_time_series for apache spark closed at 21 on 2026-09-12, matching get_growth 21.0. Adjacent weeks: 20 on 2026-09-05, 30 on 2026-08-29, 23 on 2026-08-22, 38 on 2026-08-15. Peak 100 on 2026-06-06, with 96 on 2026-05-16 and 91 on 2026-06-20. 14D was 21.0 versus 30.0 (-30.0%). 12M was 21.0 versus 36.0 (-41.67%). Tip 21 is the floor after that June peak. Spark 7D +5.0% is a one-week bounce on that floor, not language adoption.

scalalang is a dead series in this pull. Tip 0.0 versus 0.0 on 7D, 14D, 3M, and 12M. The payload marked data_quality low with a warning that the underlying signal is over 90% zeros. Report 0.0. Concatenated domain tokens are not the language token.

The Kotlin OkHttp sibling of this helper is Kotlin Trends API. The Java sibling is Java Trends API.

What did YouTube, News, and Wikipedia return?

YouTube for scala programming tipped 18.0 on 2026-09-12, down 21.74% from 23.0 on 2026-09-05. 14D was 18.0 versus 0.0 on 2026-08-29, which printed growth 999999. Report 18.0 versus 0.0. Do not store 999999. 30D was 18.0 versus 52.0 (-65.38%). 3M was 18.0 versus 43.0 (-58.14%). 12M and YTD also baselined at 0.0. get_time_series closed at 18 on 2026-09-12, matching get_growth. Adjacent weeks: 23 on 2026-09-05, 0 on 2026-08-29, 0 on 2026-08-22, 52 on 2026-08-15. Peak in this pull is 100 on 2022-11-26. The series is sparse, with long runs of zeros. Tip 18 is not that 2022 peak. Search 3M was -40.54%. YouTube 3M was -58.14% off a sparse series. Do not copy YouTube zeros onto Search 22.0.

YouTube for akka moved with Search on 7D. It tipped 60.0, down 6.25% from 64.0, while Search fell 7.14%. 14D was 60.0 versus 70.0 (-14.29%). 3M was 60.0 versus 56.0 (+7.14%) while Search 3M was flat at 78.0. Phrase YouTube and phrase Search are not one series.

YouTube for apache spark moved the same 7D direction as Search. It tipped 51.0, up 6.25% from 48.0, while Search rose 5.0% to 21.0. 3M was 51.0 versus 64.0 (-20.31%) while Search 3M was -76.4%. Spark YouTube 51.0 is not Spark Search 21.0. A Search summer crash is not a YouTube crash of the same size.

Keyword Google News for scala programming tipped 0.0 on 2026-09-12 versus 0.0 on every listed baseline. The payload marked data_quality low with a warning that the underlying signal is over 90% zeros. Report 0.0. Keyword News and the Google News Top News board are different feeds. Store the low-quality flag. Do not fill News from Search 22.0.

Wikipedia resolved two titles. Keyword Scala (programming language) resolved with August score 0.3 and 6,992 views versus July 0.0 / 6,897 (score growth printed 999999, volume +1.38%). Report 0.3 versus 0.0 and store the volume. 3M volume was 6,992 versus 7,929 (-11.82%) while the score went 0.3 versus 3.7 (-91.89%). 12M volume was 6,992 versus 10,129 on 2025-08-01 (-30.97%) while the score went 0.3 versus 11.6 (-97.41%). YTD volume was 6,992 versus 9,916 (-29.49%). 7D and 14D collapsed to the same monthly point. Report both score and volume.

Keyword Scala is a different page. August score 0.3 with 333 views versus July 0.7 / 344 (score -57.14%, volume -3.2%). 3M volume was 333 versus 498 (-33.13%). 12M volume was 333 versus 415 (-19.76%) while the score went 0.3 versus 3.2 (-90.63%). YTD volume was 333 versus 400 (-16.75%). The language page has more August views than the short title (6,992 versus 333). Compare Wikipedia on volume. Do not join either page onto Search 22.0. Notes for the Wikipedia source sit on Wikipedia Trends.

How does a watchlist store live boards next to weekly scores?

get_top_trends has no keyword. It returns a ranked board. Pair it with get_growth for the tokens that appear, using the exact board string.

{"mode":"get_top_trends","type":"Google Trends","limit":25}
{"mode":"get_top_trends","type":"Google Trends","sort":"rank_change","window":"1d","limit":25}

The Google Trends board at 2026-09-13T10:01:29Z ranked labor day 1, iphone duo 2, iphone 18 3, and lady gaga 10. The 1-day rank_change sort (16 rows, baseline 2026-09-12T02:01:33Z) put lady gaga at rank 10 with rank_change 43 from prev_rank 53. The 7-day sort returned 3 rows and omitted that token. Weekly Search for the same phrase was 41.0, up 272.73% from 11.0. Live rank and the 7-day mover list can disagree even when weekly Search just jumped. The walk-through is Lady Gaga live rank versus weekly Search.

A Scala watchlist that stores six Search tokens (scala programming, scala 3, akka, apache spark, play framework, kotlin) plus one Google Trends board uses 7 successful 200s. Four runs per 30-day month is 28 calls and fits the free cap of 100. Daily polling of that set is about 210 calls and needs Starter (5,000). Modes and sources for the modes live at https://trendsapi.ai/docs. Google Search board strings are not always valid get_growth keywords. Pair get_top_trends rank, rank_change, and get_growth before writing an alert. Source notes for Search sit on Google Trends.

The Swift sibling of this helper is Swift Trends API. The Python sibling is Python Trends API.

Envelope checklist

  1. POST https://api.trendsapi.ai/api with Authorization: Bearer <api_key>.
  2. Modes are get_time_series, get_growth, and get_top_trends only.
  3. Parse body twice before reading results or dated points.
  4. Google Search uses the exact token typed. scala, scala programming, scala language, scala 3, scalalang, akka, apache spark, and play framework are eight series. Wikipedia titles are resolved names; confirm the title and compare on volume before joining.
  5. Quota counts successful 200 responses: free 100/month, then 5,000 / 25,000 / 100,000 on paid tiers.

No Scala library is required. A 40-line HttpClient helper covers growth, series, and board pulls for jobs that already run under systemd or a cron timer.