Get trends with /v1/news/trends
/v1/news/trends aggregates the news instead of returning it: give it a field and it returns the most frequent values with counts, shares and, on request, growth rate and period comparison. It answers "who is being talked about right now" without downloading a single article.
Each request costs 1 point. Using the prompt parameter adds 2 points for the translation step; prompt requires Basic or above.
Endpoint
GET /v1/news/trends
POST /v1/news/trendsBase URL: https://api.apitube.io. field is required; everything else narrows or shapes the aggregation.
Fields you can aggregate
field | Aggregates by |
|---|---|
entity.id | People, organizations, brands, locations |
category.id | IPTC Media Topics categories |
topic.id | Topics |
industry.id | Industries |
source.id | Publishers |
Up to 5 fields per request, comma-separated. One field returns a flat trends array; several return trends keyed by field name.
Values come back enriched — an entity.id trend carries the entity's name, type and wikidata_id, not just the raw ID.
Trending analysis and period comparison
Two optional layers sit on top of the plain counts:
trending=1addsgrowth_rateand atrending_score, computed over the lasttrending_daysdays (default 14, max 30). This is what surfaces a subject that is small in absolute terms but rising fast.compare=1adds the previous period of the same length and achangevalue. With comparison on,sort=changeandsort=trending_scorebecome available.
time_bucket (hour, day, week, month) adds a time-series breakdown for each value, and percentile drops everything below the given percentile.
Parameters
Prompt
Plain-language description of what you want; translated into the filters below.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | No | Plain-language description of what to aggregate, translated into the filters below before the request runs. The field you aggregate by still has to be given explicitly. Costs 2 extra points on a cache miss. Available on Basic and above — Free and Starter get 403 ER0706. Range: 3–500 characters. |
Request for Articles Described in Plain Language
This request asks for recent English-language coverage of Tesla and Elon Musk without naming a single filter.
curl "https://api.apitube.io/v1/news/trends?field=entity.id&prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"prompt": "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "prompt": "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "prompt" => "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("prompt", "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsDate and time
| Parameter | Type | Required | Description |
|---|---|---|---|
published_at | string | No | Exact date (creates 24-hour range). Format: YYYY-MM-DD or ISO 8601. Example: 2025-01-15. |
published_at.end | string | No | End of date range. Format: YYYY-MM-DD or ISO 8601. Combined with a title search the range may not exceed 31 days (ER0110). Example: 2025-01-31. |
published_at.start | string | No | Start of date range. Format: YYYY-MM-DD or ISO 8601. Combined with a title search the range may not exceed 31 days (ER0110). Example: 2025-01-01. |
Request to get news articles within a specific date range
curl "https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"published_at.start": "2022-01-01",
"published_at.end": "2022-01-31",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "published_at.start": "2022-01-01", "published_at.end": "2022-01-31", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "published_at.start" => "2022-01-01", "published_at.end" => "2022-01-31", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("published_at.start", "2022-01-01")
q.Set("published_at.end", "2022-01-31")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=2022-01-01&published_at.end=2022-01-31
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news using a relative time range
curl "https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"published_at.start": "NOW-7DAYS",
"published_at.end": "NOW",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "published_at.start" => "NOW-7DAYS", "published_at.end" => "NOW", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("published_at.start", "NOW-7DAYS")
q.Set("published_at.end", "NOW")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&published_at.start=NOW-7DAYS&published_at.end=NOW
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsLanguages
| Parameter | Type | Required | Description |
|---|---|---|---|
ignore.language.code | string | No | Exclude articles in these languages (comma-separated, max 3). Example: zh,ar. |
language.code | string | No | Comma-separated ISO 639-1 language codes (max 3). Example: en. |
Request to get news articles excluding those from France and in the French language
curl "https://api.apitube.io/v1/news/trends?field=entity.id&ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"ignore.source.country.code": "fr",
"ignore.language.code": "fr",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "ignore.source.country.code" => "fr", "ignore.language.code" => "fr", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("ignore.source.country.code", "fr")
q.Set("ignore.language.code", "fr")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&ignore.source.country.code=fr&ignore.language.code=fr
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles in the English and French languages
curl "https://api.apitube.io/v1/news/trends?field=entity.id&language.code=en,fr&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"language.code": "en,fr",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "language.code": "en,fr", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "language.code" => "en,fr", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("language.code", "en,fr")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&language.code=en,fr&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&language.code=en,fr
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsLanguage-Specific Business News
curl "https://api.apitube.io/v1/news/trends?field=entity.id&language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"language.code": "zh,ko",
"category.id": "medtop:04000000",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "language.code" => "zh,ko", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("language.code", "zh,ko")
q.Set("category.id", "medtop:04000000")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&language.code=zh,ko&category.id=medtop:04000000
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsSource
| Parameter | Type | Required | Description |
|---|---|---|---|
ignore.source.bias | string | No | Exclude sources with this media bias (comma-separated). Values: left, center, right. Example: right. |
ignore.source.country.code | string | No | Exclude sources from these countries (comma-separated, max 3). Example: us. |
ignore.source.domain | string | No | Exclude these source domains (comma-separated, max 3). |
ignore.source.id | string | No | Exclude these source IDs (comma-separated, max 3). |
source.bias | string | No | Filter by media bias (comma-separated). Values: left, center, right. Example: left. |
source.country.code | string | No | Filter by source country ISO 3166-1 alpha-2 codes (comma-separated, max 3). Example: us. |
source.domain | string | No | Comma-separated source domains (max 3). Example: nytimes.com. |
source.id | string | No | Comma-separated source IDs (max 3). Example: 100. |
source.rank.opr.max | integer | No | Maximum Open PageRank score. Range: min 0. |
source.rank.opr.min | integer | No | Minimum Open PageRank score. Range: min 0. |
Request to get news articles from a specific source (e.g., "theguardian.com")
curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"source.domain": "theguardian.com",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "source.domain" => "theguardian.com", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("source.domain", "theguardian.com")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles from multiple sources (e.g., "theguardian.com" and "nytimes.com")
curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"source.domain": "theguardian.com,nytimes.com",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("source.domain", "theguardian.com,nytimes.com")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com,nytimes.com
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles from a specific source and in a specific language (e.g., "theguardian.com" and "English")
curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"source.domain": "theguardian.com",
"language.code": "en",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "source.domain": "theguardian.com", "language.code": "en", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "source.domain" => "theguardian.com", "language.code" => "en", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("source.domain", "theguardian.com")
q.Set("language.code", "en")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&language.code=en
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles with rank between 0.5 and 0.9
curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"source.rank.opr.min": "5",
"source.rank.opr.max": "9",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "source.rank.opr.min": "5", "source.rank.opr.max": "9", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "source.rank.opr.min" => "5", "source.rank.opr.max" => "9", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("source.rank.opr.min", "5")
q.Set("source.rank.opr.max", "9")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&source.rank.opr.min=5&source.rank.opr.max=9
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsCategories
| Parameter | Type | Required | Description |
|---|---|---|---|
category.id | string | No | Comma-separated category IDs (max 3). Example: iab-1. |
ignore.category.id | string | No | Exclude these categories (comma-separated, max 3). |
Request to get news articles from a specific category (e.g., "Sport")
This request retrieves news articles that fall under the "sport" category.
curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:15000000&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"category.id": "medtop:15000000",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "category.id" => "medtop:15000000", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("category.id", "medtop:15000000")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:15000000&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:15000000
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest for Articles in the Finance Category
This request retrieves news articles in the "finance" category.
curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:04000000&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"category.id": "medtop:04000000",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("category.id", "medtop:04000000")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:04000000&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:04000000
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest for Articles in a Category and Filtered by Language
This request retrieves news articles in the "politics" category that are in French.
curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"category.id": "medtop:11000000",
"language.code": "fr",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "category.id" => "medtop:11000000", "language.code" => "fr", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("category.id", "medtop:11000000")
q.Set("language.code", "fr")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:11000000&language.code=fr
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsTopics
| Parameter | Type | Required | Description |
|---|---|---|---|
ignore.topic.id | string | No | Exclude these topics (comma-separated, max 3). |
topic.id | string | No | Comma-separated topic IDs (max 3). Example: technology. |
Request to get news articles from a specific topic (e.g., "crypto_news")
This request retrieves news articles that fall under the "crypto news" topic.
curl "https://api.apitube.io/v1/news/trends?field=entity.id&topic.id=industry.crypto_news&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"topic.id": "industry.crypto_news",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "topic.id" => "industry.crypto_news", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("topic.id", "industry.crypto_news")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&topic.id=industry.crypto_news&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&topic.id=industry.crypto_news
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsIndustries
| Parameter | Type | Required | Description |
|---|---|---|---|
ignore.industry.id | string | No | Exclude these industries (comma-separated, max 3). |
industry.id | string | No | Comma-separated industry IDs (max 3). Example: 1. |
Entities, people, organizations, brands
| Parameter | Type | Required | Description |
|---|---|---|---|
entity.id | string | No | Comma-separated entity IDs (max 3). Example: 12345. |
ignore.entity.id | string | No | Exclude these entity IDs (comma-separated, max 3). |
Request to get news articles about a specific entity (e.g., "Brad Pitt")
curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"entity.id": "1278268",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "entity.id": "1278268", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "entity.id" => "1278268", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("entity.id", "1278268")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles about multiple entities (e.g., "Brad Pitt" and "Angelina Jolie")
curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268,1282301&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"entity.id": "1278268,1282301",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "entity.id": "1278268,1282301", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "entity.id" => "1278268,1282301", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("entity.id", "1278268,1282301")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268,1282301&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268,1282301
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsRequest to get news articles about an entity while ignoring another
curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"entity.id": "1278268",
"ignore.entity.id": "315",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "entity.id": "1278268", "ignore.entity.id": "315", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "entity.id" => "1278268", "ignore.entity.id" => "315", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("entity.id", "1278268")
q.Set("ignore.entity.id", "315")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&ignore.entity.id=315
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsSentiment
| Parameter | Type | Required | Description |
|---|---|---|---|
entity.sentiment.polarity | string | No | Filter by sentiment polarity toward the entity (combine with entity.id or *.name; standalone = any entity). One of: positive, negative, neutral. |
entity.sentiment.score.max | number | No | Maximum sentiment score toward the entity. Range: -1–1. |
entity.sentiment.score.min | number | No | Minimum sentiment score toward the entity. Range: -1–1. |
Article flags
| Parameter | Type | Required | Description |
|---|---|---|---|
is_breaking | boolean | No | Filter breaking news articles. |
is_duplicate | boolean | No | Filter duplicate/unique articles. |
Only Breaking News Monitoring
curl "https://api.apitube.io/v1/news/trends?field=entity.id&is_breaking=1&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={
"field": "entity.id",
"is_breaking": "1",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())const params = new URLSearchParams({ "field": "entity.id", "is_breaking": "1", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`);
const data = await response.json();
console.log(data);$query = http_build_query(["field" => "entity.id", "is_breaking" => "1", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/trends?$query");
$data = json_decode($response, true);
print_r($data);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/trends")
q := u.Query()
q.Set("field", "entity.id")
q.Set("is_breaking", "1")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/trends?field=entity.id&is_breaking=1&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/trends?field=entity.id&is_breaking=1
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/trendsTrends aggregation
| Parameter | Type | Required | Description |
|---|---|---|---|
compare | string | No | Enable period comparison. One of: 0, 1. |
compare_window | string | No | Comparison window (required when compare=1). Examples: 24HOURS, 7DAYS, 1WEEK, 1w, 2m. |
field | string | Yes | Comma-separated fields to aggregate (max 5). Required. One of: source.id, category.id, topic.id, industry.id, entity.id. |
mincount | integer | No | Minimum article count for a value to be included. Range: 1–10000. Default: 1. |
percentile | integer | No | Filter results above this percentile. Range: 1–100. |
time_bucket | string | No | Time bucket for time-series breakdown. One of: hour, day, week, month. |
trending | string | No | Enable trending analysis with growth rate calculation. One of: 0, 1. |
trending_days | integer | No | Number of days for trending analysis window. Range: 7–30. Default: 14. |
Sorting
| Parameter | Type | Required | Description |
|---|---|---|---|
order | string | No | Sort order. One of: asc, desc. Default: desc. |
sort | string | No | Sort field (change and trending_score require compare=1). One of: count, value, growth_rate, change, trending_score. Default: count. |
Pagination
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | integer | No | Offset for pagination. Range: min 0. Default: 0. |
per_page | integer | No | Number of results per field. Range: 1–100. Default: 10. |
WARNING
The published OpenAPI specification lists the subset above. The endpoint runs the same filter chain as /v1/news/everything, so filters outside this list are accepted at runtime but are not part of the contract — they may change without a specification change, and generated SDKs will not expose them. For guaranteed behaviour use only the parameters listed here.
Response format
{
"status": "ok",
"field": "entity.id",
"per_page": 10,
"offset": 0,
"total_count": 1500,
"total_articles": 45000,
"sort": "count",
"order": "desc",
"mincount": 1,
"trends": [
{
"value": { "id": 1034399, "name": "Germany", "type_id": 2, "wikidata_id": "Q183" },
"count": 523,
"percentage": 1.16,
"growth_rate": 2.5
}
],
"request_id": "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6"
}Requesting several fields changes the shape: trends becomes an object keyed by field, and total_count / total_articles move inside each field. Both shapes are documented in API Response Structure.
Request examples
curl "https://api.apitube.io/v1/news/trends?field=entity.id&per_page=10&language.code=en&api_key=YOUR_API_KEY"import requests
response = requests.get(
"https://api.apitube.io/v1/news/trends",
params={"field": "entity.id", "per_page": 10, "language.code": "en"},
headers={"X-API-Key": "YOUR_API_KEY"},
)
for trend in response.json()["trends"]:
print(trend["value"]["name"], trend["count"], trend.get("growth_rate"))const params = new URLSearchParams({
field: 'entity.id',
per_page: '10',
'language.code': 'en'
});
const response = await fetch(`https://api.apitube.io/v1/news/trends?${params}`, {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.table(data.trends.map(t => ({ name: t.value.name, count: t.count })));$query = http_build_query([
'field' => 'entity.id',
'per_page' => 10,
'language.code' => 'en',
'api_key' => 'YOUR_API_KEY',
]);
$data = json_decode(file_get_contents("https://api.apitube.io/v1/news/trends?$query"), true);
foreach ($data['trends'] as $trend) {
echo $trend['value']['name'], ': ', $trend['count'], PHP_EOL;
}What is rising fastest, not just what is biggest
curl "https://api.apitube.io/v1/news/trends?field=entity.id&trending=1&trending_days=7&sort=trending_score&api_key=YOUR_API_KEY"This week against last week
curl "https://api.apitube.io/v1/news/trends?field=topic.id&compare=1&compare_window=7&sort=change&api_key=YOUR_API_KEY"Two fields at once, as a daily series
curl "https://api.apitube.io/v1/news/trends?field=entity.id,category.id&time_bucket=day&api_key=YOUR_API_KEY"Errors
| Code | Status | Meaning |
|---|---|---|
ER0350 | 400 | field missing or not one of the five allowed values |
ER0175 | 401 | API key is missing or invalid |
ER0176 | 402 | No points left on the account |
ER0203 | 429 | Rate limit exceeded |
Full list in HTTP response codes.
Related
- Count articles — one number instead of a ranking.
- Faceting — aggregate inside a normal search response.
- Search articles — fetch the articles behind a trend.