--- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/filter-examples.md description: Examples of using additional filtering parameters in News API --- # Additional Filter Query Examples ## Exclude duplicate articles {#filter-out-duplicate-articles} Exclude duplicate articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/everything?is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_duplicate=0 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/everything ``` ::: ## Exclude paywalled articles {#filter-out-paywalled-content} Exclude articles behind a paywall. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_paywall=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_paywall": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_paywall": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_paywall" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_paywall", "0") 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) } ``` ```java [Java] 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/everything?is_paywall=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_paywall=0 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/everything ``` ::: ## Filter by article quality {#high-quality-content-filtering} Find original, freely accessible business news from highly ranked sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=0.6&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "0.6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "0.6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_duplicate" => "0", "is_paywall" => "0", "source.rank.opr.min" => "0.6", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("source.rank.opr.min", "0.6") 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) } ``` ```java [Java] 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/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=0.6&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=0.6&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/everything ``` ::: ## Find quality articles on a topic {#topic-specific-high-quality-content} Find AI articles and exclude duplicates. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&is_duplicate=0 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/everything ``` ::: ## Find articles for company alerts {#quality-news-alerts-on-specific-entities} Find articles about selected organizations for a news alert. Exclude duplicates and paywalled articles, and show the newest results first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Apple,Microsoft&is_duplicate=0&is_paywall=0&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Apple,Microsoft", "is_duplicate": "0", "is_paywall": "0", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Apple,Microsoft", "is_duplicate": "0", "is_paywall": "0", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Apple,Microsoft", "is_duplicate" => "0", "is_paywall" => "0", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Apple,Microsoft") q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Apple,Microsoft&is_duplicate=0&is_paywall=0&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Apple,Microsoft&is_duplicate=0&is_paywall=0&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find freely accessible long articles {#accessible-in-depth-analysis-search} Find freely accessible, long articles about the economy. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=analysis&is_paywall=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "title": "analysis", "is_paywall": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "title": "analysis", "is_paywall": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "title" => "analysis", "is_paywall" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("title", "analysis") q.Set("is_paywall", "0") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&title=analysis&is_paywall=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=analysis&is_paywall=0 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/everything ``` ::: ## Find original political coverage {#multi-criteria-selection-of-original-content-about-political-processes} Find original political articles and filter by sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&title=election,vote,candidate&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:11000000", "title": "election,vote,candidate", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "title": "election,vote,candidate", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "title" => "election,vote,candidate", "is_duplicate" => "0", "is_paywall" => "0", "language.code" => "en", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:11000000") q.Set("title", "election,vote,candidate") q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("language.code", "en") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?category.id=medtop:11000000&title=election,vote,candidate&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&title=election,vote,candidate&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score 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/everything ``` ::: ## Monitor original technology news {#comprehensive-monitoring-of-unique-materials-on-technological-innovations} Find original, freely accessible technology articles with images. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&title=artificial intelligence,robotics,blockchain&is_duplicate=0&is_paywall=0&media.images.count=1&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "title": "artificial intelligence,robotics,blockchain", "is_duplicate": "0", "is_paywall": "0", "media.images.count": "1", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "title": "artificial intelligence,robotics,blockchain", "is_duplicate": "0", "is_paywall": "0", "media.images.count": "1", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "title" => "artificial intelligence,robotics,blockchain", "is_duplicate" => "0", "is_paywall" => "0", "media.images.count" => "1", "language.code" => "en", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("title", "artificial intelligence,robotics,blockchain") q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("media.images.count", "1") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&title=artificial intelligence,robotics,blockchain&is_duplicate=0&is_paywall=0&media.images.count=1&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&title=artificial intelligence,robotics,blockchain&is_duplicate=0&is_paywall=0&media.images.count=1&language.code=en&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Compare original coverage of social issues {#cross-regional-analysis-of-original-content-on-social-issues} Compare sentiment in original, freely accessible coverage of social issues. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=poverty,inequality,protest&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "poverty,inequality,protest", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "poverty,inequality,protest", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "poverty,inequality,protest", "is_duplicate" => "0", "is_paywall" => "0", "language.code" => "en", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "poverty,inequality,protest") q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("language.code", "en") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?title=poverty,inequality,protest&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=poverty,inequality,protest&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score 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/everything ``` ::: ## Find original cybersecurity news {#high-fidelity-enterprise-cybersecurity-intelligence-filtering} Find cybersecurity articles, exclude duplicates and show the newest results first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=cybersecurity,data breach,ransomware,vulnerability&category.id=medtop:13000000&is_duplicate=0&sort.by=published_at&sort.order=desc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "cybersecurity,data breach,ransomware,vulnerability", "category.id": "medtop:13000000", "is_duplicate": "0", "sort.by": "published_at", "sort.order": "desc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "cybersecurity,data breach,ransomware,vulnerability", "category.id": "medtop:13000000", "is_duplicate": "0", "sort.by": "published_at", "sort.order": "desc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "cybersecurity,data breach,ransomware,vulnerability", "category.id" => "medtop:13000000", "is_duplicate" => "0", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "cybersecurity,data breach,ransomware,vulnerability") q.Set("category.id", "medtop:13000000") q.Set("is_duplicate", "0") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?title=cybersecurity,data breach,ransomware,vulnerability&category.id=medtop:13000000&is_duplicate=0&sort.by=published_at&sort.order=desc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=cybersecurity,data breach,ransomware,vulnerability&category.id=medtop:13000000&is_duplicate=0&sort.by=published_at&sort.order=desc&per_page=100 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/everything ``` ::: ## Find original academic research coverage {#cross-publication-academic-research-media-coverage-analysis} Find research articles, exclude duplicates and paywalled articles, and show the newest results first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=research,scientific,study,discovery&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "research,scientific,study,discovery", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "research,scientific,study,discovery", "is_duplicate": "0", "is_paywall": "0", "language.code": "en", "sort.by": "sentiment.overall.score", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "research,scientific,study,discovery", "is_duplicate" => "0", "is_paywall" => "0", "language.code" => "en", "sort.by" => "sentiment.overall.score", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "research,scientific,study,discovery") q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("language.code", "en") q.Set("sort.by", "sentiment.overall.score") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?title=research,scientific,study,discovery&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=research,scientific,study,discovery&is_duplicate=0&is_paywall=0&language.code=en&sort.by=sentiment.overall.score&per_page=100 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/everything ``` ::: ## Compare coverage of controversial subjects {#media-bias-comparative-analysis-filtering-framework} Get articles to compare coverage of controversial subjects. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=climate,energy,sustainability&category.id=medtop:11000000&source.domain=foxnews.com,nytimes.com,theguardian.com&is_duplicate=0&sort.by=source.domain,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "climate,energy,sustainability", "category.id": "medtop:11000000", "source.domain": "foxnews.com,nytimes.com,theguardian.com", "is_duplicate": "0", "sort.by": "source.domain,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "climate,energy,sustainability", "category.id": "medtop:11000000", "source.domain": "foxnews.com,nytimes.com,theguardian.com", "is_duplicate": "0", "sort.by": "source.domain,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "climate,energy,sustainability", "category.id" => "medtop:11000000", "source.domain" => "foxnews.com,nytimes.com,theguardian.com", "is_duplicate" => "0", "sort.by" => "source.domain,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "climate,energy,sustainability") q.Set("category.id", "medtop:11000000") q.Set("source.domain", "foxnews.com,nytimes.com,theguardian.com") q.Set("is_duplicate", "0") q.Set("sort.by", "source.domain,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?title=climate,energy,sustainability&category.id=medtop:11000000&source.domain=foxnews.com,nytimes.com,theguardian.com&is_duplicate=0&sort.by=source.domain,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=climate,energy,sustainability&category.id=medtop:11000000&source.domain=foxnews.com,nytimes.com,theguardian.com&is_duplicate=0&sort.by=source.domain,sentiment.overall.score 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/objective-c/afnetworking-client.md description: >- Call the APITube News API from Objective-C using the AFNetworking library for network requests --- # AFNetworking integration ```objective-c // Install: pod 'AFNetworking' #import int main(int argc, const char * argv[]) { @autoreleasepool { AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; NSString *url = @"https://api.apitube.io/v1/news/everything"; NSDictionary *parameters = @{@"per_page": @"10", @"api_key": @"YOUR_API_KEY"}; [manager GET:url parameters:parameters headers:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) { NSLog(@"%@", responseObject); } failure:^(NSURLSessionTask *operation, NSError *error) { NSLog(@"Error: %@", error); }]; [[NSRunLoop currentRunLoop] run]; // Keep the command line tool alive } return 0; } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/scala/akka-http-client.md description: Call the APITube News API from Scala using Akka HTTP --- # Akka HTTP integration ```scala // Install: add akka-http and akka-stream to build.sbt import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.http.scaladsl.model._ import akka.stream.ActorMaterializer import scala.concurrent.Future import scala.util.{Failure, Success} object HttpClientExample extends App { implicit val system = ActorSystem() implicit val materializer = ActorMaterializer() import system.dispatcher val url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = url)) responseFuture.onComplete { case Success(res) => res.entity.dataBytes.runFold("")(_ ++ _.utf8String).foreach(println) case Failure(_) => sys.error("Error") } } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/swift/alamofire-client.md description: >- Call the APITube News API from Swift using the Alamofire HTTP networking library --- # Alamofire integration ```swift // Install: add Alamofire via Swift Package Manager or CocoaPods import Alamofire let url = "https://api.apitube.io/v1/news/everything" let parameters: [String: String] = ["per_page": "10", "api_key": "YOUR_API_KEY"] AF.request(url, parameters: parameters).response { response in if let data = response.data { print(String(data: data, encoding: .utf8) ?? "No response data") } else { print("Error: \(response.error?.localizedDescription ?? "Unknown error")") } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/response-structure.md' description: 'Fields, nested objects and example responses from the APITube News API' --- # API Response Structure Use this reference to read API responses and check the meaning and possible values of each field. ## General response structure The standard JSON response has this format: ```json { "status": "ok", "limit": 1, "path": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=json", "xlsx": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=xlsx", "csv": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=csv", "tsv": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=tsv", "xml": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=xml", "rss": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=rss", "parquet": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=parquet", "jsonl": "https://api.apitube.io/v1/news/everything?api_key=API_KEY&per_page=1&export=jsonl" }, "request_id": "1044de7a-a39d-463c-b443-1d9141f7babe", "results": [ // Array of articles ] } ``` ## Main response fields | Field | Type | Description | |---------------------|---------|------------------------------------------------------------------------------------------------------| | `status` | string | Request status. Possible values: "ok" (request successful) or "error" (an error occurred). | | `limit` | integer | Number of results per page. | | `path` | string | Full URL of the current API request, including all request parameters. | | `page` | integer | Current page of results. | | `has_next_pages` | boolean | `true` if another page of results is available. | | `next_page` | string | Full URL to get the next page of results. Empty string if `has_next_pages` is false. | | `has_previous_page` | boolean | `true` if a previous page of results is available. | | `previous_page` | string | Full URL to get the previous page of results. Empty string if `has_previous_page` is false. | | `export` | object | URLs to download results as JSON, JSONL, CSV, TSV, XLSX, XML, RSS or Parquet. | | `request_id` | string | Request ID for tracking and debugging. | | `meta` | object | Warnings or details about a `prompt`, when available — see [The meta object](#the-meta-object). | | `results` | array | Articles returned by the request. | ## The meta object A successful response may include `meta` with warnings or details about a `prompt`. Articles remain in `results` with the same format. | Field | Type | Appears when | |-----------------|--------|--------------------------------------------------------------------------------------------------| | `meta.prompt` | object | The request used the [`prompt`](/platform/news-api/filters#prompt) parameter. | | `meta.warnings` | array | The API limited the search range. For example, a title search without dates covers the last 31 days (`ER0366`). | ### meta.prompt ```json { "meta": { "prompt": { "text": "Elon Musk and Tesla news for the last 10 days", "applied": { "person.name": "Elon Musk", "organization.name": "Tesla", "published_at.start": "NOW-10DAY" }, "ignored": [ { "field": "topic.id", "value": "robotaxi", "reason": "not_found" } ], "cached": false } } } ``` | Field | Type | Description | |-----------|---------|------------------------------------------------------------------------------------------------------------| | `text` | string | Your prompt, with spaces removed from the beginning and end. | | `applied` | object | The parameters the prompt was translated into. This is the request that actually ran. | | `ignored` | array | Values that were understood but not used. Each item has `field`, `value` and `reason`. | | `cached` | boolean | `true` when the API reused an earlier interpretation of the same prompt, so no translation fee was charged. | `meta.prompt` is not returned by the SSE stream (`/v1/news/stream`), which has no JSON response. The WebSocket stream returns the same information in the `filters` object of its `subscribed` message. Full reference: [Natural Language Search](/platform/news-api/ai/natural-language-search). ### meta.warnings ```json { "meta": { "warnings": [ { "code": "ER0366", "message": "published_at window defaulted to the last 31 days for title search. Pass published_at.start / published_at.end to pick a different 31-day window.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" } } ] } } ``` Warnings arrive with HTTP `200`. For exports, the `x-query-window-clamped` response header reports when the title-search window was limited. See [HTTP Response Codes](/platform/news-api/http-response-codes). ## Article object fields Each article in the `results` array has the following structure: ```json { "id": "Unique article ID", "href": "URL of the original article", "published_at": "Publication date and time in ISO 8601 format", "title": "Article title", "description": "Brief article description", "body": "Full article text", "body_html": "Full article text with HTML formatting", "language": "Article language (ISO 639-1 code)", "translations": { "en": { "title": "Article title translated to English", "description": "Article description translated to English" } }, "author": { "id": "Author ID", "name": "Author name" }, "image": "URL of the main article image", "categories": [ { "id": "Category ID", "name": "Category name", "score": "Category relevance score for the article", "taxonomy": "Category taxonomy name", "links": { "self": "URL to get information about the category" } } ], "topics": [ { "id": "Topic ID", "name": "Topic name", "score": "Topic relevance score for the article", "links": { "self": "URL to get information about the topic" } } ], "industries": [ { "id": "Industry ID", "name": "Industry name", "links": { "self": "URL to get information about the industry" } } ], "entities": [ { "id": "Entity ID", "name": "Entity name", "type": "Entity type (person, location, organization, brand, product, natural-disaster, disease, event, sport, unknown)", "links": { "self": "URL to get information about the entity", "wikipedia": "Link to Wikipedia article", "wikidata": "Link to entity in Wikidata" }, "frequency": "Frequency of entity mentions in the article", "sentiment": { "score": "Sentiment score toward this entity (-1 to 1)", "polarity": "Sentiment polarity toward this entity (positive, negative, neutral)", "mentions": "Per-mention polarity counts (positive, neutral, negative)" }, "title": { "pos": "Array of entity mention positions in the title" }, "body": { "pos": "Array of entity mention positions in the article body" }, "metadata": "Additional entity information (varies by entity type)" } ], "source": { "id": "Source ID", "domain": "Source domain", "home_page_url": "URL of the source homepage", "type": "Source type (news, blog, etc.)", "bias": "Source bias", "rankings": { "opr": "Source ranking" }, "location": { "country_name": "Source country name", "country_code": "Source country code (ISO 3166-1 alpha-2)" }, "favicon": "Source favicon URL" }, "sentiment": { "overall": { "score": "Overall article sentiment score", "polarity": "Textual representation of sentiment (positive, negative, neutral)" }, "title": { "score": "Title sentiment score", "polarity": "Textual representation of title sentiment" }, "body": { "score": "Article body sentiment score", "polarity": "Textual representation of body sentiment" } }, "summary": [ { "sentence": "Key sentence from the article", "sentiment": { "score": "Sentence sentiment score", "polarity": "Textual representation of sentiment" } } ], "keywords": "Array of article keywords", "links": [ { "url": "URL mentioned in the article", "type": "Link type (link, etc.)" } ], "media": [ { "url": "Media file URL", "type": "Media file type (image, video, etc.)" } ], "locations_mentioned": [ { "name": "Location name", "country": "ISO 3166-1 alpha-2 country code", "lat": "Latitude (number or null)", "lng": "Longitude (number or null)", "type": "Location type (unknown if not classified)" } ], "readability": { "flesch_kincaid_grade": "Flesch-Kincaid grade level", "flesch_reading_ease": "Flesch reading ease score", "automated_readability_index": "Automated Readability Index (ARI)", "difficulty_level": "Difficulty level (beginner, intermediate, advanced, expert, unknown)", "target_audience": "Target audience (children, general, professional, academic, unknown)", "reading_age": "Estimated reading age", "avg_words_per_sentence": "Average words per sentence", "avg_syllables_per_word": "Average syllables per word" }, "story": { "id": "Story ID (equal to the article id)", "uri": "URL to get information about the story" }, "shares": { "total": "Total number of shares across all platforms", "facebook": "Number of Facebook shares", "twitter": "Number of Twitter/X shares", "reddit": "Number of Reddit shares" }, "is_duplicate": "Flag indicating if the article is a duplicate", "is_free": "Flag indicating if the article is freely available (not behind paywall)", "is_breaking": "Flag indicating if the article is breaking news", "read_time": "Estimated reading time in minutes", "sentences_count": "Number of sentences in the article", "paragraphs_count": "Number of paragraphs in the article", "words_count": "Number of words in the article", "characters_count": "Number of characters in the article" } ``` ### Article field reference {#detailed-description-of-article-fields} | Field | Type | Description | |--------------------|---------|------------------------------------------------------------------------------------------------------------------| | `id` | integer | Unique article ID. | | `href` | string | URL of the original article. | | `published_at` | string | Date and time of article publication in ISO 8601 format. | | `title` | string | Article headline. | | `description` | string | Short article summary. May be absent. | | `body` | string | Full article text without HTML tags. | | `body_html` | string | Full article text with HTML formatting. May be absent for some articles. | | `language` | string | Article language in ISO 639-1 format (two-letter code). | | `translations` | object | English translations of the title and description in `translations.en.title` and `translations.en.description`. The object is always present. Both fields are `null` for English articles and languages without translation support. The body is not translated. | | `author` | object | Author details. `id` may be `null` when unavailable. | | `image` | string | URL of the main article image. May be absent for some articles. | | `categories` | array | Categories assigned to the article. | | `topics` | array | Topics related to the article, with relevance scores. | | `industries` | array | Industries related to the article. | | `entities` | array | People, places, organizations and other entities mentioned in the article. | | `locations_mentioned` | array | Geographic locations mentioned in the article (`name`, `country`, `lat`, `lng`, `type`). | | `source` | object | Publisher details. | | `sentiment` | object | Tone of the article. | | `summary` | array | Key sentences from the article, each with its sentiment. | | `readability` | object | Readability metrics (Flesch-Kincaid grade, reading ease, ARI, difficulty level, target audience, reading age, avg words per sentence, avg syllables per word). | | `keywords` | array | Keywords found in the article. | | `links` | array | URLs mentioned in the article, with their link types. | | `media` | array | Images and videos associated with the article, with their URLs and types. | | `story` | object | The article's story ID (`id`) and API URL (`uri`). | | `shares` | object | Share counts by social media platform. | | `is_duplicate` | boolean | `true` if the article duplicates another article. | | `is_free` | boolean | `true` if the article can be read without paying. | | `is_breaking` | boolean | `true` if the article is breaking news. | | `read_time` | integer | Estimated reading time in minutes. | | `sentences_count` | integer | Number of sentences in the article. | | `paragraphs_count` | integer | Number of paragraphs in the article. | | `words_count` | integer | Number of words in the article. | | `characters_count` | integer | Number of characters in the article. | ### Nested objects {#detailed-description-of-nested-objects} #### Category object ```json { "id": 258, "name": "exporting", "score": 0.6, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:20000366" } } ``` | Field | Type | Description | |------------|---------|--------------------------------------------------------| | `id` | integer | Unique category ID. | | `name` | string | Category name. | | `score` | float | Category relevance score for the article (from 0 to 1). | | `taxonomy` | string | Category system this category belongs to. | | `links` | object | Links related to the category. | #### Topic object ```json { "id": "market_news.commodities.potash", "name": "Potash Market News", "score": 0.2, "links": { "self": "https://api.apitube.io/v1/news/topic/market_news.commodities.potash" } } ``` | Field | Type | Description | |---------|--------|------------------------------------------------------| | `id` | string | Unique topic ID. | | `name` | string | Topic name. | | `score` | float | Topic relevance score for the article (from 0 to 1). | | `links` | object | Links related to the topic. | #### Industry object ```json { "id": 1067, "name": "Sporting event", "links": { "self": "https://api.apitube.io/v1/news/industry/1067" } } ``` | Field | Type | Description | |---------|---------|--------------------------------------------| | `id` | integer | Unique industry ID. | | `name` | string | Industry name. | | `links` | object | Links related to the industry. | #### Entity object ```json { "id": 1034399, "name": "Germany", "type": "location", "links": { "self": "https://api.apitube.io/v1/news/entity/1034399", "wikipedia": "https://en.wikipedia.org/wiki/Germany", "wikidata": "https://www.wikidata.org/wiki/Q183" }, "frequency": 3, "sentiment": { "score": -0.42, "polarity": "negative", "mentions": { "positive": 1, "neutral": 0, "negative": 2 } }, "title": { "pos": [{ "start": 7, "end": 14 }] }, "body": { "pos": [ { "start": 113, "end": 120 }, { "start": 852, "end": 859 } ] }, "metadata": { "name": "Germany", "type": "country", "aliases": ["Federal Republic of Germany"], "country": { "code": "DE", "name": "Germany" }, "full_name": "Germany, Germany", "is_capital": false, "population": 83577140, "coordinates": { "lat": 51, "lng": 10 }, "description": "Country in Central Europe" } } ``` | Field | Type | Description | |-------------|---------|-------------------------------------------------------------------------------------------| | `id` | integer | Unique entity ID. | | `name` | string | Entity name. | | `type` | string | Entity type: `person`, `location`, `organization`, `brand`, `product`, `natural-disaster`, `disease`, `event`, `sport` or `unknown`. Name filters are available for eight types: `person.name`, `location.name`, `organization.name`, `brand.name`, `disaster.name`, `disease.name`, `event.name` and `sport.name`. Use `entity.id` for `product` or `unknown`. There is no `product.name` filter; that parameter is ignored. | | `links` | object | Links to API, Wikipedia and Wikidata pages about the entity. | | `frequency` | integer | Number of times the entity is mentioned in the article. | | `sentiment` | object | Tone toward this entity across all its mentions: `score` (-1 to 1), `polarity` (`positive`/`negative`/`neutral`), and `mentions` (counts of `positive`, `neutral` and `negative` mentions). | | `title` | object | Positions where the entity appears in the article title. | | `body` | object | Positions where the entity appears in the article body. | | `metadata` | object | Entity details; available fields depend on the entity type. | The fields in entity `metadata` depend on `type`: * **Person:** `name`, `title`, `gender`, `aliases`, `bio_summary`, `nationality`, `organization`, `date_of_birth`, `social_profiles`, `is_real_person`, `is_public_figure`, `public_profile_url`. * **Location:** `full_name`, `country`, `coordinates`, `population`, `is_capital`, `description`. * **Organization or brand:** `description`, `website_url`, `logo_url`, `brand_owner`, `category`, `subcategory`. A field with no value is `null`. Handle this in your code. #### Source object ```json { "id": 4232, "domain": "newsbytesapp.com", "home_page_url": "https://www.newsbytesapp.com", "type": "news", "bias": "right", "rankings": { "opr": 5 }, "location": { "country_name": "India", "country_code": "in" }, "favicon": "https://www.google.com/s2/favicons?domain=https://www.newsbytesapp.com" } ``` | Field | Type | Description | |-----------------|---------|----------------------------------------------------------| | `id` | integer | Unique source ID. | | `domain` | string | Source domain. | | `home_page_url` | string | URL of the source homepage. | | `type` | string | Source type (e.g., "news", "blog"). | | `bias` | string | Source bias (e.g., "left", "right", "center"). | | `rankings` | object | Source ratings and metrics. | | `location` | object | Publisher location. | | `favicon` | string | URL of the source favicon. | #### Author object ```json { "id": 5678, "name": "John Smith" } ``` | Field | Type | Description | |---------|---------|---------------------------------------------------------------------| | `id` | integer | Author ID, or null when unavailable. | | `name` | string | Author name, or an empty string when unavailable. | #### Sentiment object ```json { "overall": { "score": -0.01, "polarity": "neutral" }, "title": { "score": -0.09, "polarity": "negative" }, "body": { "score": 0.07, "polarity": "positive" } } ``` | Field | Type | Description | |-----------|--------|---------------------------------------| | `overall` | object | Tone of the article as a whole. | | `title` | object | Tone of the article title. | | `body` | object | Tone of the article body. | Each sentiment object contains: * `score` (float): a number from -1 to 1. Negative numbers mean negative sentiment; positive numbers mean positive sentiment. * `polarity` (string): the sentiment label: `"positive"`, `"negative"` or `"neutral"`. #### Summary object ```json { "sentence": "an official said, highlighting the importance of this European nation in India", "sentiment": { "score": 0.17, "polarity": "positive" } } ``` | Field | Type | Description | |------------|--------|-------------------------------------------------------| | `sentence` | string | Key sentence extracted from the article. | | `sentiment`| object | Tone of this sentence. | #### Story object ```json { "id": 3019419820, "uri": "https://api.apitube.io/v1/news/story/3019419820" } ``` | Field | Type | Description | |-------|---------|-------------------------------------------------------------| | `id` | integer | Currently the same as the article's own `id`. There is no separate ID for the group of related articles. | | `uri` | string | API URL for the story's details, using the article `id`. | #### Shares object ```json { "total": 288, "facebook": 149, "twitter": 74, "reddit": 65 } ``` | Field | Type | Description | |------------|---------|--------------------------------------------------| | `total` | integer | Total number of shares across all platforms. | | `facebook` | integer | Number of Facebook shares. | | `twitter` | integer | Number of Twitter/X shares. | | `reddit` | integer | Number of Reddit shares. | #### Links object ```json { "url": "https://www.newsbytesapp.com/news/world/belgium", "type": "link" } ``` | Field | Type | Description | |--------|--------|----------------------------------------| | `url` | string | URL mentioned in the article. | | `type` | string | Link type (typically "link"). | #### Media object ```json { "url": "https://i.cdn.newsbytesapp.com/images/l82720260111162041.jpeg", "type": "image" } ``` | Field | Type | Description | |--------|--------|-------------------------------------------| | `url` | string | Media file URL. | | `type` | string | Media file type (e.g., "image", "video"). | ## Error response If a request fails, check the HTTP status and the error details. For example, an authentication error returns `401`: ```json { "status": 401, "code": "ER0175", "message": "Your API key is invalid or missing.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" } } ``` | Field | Type | Description | |-----------|---------|-----------------------------------------------------| | `status` | integer | HTTP status code of the error. | | `code` | string | Error identifier for handling errors in your code. | | `message` | string | Human-readable error message. | | `links` | object | Links to documentation about the error. | ## Error codes | Code | HTTP status | Description | |---------------------|-------------|--------------------------------------------------| | `invalid_api_key` | 401 | Invalid or missing API key. | | `unauthorized` | 401 | The API key does not have permission for this request. | | `quota_exceeded` | 429 | Request limit exceeded. | | `invalid_parameter` | 400 | Invalid parameter value. | | `missing_parameter` | 400 | Missing required parameter. | | `internal_error` | 500 | Internal server error. | ## Pagination Results are split into pages. The first request returns page 1. Use `page` to choose another page and `per_page` to set its size. The response's `limit` shows the number of items per page. Example of pagination request: ```text https://api.apitube.io/v1/news/everything?title=technology&page=2&per_page=20 ``` Response with pagination information: ```json { "status": "ok", "limit": 20, "path": "https://api.apitube.io/v1/news/everything?title=technology&page=2&per_page=20", "page": 2, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/everything?title=technology&page=3&per_page=20", "has_previous_page": true, "previous_page": "https://api.apitube.io/v1/news/everything?title=technology&page=1&per_page=20", "results": [ // Article objects ] } ``` ## Trends endpoint response structure The `/v1/news/trends` response groups counts by the fields you request. Its format depends on whether you choose one field or several. ### Single field response With one field, `trends` is an array: ```json { "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" } ``` ### Multiple fields response With several comma-separated fields, results are grouped by field name. Each field has its own `total_count` and `total_articles`: ```json { "status": "ok", "fields": ["entity.id", "category.id"], "per_page": 10, "offset": 0, "sort": "count", "order": "desc", "mincount": 1, "trends": { "entity.id": { "trends": [...], "total_count": 1500, "total_articles": 45000 }, "category.id": { "trends": [...], "total_count": 200, "total_articles": 45000 } }, "request_id": "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6" } ``` ### Trends response fields | Field | Type | Description | |------------------|---------|-----------------------------------------------------------------------------| | `status` | string | Request status ("ok" or "error"). | | `field` | string | The requested field (single field mode only). | | `fields` | array | Requested fields, present only when you request several fields. | | `per_page` | integer | Number of trends per page. | | `offset` | integer | Number of trends to skip. | | `total_count` | integer | Total number of unique values for the field. | | `total_articles` | integer | Sum of `count` for all values of the requested field. Used to calculate `percentage`. For `source.id`, each article has one value, so this is also the article count. For `category.id`, `topic.id`, `industry.id` and `entity.id`, an article is counted once for each value it contains. The total can therefore exceed the number of articles. | | `sort` | string | Sort field used ("count", "value", "growth\_rate"; "change", "trending\_score" with compare=true). | | `order` | string | Sort order ("asc" or "desc"). | | `mincount` | integer | Minimum article count required for a trend. | | `trends` | array/object | With one field, an array of trends. With several fields, an object keyed by field name. | | `request_id` | string | Unique request ID. | | `percentile` | integer | Percentile filter applied (optional, 1-100). | | `time_bucket` | string | Interval used for grouping counts: hour, day, week or month (optional). | | `compare_window` | string | Period used for the comparison (optional, for example "7DAYS"). | | `trending_days` | integer | Number of days used for trending calculation (optional, 7-30). | | `cached` | boolean | Whether the API reused a previously saved response (optional). | ### Trend object structure Each trend object in the `trends` array contains: ```json { "value": { "id": 1034399, "name": "Germany", "type_id": 2, "wikidata_id": "Q183" }, "count": 523, "percentage": 1.16, "growth_rate": 2.5, "previous_count": 400, "change_absolute": 123, "change_percent": 30.75, "trending_score": 1.85, "trending_history": { "2024-01-01": 10, "2024-01-02": 15, "2024-01-03": 25 } } ``` | Field | Type | Description | |--------------------|--------------|--------------------------------------------------------------------------| | `value` | object/mixed | The field value, with details when available. See the table below. | | `count` | integer | Number of articles containing this value. | | `percentage` | float | Percentage of total articles (0-100). | | `growth_rate` | float | Number of articles per hour (`null` when unavailable). | | `previous_count` | integer | Count in previous period (only with `compare=true`). | | `change_absolute` | integer | Absolute change from previous period (only with `compare=true`). | | `change_percent` | float | Percentage change from previous period (only with `compare=true`). | | `trending_score` | float | Score comparing recent article counts with the historical average (only with `trending=true`). | | `trending_history` | object | Daily counts for trending period (only with `trending=true`). | ### Trend object with time\_bucket With `time_bucket`, each trend includes counts by period. Values are returned as IDs without names or other metadata: ```json { "value": 1034399, "buckets": { "2024-01-15": 100, "2024-01-16": 150, "2024-01-17": 200 }, "total": 450 } ``` | Field | Type | Description | |----------|---------|------------------------------------------------------------------| | `value` | mixed | The raw field value (ID). With `time_bucket`, names and other details are omitted. | | `buckets` | object | Count for each time interval. Keys are dates formatted for the selected interval. | | `total` | integer | Total count across all time intervals. | Date formats used as interval keys: * `hour`: `"2024-01-15 14:00"` * `day`: `"2024-01-15"` * `week`: `"2024-01-15"` (start of week) * `month`: `"2024-01"` ### Value details by field {#enriched-value-formats-by-field} The details returned in `value` depend on the field you request: | Field | Value format | |---------------|-----------------------------------------------------------| | `entity.id` | `{ id, name, type_id, wikidata_id }` | | `category.id` | `{ id, name, taxonomy }` | | `topic.id` | `{ id, name }` | | `industry.id` | `{ id, name }` | | `source.id` | `{ id, name, domain }` | ### Trends request parameters | Parameter | Type | Values | Default | |------------------|---------|-----------------------------------------------------------|-----------| | `field` | string | `source.id`, `category.id`, `topic.id`, `industry.id`, `entity.id` (comma-separated, max 5) | required | | `sort` | string | `count`, `value`, `growth_rate` (+ `change`, `trending_score` with compare=true) | `count` | | `order` | string | `asc`, `desc` | `desc` | | `per_page` | integer | 1-100 | 10 | | `offset` | integer | >= 0 | 0 | | `mincount` | integer | 1-10000 | 1 | | `time_bucket` | string | `hour`, `day`, `week`, `month` (anything else → `400 ER0308`) | - | | `compare` | boolean | `true`, `false` | `false` | | `compare_window` | string | `24HOURS`, `7DAYS`, `1WEEK`, `2m`, etc. | required if compare=true | | `trending` | boolean | `true`, `false` | `false` | | `trending_days` | integer | 7-30 | 14 | | `percentile` | integer | 1-100 (outside the range → `400 ER0307`) | - | **Important limitations:** * Maximum date range for trends: **30 days**. If no dates specified, defaults to last 30 days. * Maximum 5 fields per request. ### Trends example request ```http GET /v1/news/trends?field=entity.id&compare=true&compare_window=7DAYS&trending=true&per_page=5 ``` ### Trends example response ```json { "status": "ok", "field": "entity.id", "per_page": 5, "offset": 0, "total_count": 15420, "total_articles": 125000, "sort": "count", "order": "desc", "mincount": 1, "compare_window": "7DAYS", "trending_days": 14, "trends": [ { "value": { "id": 1034399, "name": "Germany", "type_id": 2, "wikidata_id": "Q183" }, "count": 2341, "percentage": 1.87, "growth_rate": 4.2, "previous_count": 1890, "change_absolute": 451, "change_percent": 23.86, "trending_score": 1.45, "trending_history": { "2024-01-01": 120, "2024-01-02": 145, "2024-01-03": 180, "2024-01-04": 210, "2024-01-05": 195 } } ], "request_id": "b2c3d4e5-f6g7-8h9i-0j1k-l2m3n4o5p6q7" } ``` ## Reference endpoints response structure ::: tip Added in 1.0.42 Applies to the [People](/platform/news-api/reference/people), [Companies](/platform/news-api/reference/companies) and [Journalists](/platform/news-api/reference/journalists) endpoints. ::: List endpoints (`/v1/people`, `/v1/companies`, `/v1/journalists`) return a page of profiles. Profile endpoints (`/v1/{resource}/{id}`) return one profile with `coverage` and `recent_articles`. ### List response format {#list-response-envelope} | Field | Type | Description | |------------------|---------|----------------------------------------------| | `status` | string | `ok` on success. | | `limit` | integer | Results per page. | | `page` | integer | Current page number. | | `has_next_pages` | boolean | Whether more pages are available. | | `results` | array | Array of profile objects (see below). | ### Person / Company object ```json { "id": 1316868, "name": "Michelle Obama", "type": "person", "links": { "self": "https://api.apitube.io/v1/people/1316868", "articles": "https://api.apitube.io/v1/news/entity/1316868", "wikipedia": "https://en.wikipedia.org/wiki/Michelle_Obama", "wikidata": "https://www.wikidata.org/wiki/Q13133" }, "profile": { "title": "attorney at law", "gender": "female", "nationality": "United States" }, "coverage": { "...": "see Coverage object" }, "recent_articles": [ "... Article objects ..." ] } ``` | Field | Type | Description | |-------------------|--------|---------------------------------------------------------------------------------------------------| | `id` | integer| Entity ID (use with `/v1/people/{id}` or `/v1/companies/{id}`). | | `name` | string | Display name. | | `type` | string | Entity type (`person`, `organization`, `brand`, …). | | `links` | object | `self`, `articles`, `wikipedia`, `wikidata`. | | `profile` | object | Background details. People: `title`, `bio_summary`, `gender`, `nationality`, `date_of_birth`, `social_profiles`, `aliases`. Companies: `headquarters`, `founded`, `website_url`, `logo_url`, `key_people`, `subsidiaries`. | | `coverage` | object | Coverage block (profile responses only). See **Coverage object**. | | `recent_articles` | array | Latest articles mentioning the entity ([Article object](#article-object-fields)). | ### Journalist object | Field | Type | Description | |-----------------|---------|-----------------------------------------------------------------------------| | `id` | integer | Journalist (author) ID. | | `name` | string | Journalist name. | | `outlets` | array | Publishers associated with this name: `{ id, name, domain }`. Bylines with the same name are grouped together. | | `outlet_count` | integer | Number of outlets (list responses only). | | `links` | object | `self`, `articles`. | | `coverage` | object | Coverage block (profile responses only); includes `top_entities`. | | `recent_articles` | array | The journalist's latest articles. | ### Coverage object ```json { "article_count": 180, "first_seen": "2017-01-06", "last_seen": "2026-03-03", "sentiment": { "positive": 47, "neutral": 95, "negative": 27 }, "momentum": { "last_30_days": 12, "previous_30_days": 8, "change_pct": 50 }, "timeline": [ { "period": "2026-02-01", "count": 13 } ], "top_sources": [ { "id": 342, "name": "cbc.ca", "domain": "cbc.ca", "count": 9 } ], "top_topics": [ { "id": "politics", "name": "Politics", "count": 70 } ], "top_countries": [ { "id": 102, "name": "United States", "code": "us", "count": 55 } ], "top_languages": [ { "id": 1, "name": "English", "code": "en", "count": 118 } ], "related_entities": [ { "id": 1316867, "name": "Barack Obama", "count": 348 } ] } ``` | Field | Type | Description | |--------------------|---------|----------------------------------------------------------------------------------------| | `article_count` | integer | Total matching articles. | | `first_seen` | string | Date of the earliest matching article (`YYYY-MM-DD`), or `null`. | | `last_seen` | string | Date of the latest matching article (`YYYY-MM-DD`), or `null`. | | `sentiment` | object | Article counts by overall tone: `positive`, `neutral`, `negative`. | | `momentum` | object | `last_30_days`, `previous_30_days`, and `change_pct` (percentage change, `null` if no prior data). | | `timeline` | array | Monthly counts (chronological, up to 24 months): `{ "period": "YYYY-MM-01", "count" }`. | | `top_sources` | array | Top sources by article count (people/companies/sources): `{ id, name, domain, count }`. | | `top_topics` | array | Topics most often found in matching articles: `{ id, name, count }`. | | `top_countries` | array | Countries represented in the coverage: `{ id, name, code, count }`. | | `top_languages` | array | Languages used in matching articles: `{ id, name, code, count }`. | | `related_entities` | array | People, companies or other entities most often mentioned together with this subject: `{ id, name, count }`. | | `top_entities` | array | Entities the journalist covers most (journalists only): `{ id, name, count }`. | ## API response example ```json { "status": "ok", "limit": 2, "path": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=json", "xlsx": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=xlsx", "csv": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=csv", "tsv": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=tsv", "xml": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=xml", "rss": "https://api.apitube.io/v1/news/everything?language.code=en&per_page=2&page=1&export=rss" }, "request_id": "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6", "results": [ { "id": 12345678, "href": "https://example.com/tech/new-smartphone-release", "published_at": "2023-06-15T10:30:00Z", "title": "New XYZ Smartphone Makes Waves in the Market", "description": "XYZ Company has introduced a new flagship smartphone that significantly outperforms competitors in performance and camera quality.", "body": "Today, XYZ Company introduced its new flagship smartphone. The device is equipped with the latest generation processor and a revolutionary camera that, according to the manufacturer, is capable of taking professional quality photos even in low light conditions. Industry experts have already highly rated the novelty, noting its excellent performance and innovative features.", "body_html": "

Today, XYZ Company introduced its new flagship smartphone. The device is equipped with the latest generation processor and a revolutionary camera that, according to the manufacturer, is capable of taking professional quality photos even in low light conditions. Industry experts have already highly rated the novelty, noting its excellent performance and innovative features.

", "language": "en", "translations": { "en": { "title": null, "description": null } }, "author": { "id": 5678, "name": "John Smith" }, "image": "https://example.com/images/xyz-smartphone.jpg", "categories": [ { "id": 199, "name": "economy, business and finance", "score": 0.6, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:04000000" } } ], "topics": [ { "id": "industry.financial_news", "name": "Finance Industry News", "score": 0.1, "links": { "self": "https://api.apitube.io/v1/news/topic/industry.financial_news" } } ], "industries": [ { "id": 456, "name": "Consumer Electronics", "links": { "self": "https://api.apitube.io/v1/news/industry/456" } } ], "entities": [ { "id": 789, "name": "XYZ Company", "type": "organization", "links": { "self": "https://api.apitube.io/v1/news/entity/789", "wikipedia": "https://en.wikipedia.org/wiki/XYZ_Company", "wikidata": "https://www.wikidata.org/wiki/Q12345" }, "frequency": 3, "title": { "pos": [ { "start": 4, "end": 15 } ] }, "body": { "pos": [ { "start": 6, "end": 17 }, { "start": 122, "end": 133 } ] }, "metadata": { "name": "XYZ Company", "type": "business", "country": { "code": "US", "name": "United States" }, "description": "Technology company" } } ], "source": { "id": 123, "domain": "example.com", "home_page_url": "https://example.com", "type": "news", "bias": "center", "rankings": { "opr": 8 }, "location": { "country_name": "United States", "country_code": "us" }, "favicon": "https://example.com/favicon.ico" }, "sentiment": { "overall": { "score": 0.45, "polarity": "positive" }, "title": { "score": 0.3, "polarity": "positive" }, "body": { "score": 0.6, "polarity": "positive" } }, "summary": [ { "sentence": "Today, XYZ Company introduced its new flagship smartphone.", "sentiment": { "score": 0.2, "polarity": "positive" } }, { "sentence": "Industry experts have already highly rated the novelty, noting its excellent performance and innovative features.", "sentiment": { "score": 0.8, "polarity": "positive" } } ], "keywords": ["smartphone", "XYZ", "technology"], "links": [ { "url": "https://example.com/related/xyz-previous-model", "type": "link" } ], "media": [ { "url": "https://example.com/images/xyz-smartphone.jpg", "type": "image" }, { "url": "https://example.com/videos/xyz-smartphone-preview.mp4", "type": "video" } ], "locations_mentioned": [ { "name": "San Francisco", "country": "US", "lat": 37.7749, "lng": -122.4194, "type": "city" } ], "readability": { "flesch_kincaid_grade": 9.2, "flesch_reading_ease": 58.4, "automated_readability_index": 10.1, "difficulty_level": "intermediate", "target_audience": "general", "reading_age": 14, "avg_words_per_sentence": 18.3, "avg_syllables_per_word": 1.5 }, "story": { "id": 3019419820, "uri": "https://api.apitube.io/v1/news/story/3019419820" }, "shares": { "total": 288, "facebook": 149, "twitter": 74, "reddit": 65 }, "is_duplicate": false, "is_free": true, "is_breaking": false, "read_time": 2, "sentences_count": 3, "paragraphs_count": 1, "words_count": 60, "characters_count": 354 } ] } ``` ## Notes 1. **Missing fields:** A field may be absent if the article has no value for it or your plan does not include it. 2. **Date format**: All dates in the API are returned in ISO 8601 format (e.g., "2023-06-15T10:30:00Z"). 3. **Content limitations**: Depending on the subscription plan, the `body` and `body_html` fields may contain the full text of the article or only a part of it. 4. **Language and country**: The `language` field and the `source.location.country_code` field use standard ISO codes (ISO 639-1 for languages and ISO 3166-1 alpha-2 for countries). 5. **Sentiment**: The `score` value ranges from -1 to 1, where negative values correspond to negative sentiment, and positive values to positive sentiment. 6. **Translations**: `translations.en.title` and `translations.en.description` contain English translations. The original fields stay unchanged, and the article body is not translated. Every response includes the block without an extra parameter. For English articles, its fields are `null`. Translated fields are full on every plan, including Free; only `body` and `body_html` are shortened on Free. 7. **Entity metadata**: `metadata` contains extra details about the entity. Available fields depend on its type, such as location, organization or brand. --- --- url: 'https://docs.apitube.io/platform/news-api/ai/agent-skills.md' description: >- Discoverable Agent Skills for the APITube News API and hosted MCP server, served from /.well-known/ for agents to find and use on their own. --- # Agent Skills [Agent Skills](https://agentskills.io/) are instruction files that explain how to use a service. Agents can find APITube's skills under `/.well-known/` and read how to send requests and handle responses. ## Discovery index The index lists every published skill, its description and a hash you can use to check whether its content has changed: * ## Published skills ### apitube-news-api Instructions for calling the News API over HTTP: authentication, endpoints, `/news/everything` filters, JSON responses and rate limits. * Use this when an agent should build and send API requests itself. ### apitube-mcp Instructions for connecting an assistant to the [MCP Server](/platform/news-api/ai/mcp-server) and searching news in plain language. * The MCP server exposes two tools: **`search_news`**, which searches articles with filtering by title/keywords, language, sentiment, entities, media, source quality, breaking-news flag, and date ranges, and **`suggest`**, which resolves a name or prefix to APITube entity/category/topic/industry IDs. ## MCP server card MCP clients can read the server's capabilities from its server card: * ## Next steps * Connect an assistant now: [Code Editors Setup](/platform/news-api/ai/code-editors) * Full HTTP reference: [Parameters](/platform/news-api/filters#parameters) --- --- url: 'https://docs.apitube.io/platform/news-api/articles.md' description: >- Choose an APITube endpoint for article search, headlines, local news, topic feeds, related coverage or lookup by ID. --- # Article endpoints Choose an endpoint based on which articles you need: a search result, a category or topic feed, local news, or articles by ID. Article endpoints use the same response format and pagination. Most also share the same filters. Start with [`/v1/news/everything`](/platform/news-api/everything) for a general search. Other endpoints offer more specific selections. ## Which one do I need? | You want | Endpoint | Guide | |:---------|:---------|:------| | Search or monitor the whole archive | `GET /v1/news/everything` | [Search articles](/platform/news-api/everything) | | A front page or breaking-news feed | `GET /v1/news/top-headlines` | [Top headlines](/platform/news-api/top-headlines) | | Everything in one IPTC category | `GET /v1/news/category/{taxonomy}/{category_id}` | [Articles by category](/platform/news-api/category) | | A subject such as automotive news or commodities | `GET /v1/news/topic/{topic_id}` | [Articles by topic](/platform/news-api/topic) | | Coverage of a business sector | `GET /v1/news/industry/{industry_id}` | [Articles by industry](/platform/news-api/industry) | | Everything mentioning a person, company, brand or place | `GET /v1/news/entity/{entity_id}` | [Articles by entity](/platform/news-api/entity) | | News near a point on the map, sorted by distance | `GET /v1/news/local` | [Local news](/platform/news-api/local) | | The earliest available articles in a basic format | `GET /v1/news/raw` | [Raw articles (Lite)](/platform/news-api/raw) | | One article, or up to 100, by ID | `GET /v1/news/article` | [Get an article by ID](/platform/news-api/article) | | Every outlet that covered the same event | `GET /v1/news/story/{article_id}` | [Get a story](/platform/news-api/story) | ## Search and headlines Use [`/v1/news/everything`](/platform/news-api/everything) to search with any of the available filters. You can sort results, browse pages, count articles by field, highlight matches and export data. Send filters in the URL with `GET` or as JSON with `POST`. POST is useful for long queries or lists of source IDs. Use [`/v1/news/top-headlines`](/platform/news-api/top-headlines) for a front page or headline feed. It only returns articles from publishers with an Open Page Rank of 5 or above. ## Browse by subject {#browse-by-taxonomy} These endpoints select one category, topic, industry or entity in the URL path. Add filters to narrow the results: * **[Category](/platform/news-api/category)** — IPTC Media Topics, the section the article belongs to. Values come from [List of Categories](/platform/news-api/list-of-categories). * **[Topic](/platform/news-api/topic)** — a subject such as automotive news (`industry.automotive_news`) or base metals (`market_news.commodities.base_metals`). A topic feed returns articles about your subject across news categories. * **[Industry](/platform/news-api/industry)** — the business sector an article covers. * **[Entity](/platform/news-api/entity)** — a person, organization, brand, location or product recognised in the text. The filter finds articles about Apple the company, without matching mentions of the fruit. To find an ID, search by the beginning of a name with the [autocomplete endpoints](/platform/news-api/reference-data). ## Geography and the discovery feed [`/v1/news/local`](/platform/news-api/local) takes `lat`/`lng` or a `place` name, ranks results by proximity, and adds `distance_km` and `nearest_location` to every article — which the plain geo filter on `/v1/news/everything` does not do. Use [`/v1/news/raw`](/platform/news-api/raw) for the earliest available articles or to process the content yourself. It returns a basic format without detected language, categories, topics, entities or sentiment. Only roughly the **last 24 hours** are available. ## Lookup by ID Use [`/v1/news/article`](/platform/news-api/article) to fetch saved articles again. Pass one `id` or up to 100 IDs separated by commas. Use [`/v1/news/story/{article_id}`](/platform/news-api/story) to find other articles about the same event. ## Shared features and endpoint differences {#what-every-article-endpoint-shares} * **The same response format** — articles under `results`, article links under `href`, paging through `next_page`. See [API Response Structure](/platform/news-api/response-structure). * **Shared search filters** — documented in full on [Filters](/platform/news-api/filters). [Article lookup](/platform/news-api/article) and [Story lookup](/platform/news-api/story) ignore `prompt`; [Raw articles](/platform/news-api/raw) supports a smaller parameter set. Each API reference page lists its own parameters and restrictions. * **The same pricing** — 1 point per request, plus 2 more when you use the `prompt` parameter (Basic and above; Free and Starter get `403 ER0706`), and 1 extra per requested `insights` block on [`/v1/news/local`](/platform/news-api/local#billing). Check the balance with [`/v1/balance`](/platform/news-api/balance). * **Check parameter names.** An unknown filter is ignored even when the request returns `200 ok`. Use the names in the parameter tables. ## Next steps * Copy a working request: [Usage examples](/platform/news-api/common-workflows/examples/) * Get articles pushed instead of polled: [Real-time delivery](/platform/news-api/real-time) * Count or aggregate instead of listing: [Insights](/platform/news-api/insights) --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/article-examples.md description: Examples of retrieving specific articles by ID in News API --- # Article Query Examples ## Get one article by ID {#retrieve-a-single-article-by-id} Fetch one article by its ID. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") 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) } ``` ```java [Java] 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/article?id=3036291250&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250 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/everything ``` ::: ## Export an article as JSON {#export-a-specific-article-as-json} Fetch an article as JSON. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&export=json&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "export": "json", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "export": "json", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "export" => "json", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("export", "json") 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) } ``` ```java [Java] 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/article?id=3036291250&export=json&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&export=json 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/everything ``` ::: ## Export an article as XML {#export-a-specific-article-as-xml} Export an article as XML. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&export=xml&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "export": "xml", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "export": "xml", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "export" => "xml", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("export", "xml") 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) } ``` ```java [Java] 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/article?id=3036291250&export=xml&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&export=xml 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/everything ``` ::: ## Export an article as XLSX {#export-a-specific-article-as-xlsx} Export an article as an Excel spreadsheet. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&export=xlsx&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "export": "xlsx", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "export": "xlsx", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "export" => "xlsx", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("export", "xlsx") 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) } ``` ```java [Java] 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/article?id=3036291250&export=xlsx&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&export=xlsx 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/everything ``` ::: ## Export an article as CSV {#export-a-specific-article-as-csv} Export an article as CSV. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&export=csv&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "export": "csv", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "export": "csv", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "export" => "csv", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("export", "csv") 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) } ``` ```java [Java] 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/article?id=3036291250&export=csv&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&export=csv 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/everything ``` ::: ## Get several articles by ID {#retrieve-multiple-specific-articles} Fetch several articles by their IDs. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250,3036291468,3036291704&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250,3036291468,3036291704", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250,3036291468,3036291704", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250,3036291468,3036291704", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250,3036291468,3036291704") 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) } ``` ```java [Java] 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/article?id=3036291250,3036291468,3036291704&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250,3036291468,3036291704 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/everything ``` ::: ## Get article analysis fields {#retrieve-and-analyze-a-specific-article} Get an article with sentiment, readability and summary fields. Use `fl` to choose which fields to return. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&fl=id,title,sentiment,readability,summary&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "fl": "id,title,sentiment,readability,summary", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "fl": "id,title,sentiment,readability,summary", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "fl" => "id,title,sentiment,readability,summary", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("fl", "id,title,sentiment,readability,summary") 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) } ``` ```java [Java] 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/article?id=3036291250&fl=id,title,sentiment,readability,summary&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&fl=id,title,sentiment,readability,summary 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/everything ``` ::: ## Get article entities {#retrieve-article-with-entity-extraction} Get an article with its `entities` and `locations_mentioned`. Use `fl` to return only these fields. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&fl=id,title,entities,locations_mentioned&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "fl": "id,title,entities,locations_mentioned", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "fl": "id,title,entities,locations_mentioned", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "fl" => "id,title,entities,locations_mentioned", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("fl", "id,title,entities,locations_mentioned") 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) } ``` ```java [Java] 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/article?id=3036291250&fl=id,title,entities,locations_mentioned&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&fl=id,title,entities,locations_mentioned 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/everything ``` ::: ## Choose an export format {#export-a-specific-article} Choose an export format: `json`, `csv`, `tsv`, `xml`, `rss`, `xlsx`, `parquet`, `jsonl` or `ndjson`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&export=xml&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/article", params={ "id": "3036291250", "export": "xml", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "id": "3036291250", "export": "xml", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/article?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["id" => "3036291250", "export" => "xml", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/article?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/article") q := u.Query() q.Set("id", "3036291250") q.Set("export", "xml") 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) } ``` ```java [Java] 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/article?id=3036291250&export=xml&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/article?id=3036291250&export=xml 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/category.md' description: >- Get articles in a category with /v1/news/category/{taxonomy}/{category_id}. Find path parameters, request examples, response format and errors. --- # Get articles by category with `/v1/news/category/{taxonomy}/{category_id}` Get articles in a specific category with `/v1/news/category/{taxonomy}/{category_id}`. Add [shared filters](/platform/news-api/filters) to narrow the results. Each request costs **1 point**. Using the `prompt` parameter adds **2 points**; `prompt` requires Basic or above. ## Endpoint ``` GET /v1/news/category/{taxonomy}/{category_id} POST /v1/news/category/{taxonomy}/{category_id} ``` Base URL: `https://api.apitube.io`. Example: `/v1/news/category/iptc_mediatopics/medtop:04000000`. The directory supports four category systems: `iptc_mediatopics`, `apitube`, `iab-qag` and `iptc-subjectcode`. [Category autocomplete](/platform/news-api/suggest/categories) searches all four. Only two currently return articles: | Taxonomy | Categories | Articles | |----------|------------|----------| | `iptc_mediatopics` | 1085 | the classified archive | | `apitube` | `uncategorized` only | ~9.7M unclassified articles | | `iab-qag` | IAB QAG codes (`IAB12`, `IAB24`, …) | none | | `iptc-subjectcode` | legacy numeric subject codes | none | Categories from the two empty systems return no results. Check a category with [`/v1/news/count`](/platform/news-api/count) before using it in a feed. An unknown taxonomy name in the path returns `404 ER0242`. ## Path vs. the `category.id` filter You can select a category in the URL path or with a filter: | | Path form | Filter form | |---|---|---| | Request | `/v1/news/category/iptc_mediatopics/medtop:04000000` | `/v1/news/everything?category.id=medtop:04000000` | | Categories per request | One | Several, comma-separated | | Exclusion | Not available | `ignore.category.id` | | Unknown ID | `404 ER0241` | `400 ER0206` | Use the path for a single-category feed or page. Use `category.id` to combine categories or exclude them. ## Where category IDs come from * [List of Categories](/platform/news-api/list-of-categories) — the full IPTC Media Topics tree. * [`/v1/suggest/categories`](/platform/news-api/suggest/categories) to suggest categories as a user types. * The `categories` array of any article in a response; `links.self` there already contains a ready-made category URL. ## Parameters ### Path parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `taxonomy` | string | Yes | Category system, for example iptc\_mediatopics. | | `category_id` | string | Yes | Category ID. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all article fields. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:04000000?language.code=en&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:04000000", params={"language.code": "en", "per_page": 10}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"]) ``` ```javascript [Node.js] const taxonomy = 'iptc_mediatopics'; const categoryId = 'medtop:04000000'; const response = await fetch( `https://api.apitube.io/v1/news/category/${taxonomy}/${encodeURIComponent(categoryId)}?language.code=en`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); console.log((await response.json()).results.length); ``` ::: ### Last 24 hours in a category, most engaging first ```bash curl "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:04000000?published_at.start=NOW-1DAY&sort.by=engagement&api_key=YOUR_API_KEY" ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0241` | 404 | No category with that ID | | `ER0242` | 404 | The category exists but not in the taxonomy given in the path | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Articles by topic](/platform/news-api/topic) and [by industry](/platform/news-api/industry) for other ways to group news. * [List of Categories](/platform/news-api/list-of-categories) — every valid category ID. * [Search articles](/platform/news-api/everything) — combine several categories in one query. --- --- url: 'https://docs.apitube.io/platform/news-api/entity.md' description: >- Get articles about an entity with /v1/news/entity/{entity_id}. Find the entity ID parameter, request examples, response format and errors. --- # Get articles by entity with `/v1/news/entity/{entity_id}` Get articles about a specific person, organization, brand, place or product with `/v1/news/entity/{entity_id}`. The ID identifies the subject across name variants. For example, Apple the company has a different ID from the fruit. Add [shared filters](/platform/news-api/filters) to narrow the results. Each request costs **1 point**. Using the `prompt` parameter adds **2 points**; `prompt` requires Basic or above. ## Endpoint ``` GET /v1/news/entity/{entity_id} POST /v1/news/entity/{entity_id} ``` Base URL: `https://api.apitube.io`. Entity IDs are integers: `/v1/news/entity/123`. ## Entity ID vs. name filters {#entity-id-vs-person-name-and-friends} | | `/v1/news/entity/{id}` | `person.name=Elon Musk` | |---|---|---| | Matching | Matches the same subject across different versions of its name | Matches the name listed in an article | | Needs a lookup first | Yes, via Suggest | No | | Best for | Monitoring one known subject over time | Ad-hoc queries, quick exploration | To monitor a fixed list of companies or people, find their IDs once and reuse them. For a quick search, use the `*.name` filters. ## Where entity IDs come from * [`/v1/suggest/entities`](/platform/news-api/suggest/entities) to search by name. Each match includes `id`, `type` and a `links.self` URL. * The `entities` array of any article in a response. * The reference directories: [People](/platform/news-api/reference/people) and [Companies](/platform/news-api/reference/companies). ## Parameters ### Path parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `entity_id` | string | Yes | Entity ID. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all article fields. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/entity/123?language.code=en&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/entity/123", params={"language.code": "en", "per_page": 10}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"]) ``` ```javascript [Node.js] const response = await fetch( 'https://api.apitube.io/v1/news/entity/123?language.code=en&per_page=10', { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); console.log((await response.json()).results.map(a => a.title)); ``` ::: ### How is this entity being written about? Use `entity.sentiment.*` to filter by how the article describes this subject. An article can be positive overall but negative about a particular company or person: ```bash curl "https://api.apitube.io/v1/news/entity/123?entity.sentiment.polarity=negative&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0151` | 404 | No entity with that ID | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Entity suggestions](/platform/news-api/suggest/entities) — resolve a name to an entity ID. * [People](/platform/news-api/reference/people) and [Companies](/platform/news-api/reference/companies) — profile pages with coverage stats. * [Search articles](/platform/news-api/everything) — combine several entities with `entity.id`. --- --- url: 'https://docs.apitube.io/platform/news-api/industry.md' description: >- Get articles for an industry with /v1/news/industry/{industry_id}. Find the industry ID parameter, request examples, response format and errors. --- # Get articles by industry with `/v1/news/industry/{industry_id}` Get articles about a business sector with `/v1/news/industry/{industry_id}`. Add [shared filters](/platform/news-api/filters) to narrow the results. Each request costs **1 point**. Using the `prompt` parameter adds **2 points**; `prompt` requires Basic or above. ## Endpoint ``` GET /v1/news/industry/{industry_id} POST /v1/news/industry/{industry_id} ``` Base URL: `https://api.apitube.io`. Industry IDs are integers: `/v1/news/industry/312`. ## Industry vs. category An industry describes the business sector affected by the news. A category describes the kind of news. For example, a factory fire can have the category `disaster` and the industry *manufacturing*. Use industries to follow markets and competitors. ## Where industry IDs come from * [List of Industries](/platform/news-api/list-of-industries) — every valid numeric ID. * [`/v1/suggest/industries`](/platform/news-api/suggest/industries) to search by name. Each match includes a `links.self` URL. * The `industries` array of any article in a response. ## Parameters ### Path parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `industry_id` | string | Yes | Industry ID. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all article fields. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/industry/312?language.code=en&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/industry/312", params={"language.code": "en", "per_page": 10}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"]) ``` ```javascript [Node.js] const response = await fetch( 'https://api.apitube.io/v1/news/industry/312?language.code=en&per_page=10', { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); console.log((await response.json()).results.map(a => a.title)); ``` ::: ### Negative coverage of an industry this week ```bash curl "https://api.apitube.io/v1/news/industry/312?sentiment.overall.polarity=negative&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0150` | 404 | No industry with that ID | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Articles by category](/platform/news-api/category) and [by topic](/platform/news-api/topic) for other ways to group news. * [List of Industries](/platform/news-api/list-of-industries) — every valid industry ID. * [Search articles](/platform/news-api/everything) — combine several industries with `industry.id`. --- --- url: 'https://docs.apitube.io/platform/news-api/topic.md' description: >- Get articles for a topic with /v1/news/topic/{topic_id}. Find the topic ID parameter, request examples, response format and errors. --- # Get articles by topic with `/v1/news/topic/{topic_id}` Get articles on a specific subject with `/v1/news/topic/{topic_id}`. Topics include industries such as `industry.automotive_news` and markets such as `market_news.commodities.base_metals`. Add [shared filters](/platform/news-api/filters) to narrow the results. Each request costs **1 point**. Using the `prompt` parameter adds **2 points**; `prompt` requires Basic or above. ## Endpoint ``` GET /v1/news/topic/{topic_id} POST /v1/news/topic/{topic_id} ``` Base URL: `https://api.apitube.io`. Topic IDs are text identifiers with dot-separated parts, such as `/v1/news/topic/industry.automotive_news`. ## Topic vs. category [Categories](/platform/news-api/category) group news under IPTC Media Topics. Topics focus on business subjects, such as an industry or commodity. The list contains 70 topics, including `industry.*` (26 industry topics) and `market_news.*` (43 commodity and market topics). ## Where topic IDs come from * [List of Topics](/platform/news-api/list-of-topics) — all 70 valid topic slugs. * [`/v1/suggest/topics`](/platform/news-api/suggest/topics) to search by name. Each match includes a `links.self` URL. * The `topics` array of any article in a response. ## Parameters ### Path parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `topic_id` | string | Yes | Topic ID. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all article fields. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/topic/industry.automotive_news?language.code=en&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/topic/industry.automotive_news", params={"language.code": "en", "per_page": 10}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"]) ``` ```javascript [Node.js] const response = await fetch( 'https://api.apitube.io/v1/news/topic/industry.automotive_news?language.code=en&per_page=10', { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); console.log((await response.json()).results.map(a => a.title)); ``` ::: ### Which countries are covering this topic? ```bash curl "https://api.apitube.io/v1/news/topic/market_news.commodities.base_metals?facet=1&facet.field=source.country.id&api_key=YOUR_API_KEY" ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0149` | 404 | No topic with that ID | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Articles by category](/platform/news-api/category) and [by industry](/platform/news-api/industry) for other ways to group news. * [List of Topics](/platform/news-api/list-of-topics) — every valid topic slug. * [Search articles](/platform/news-api/everything) — combine several topics with `topic.id`. --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/java/async-http-client.md description: >- Call the APITube News API from Java using the AsyncHttpClient library for asynchronous HTTP requests --- # AsyncHttp integration ```java // Install: add AsyncHttpClient (org.asynchttpclient:async-http-client) via Maven/Gradle AsyncHttpClient client = new DefaultAsyncHttpClient(); client.prepare("GET", "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join(); client.close(); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/nim/async-http-client.md description: Call the APITube News API from Nim using the asynchronous AsyncHttpClient --- # AsyncHttpClient integration ```nim import std/[asyncdispatch, httpclient] proc fetchNews() {.async.} = let client = newAsyncHttpClient() let url = "https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY" let response = await client.getContent(url) echo response waitFor fetchNews() ``` --- --- url: 'https://docs.apitube.io/platform/news-api/authentication.md' description: Authenticate News API requests with your API key in a header or URL parameter. --- # Authentication Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. :::tip Use GET or POST and send your API key in a request header or URL parameter. If someone else may have your key, replace it on the [APITube](https://apitube.io) website. ::: ## API Key in a query string :::warning Avoid this method in production. URLs can expose your key in logs and browser history. ::: Add your key to the URL as the `api_key` parameter. **Request Example:** ```shell curl https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY ... ``` ## API Key in headers Send your key in the `X-API-Key` header to keep it out of the URL. **Headers:** * `X-API-Key` (string): Your API key. **Request Example:** ```shell curl https://api.apitube.io/v1/news/everything?per_page=10 --header "x-api-key: YOUR_API_KEY" ... ``` ## Bearer Token You can also send your API key in the `Authorization` header. Put `Bearer` followed by a space before the key. **Request Example:** ```shell curl -H "Authorization: Bearer YOUR_API_KEY" https://api.apitube.io/v1/news/everything?per_page=10 ... ``` ## Test mode Each account has live and test keys. Use a test key to try requests without spending your quota: * **Live keys** (`api_live_...`) return full article data and use your plan quota or balance. * **Test keys** (`api_test_...`) return the same response format with shortened article text. The text ends with `...[Test mode — use a live key for full content]`. These requests use **no quota or balance**. Use test keys to check pagination, response fields and error handling for free, including SSE and WebSocket streams. To get full article text, use a live key on a paid plan. :::tip In the [dashboard](https://apitube.io), turn on **Test mode** at the bottom of the sidebar. Then create a key under **API Keys**. Each mode shows its own keys. ::: **Request Example:** ```shell curl "https://api.apitube.io/v1/news/everything?per_page=10&api_key=api_test_YOUR_TEST_KEY" ``` ### Detecting the mode Read the `x-apitube-mode` response header to check which type of key you are using: * `x-apitube-mode: live` * `x-apitube-mode: test` Test mode also limits counts and trends. `/v1/news/count` returns at most **100**, even when more articles match. Do not use this number to measure coverage. `/v1/news/trends` returns the usual format and numbers (`count`, `percentage`, `growth_rate`), but replaces each `value` with `[Upgrade subscription plan]`. This lets you test response handling without access to the rankings. :::warning Test keys allow fewer requests per minute than live keys. Use them while building and testing your integration. ::: ## Calling the API from a browser You can call the API from any website. Responses include `Access-Control-Allow-Origin: *`. When you send `X-API-Key`, the browser first sends an `OPTIONS` request to check permission. A custom header requires this check under the browser's rules for a [simple request](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests). The API replies with `204` and the required `Access-Control-Allow-*` headers. This check needs no API key. The browser can cache permission for 24 hours (`Access-Control-Max-Age: 86400`). :::warning Anyone can read a key sent by a browser and use your quota. Keep live keys on your server and send API requests from there. For a public demo, use a [test key](#test-mode). You can limit a key to specific IP addresses, referring websites and endpoints in the dashboard. ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/author-examples.md description: Examples of using author parameters in News API --- # Author Query Examples ## Find articles by one author {#search-for-news-by-a-specific-author} Find articles written by AFP. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/everything?author.name=AFP&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP 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/everything ``` ::: ## Find articles by several authors {#search-for-news-by-multiple-authors} Find articles by AFP or Reuters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP,Reuters") 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) } ``` ```java [Java] 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/everything?author.name=AFP,Reuters&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters 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/everything ``` ::: ## Choose an author and language {#filter-by-author-and-language} Find AFP articles in English. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/everything?author.name=AFP&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP&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/everything ``` ::: ## Find an author's coverage of a subject {#author-expertise-analysis} Get AFP sports articles to review its coverage. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP&category.id=medtop:15000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP", "category.id": "medtop:15000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "category.id": "medtop:15000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "category.id" => "medtop:15000000", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP") q.Set("category.id", "medtop:15000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "10") 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) } ``` ```java [Java] 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/everything?author.name=AFP&category.id=medtop:15000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP&category.id=medtop:15000000&sort.by=published_at&sort.order=desc&per_page=10 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/everything ``` ::: ## Compare sentiment by author {#author-sentiment-bias-analysis} Compare sentiment in articles from two news agencies. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP,Reuters") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score 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/everything ``` ::: ## Follow an author's coverage over time {#author-topic-evolution-tracking} Get Reuters articles in date order to follow its coverage over time. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=Reuters&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "Reuters", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "Reuters") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "10") 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) } ``` ```java [Java] 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/everything?author.name=Reuters&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=Reuters&sort.by=published_at&sort.order=desc&per_page=10 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/javascript/axios-client.md description: Call the APITube News API from JavaScript using the Axios HTTP client library --- # Axios integration ```javascript // Install: npm install axios import axios from "axios"; const options = { method: 'GET', url: 'https://api.apitube.io/v1/news/everything', params: { per_page: 10, api_key: 'YOUR_API_KEY' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/node-js/axios-client.md' description: >- Call the APITube News API from Node.js using the Axios promise-based HTTP client --- # Axios integration ```javascript // Install: npm install axios const axios = require("axios"); const options = { method: 'GET', url: 'https://api.apitube.io/v1/news/everything', params: { per_page: 10, api_key: 'YOUR_API_KEY' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/typescript/axios-client.md description: Call the APITube News API from TypeScript using the Axios HTTP client --- # Axios integration ```typescript import axios from 'axios'; interface NewsResponse { status: string; data: Article[]; } interface Article { title: string; description: string; url: string; published_at: string; } async function fetchNews(): Promise { try { const response = await axios.get( 'https://api.apitube.io/v1/news/everything', { params: { per_page: 50, api_key: 'YOUR_API_KEY' } } ); console.log(JSON.stringify(response.data, null, 2)); } catch (error) { if (axios.isAxiosError(error)) { console.error(`HTTP Request Error: ${error.response?.status}`); } else { console.error('Unexpected error:', error); } } } fetchNews(); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/balance.md' description: >- Check remaining points and the current plan for an APITube API key with GET /v1/balance — a free call that never consumes points. --- # Check your balance with `/v1/balance` Check remaining points and the current plan with `/v1/balance`. Use it before a large batch of requests or check regularly to warn when points run low. This request is **free** and uses no points. ## Endpoint ``` GET /v1/balance ``` Base URL: `https://api.apitube.io`. ## Authentication Any of the three standard methods work — see [Authentication](/platform/news-api/authentication): ```bash curl "https://api.apitube.io/v1/balance" -H "X-API-Key: YOUR_API_KEY" curl "https://api.apitube.io/v1/balance" -H "Authorization: Bearer YOUR_API_KEY" curl "https://api.apitube.io/v1/balance?api_key=YOUR_API_KEY" ``` The response shows the balance for the API key you sent. You cannot use it to check another key's balance. ## Parameters This endpoint needs only your API key. See [Authentication](/platform/news-api/authentication). ## Response format ```json { "api_key": "ak_live_abc123...", "points": 48500, "plan": "professional" } ``` ### Response fields | Field | Type | Description | |-------|------|-------------| | `api_key` | string | The key the balance belongs to | | `points` | integer | Points remaining | | `plan` | string | Current subscription plan | ## Points per request {#what-a-point-costs} | Request | Points | |---------|--------| | Any article, count or trends request | 1 | | Reference directories — [People](/platform/news-api/reference/people), [Companies](/platform/news-api/reference/companies), [Journalists](/platform/news-api/reference/journalists) | 1 | | [`/v1/news/local`](/platform/news-api/local) | 1 + 1 per requested `insights` block | | [`/v1/fact-check`](/platform/news-api/fact-check) | 5 | | Adding the `prompt` parameter | +2 for the translation step (Basic and above only) | | [`/v1/suggest/*`](/platform/news-api/suggest/entities) autocomplete | 0 | | [`/v1/news/event-types`](/platform/news-api/reference/event-types) | 0 | | `/v1/balance` | 0 | Searches and directory lookups with no results use no points. Real-time delivery uses separate quotas: `sse_points` for [SSE](/platform/news-api/sse-stream), `ws_points` for [WebSocket](/platform/news-api/websocket-stream) and `webhook_points` for [webhooks](/platform/news-api/webhooks). Each delivered article costs one credit. Idle connections, heartbeats and checks with no new articles are free. Your per-minute request limit is separate from these quotas. See [Rate limits and quotas](/platform/news-api/rate-limits). ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/balance" -H "X-API-Key: YOUR_API_KEY" ``` ```python [Python] import requests balance = requests.get( "https://api.apitube.io/v1/balance", headers={"X-API-Key": "YOUR_API_KEY"}, ).json() if balance["points"] < 1000: print(f"Low balance: {balance['points']} points left on {balance['plan']}") ``` ```javascript [Node.js] const response = await fetch('https://api.apitube.io/v1/balance', { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); const balance = await response.json(); console.log(`${balance.points} points left on ${balance.plan}`); ``` ```php [PHP] $context = stream_context_create(['http' => ['header' => 'X-API-Key: YOUR_API_KEY']]); $balance = json_decode(file_get_contents('https://api.apitube.io/v1/balance', false, $context), true); echo $balance['points'], ' points left on ', $balance['plan'], PHP_EOL; ``` ::: ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0201` | 401 | No API key in the request | | `ER0202` | 401 | API key is invalid | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Rate limits and quotas](/platform/news-api/rate-limits) — per-minute limits and `per_page` ceilings by plan. * [Authentication](/platform/news-api/authentication) — the three ways to pass a key. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/brand-examples.md description: Examples of filtering News API articles by brand name --- # Brand Query Examples ## Find news about one brand {#search-for-news-about-a-specific-organization} Find news about Apple. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Apple") 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) } ``` ```java [Java] 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/everything?brand.name=Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Apple 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/everything ``` ::: ## Find news about several brands {#search-for-news-about-multiple-organizations} Find news about Apple and Google. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Apple,Google&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Apple,Google", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Apple,Google", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Apple,Google", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Apple,Google") 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) } ``` ```java [Java] 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/everything?brand.name=Apple,Google&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Apple,Google 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/everything ``` ::: ## Include one brand and exclude another Find Apple news and exclude articles about Google. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Apple&ignore.brand.name=Google&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Apple", "ignore.brand.name": "Google", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Apple", "ignore.brand.name": "Google", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Apple", "ignore.brand.name" => "Google", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Apple") q.Set("ignore.brand.name", "Google") 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) } ``` ```java [Java] 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/everything?brand.name=Apple&ignore.brand.name=Google&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Apple&ignore.brand.name=Google 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/everything ``` ::: ## Compare coverage across markets {#organization-reputation-analysis-across-markets} Compare coverage of Tesla across markets. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Tesla&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Tesla", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla", "source.country.code" => "us,de,gb", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Tesla") q.Set("source.country.code", "us,de,gb") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Tesla&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Tesla&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Follow product launches {#product-launch-media-coverage-tracking} Follow news about Apple product launches. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Apple&title=iPhone,iPad,MacBook&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Apple", "title": "iPhone,iPad,MacBook", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Apple", "title": "iPhone,iPad,MacBook", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Apple", "title" => "iPhone,iPad,MacBook", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Apple") q.Set("title", "iPhone,iPad,MacBook") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Apple&title=iPhone,iPad,MacBook&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Apple&title=iPhone,iPad,MacBook&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find brand news about sponsorships {#organization-sponsorship-impact-analysis} Find business news about technology brands. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Google,Microsoft,Amazon&title=partnership,deal,investment&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Google,Microsoft,Amazon", "title": "partnership,deal,investment", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Google,Microsoft,Amazon", "title": "partnership,deal,investment", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Google,Microsoft,Amazon", "title" => "partnership,deal,investment", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Google,Microsoft,Amazon") q.Set("title", "partnership,deal,investment") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Google,Microsoft,Amazon&title=partnership,deal,investment&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Google,Microsoft,Amazon&title=partnership,deal,investment&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Follow negative brand coverage {#organization-crisis-management-tracking} Follow negative news about Tesla. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Tesla&title=recall,safety,investigation&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Tesla", "title": "recall,safety,investigation", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla", "title": "recall,safety,investigation", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla", "title" => "recall,safety,investigation", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Tesla") q.Set("title", "recall,safety,investigation") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Tesla&title=recall,safety,investigation&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Tesla&title=recall,safety,investigation&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=desc 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/faceted-dashboard.md description: >- Build news charts from one search, with counts by category, country, publication date and sentiment score. --- # Build a News Dashboard with Article Counts {#build-a-faceted-news-dashboard} Use [article counts](/platform/news-api/everything) grouped by category, country, publisher bias or another field. Group dates or numeric scores into intervals to build timeline and distribution charts. ## Step 1: Count articles by field {#step-1-break-the-result-set-down-by-field} Set `facet=true` and list up to 5 fields in `facet.field`. Counts are computed over everything that matches your filters, not just the current page. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id,source.country.id,source.bias&facet.limit=10&per_page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "category.id,source.country.id,source.bias", "facet.limit": "10", "per_page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "category.id,source.country.id,source.bias", "facet.limit": "10", "per_page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "category.id,source.country.id,source.bias", "facet.limit" => "10", "per_page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "category.id,source.country.id,source.bias") q.Set("facet.limit", "10") q.Set("per_page", "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) } ``` ```java [Java] 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/everything?facet=true&facet.field=category.id,source.country.id,source.bias&facet.limit=10&per_page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id,source.country.id,source.bias&facet.limit=10&per_page=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/everything ``` ::: The response carries a `facets` object keyed by field name, each holding `{ value, count }` pairs: ```json { "facets": { "source.bias": [ { "value": 0, "count": 3809437 }, { "value": 2, "count": 3746702 }, { "value": 1, "count": 1868553 } ] } } ``` * **Pie or bar widget** — `facets["category.id"]`, feed the `value` into [the category list](/platform/news-api/list-of-categories) to get a readable label. * **Map widget** — `facets["source.country.id"]`. * **Bias split** — `facets["source.bias"]`, where `0` is left, `1` is center and `2` is right. Sources with no bias rating are returned under their own value — drop it before charting. * **Hide rare values** — raise `facet.mincount` to exclude values that appear in only a few articles. ## Step 2: Draw the publication timeline Range facets group a date or number into intervals. For a publication timeline, set `facet.range.field=published_at` and choose a gap: `1HOUR`, `1DAY` or `1MONTH`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet.range=true&facet.range.field=published_at&facet.range.start=2026-07-20&facet.range.end=2026-07-27&facet.range.gap=1DAY&per_page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2026-07-20", "facet.range.end": "2026-07-27", "facet.range.gap": "1DAY", "per_page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2026-07-20", "facet.range.end": "2026-07-27", "facet.range.gap": "1DAY", "per_page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2026-07-20", "facet.range.end" => "2026-07-27", "facet.range.gap" => "1DAY", "per_page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2026-07-20") q.Set("facet.range.end", "2026-07-27") q.Set("facet.range.gap", "1DAY") q.Set("per_page", "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) } ``` ```java [Java] 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/everything?facet.range=true&facet.range.field=published_at&facet.range.start=2026-07-20&facet.range.end=2026-07-27&facet.range.gap=1DAY&per_page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet.range=true&facet.range.field=published_at&facet.range.start=2026-07-20&facet.range.end=2026-07-27&facet.range.gap=1DAY&per_page=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/everything ``` ::: Each interval appears under `_ranges` with its start, end and article count. Plot these values directly: ```json { "facets": { "published_at_ranges": [ { "range_start": "2026-07-24", "range_end": "2026-07-25", "count": 283467 }, { "range_start": "2026-07-25", "range_end": "2026-07-26", "count": 174354 }, { "range_start": "2026-07-26", "range_end": "2026-07-27", "count": 165699 } ] } } ``` ## Step 3: Chart sentiment scores {#step-3-add-a-sentiment-histogram} The same approach works with numeric fields. `sentiment.overall.score` ranges from `-1` to `1`. An interval size of `0.25` divides the scores into eight groups, from very negative to very positive. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&per_page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "per_page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "per_page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet.range" => "true", "facet.range.field" => "sentiment.overall.score", "facet.range.start" => "-1", "facet.range.end" => "1", "facet.range.gap" => "0.25", "per_page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet.range", "true") q.Set("facet.range.field", "sentiment.overall.score") q.Set("facet.range.start", "-1") q.Set("facet.range.end", "1") q.Set("facet.range.gap", "0.25") q.Set("per_page", "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) } ``` ```java [Java] 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/everything?facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&per_page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&per_page=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/everything ``` ::: You can also group `read_time` by intervals of `5`, `source.rank.opr` by intervals of `2`, or `media.images.count` by the number of images. Filters apply before articles are counted. Add `industry.id` to limit the dashboard's counts to one industry: ```python import requests def dashboard(api_key, **filters): params = { "facet": "true", "facet.field": "category.id,source.country.id", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2026-07-20", "facet.range.end": "2026-07-27", "facet.range.gap": "1DAY", "per_page": 1, "api_key": api_key, **filters, } return requests.get("https://api.apitube.io/v1/news/everything", params=params).json()["facets"] ``` > Tip: set `per_page=1` when you only need facet counts. Counts cover all matching articles, regardless of page size. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/person-dossier.md description: 'Look up a public figure and assemble a profile, coverage and recent articles' --- # Build a Public Figure Profile {#build-a-person-dossier} Use [People](/platform/news-api/reference/people) to build a profile of a public figure. One response includes background details, a `coverage` summary, related entities and recent articles. ## Step 1: Find the person Search the directory by name and pick the matching `id`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/people?name=Michelle Obama&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/people", params={ "name": "Michelle Obama", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "name": "Michelle Obama", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/people?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["name" => "Michelle Obama", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/people?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/people") q := u.Query() q.Set("name", "Michelle Obama") 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) } ``` ```java [Java] 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/people?name=Michelle Obama&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/people?name=Michelle Obama 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/everything ``` ::: ## Step 2: Fetch the full profile Request the profile by `id` to get `profile`, `coverage` and `recent_articles`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/people/1316868?api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/people/1316868", params={ "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/people/1316868?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/people/1316868?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/people/1316868") q := u.Query() 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) } ``` ```java [Java] 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/people/1316868?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/people/1316868 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/everything ``` ::: Read these fields from the response: * **Who** — `profile` (title, bio, nationality, social profiles). * **How they're covered** — `coverage.article_count`, `coverage.sentiment`, `coverage.timeline`. * **Trend** — `coverage.momentum.change_pct` (last 30 days vs. previous). * **Related subjects** — `coverage.related_entities` lists the people, companies and other entities most often mentioned alongside this person. * **Where** — `coverage.top_sources`, `coverage.top_countries`, `coverage.top_languages`. * **Latest news** — `recent_articles`. ## Step 3: Open the full article feed {#step-3-pivot-to-the-full-article-feed} Follow `links.articles` to browse all articles about the person. You can also search `/v1/news/everything` with an entity filter and add dates, sources or other filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/entity/1316868?api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/entity/1316868", params={ "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/entity/1316868?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/entity/1316868?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/entity/1316868") q := u.Query() 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) } ``` ```java [Java] 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/entity/1316868?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/entity/1316868 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/everything ``` ::: > Tip: pass `?coverage=false` to the profile endpoint when you only need identity data and want a faster response. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/autocomplete-search.md description: >- Build a search box that suggests entities as the user types and opens articles about the selected subject. --- # Build an Autocomplete Search Box Build a search box with the [Suggest](/platform/news-api/suggest/entities) endpoints. Send the user's text as `prefix`, display the matches, and open the selected subject's news feed. ## Step 1: Suggest entities by prefix Send the search text as `prefix`. Each match includes a `type` such as person, organization, location or brand, and a `links.self` URL for its articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/suggest/entities?prefix=tesl&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/suggest/entities", params={ "prefix": "tesl", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "prefix": "tesl", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/suggest/entities?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["prefix" => "tesl", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/suggest/entities?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/suggest/entities") q := u.Query() q.Set("prefix", "tesl") 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) } ``` ```java [Java] 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/suggest/entities?prefix=tesl&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/suggest/entities?prefix=tesl 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/everything ``` ::: Display `name` and `type` from the match, and keep `links.self` for the next step: ```json [ { "id": 474, "name": "Tesla Robotaxi", "type": "brand", "links": { "self": "https://api.apitube.io/v1/news/entity/474", "wikipedia": "https://en.wikipedia.org/wiki/Tesla_Robotaxi", "wikidata": "https://www.wikidata.org/wiki/Q135277686" }, "metadata": { "name": "Tesla Robotaxi", "type": "brand", "category": "general", "brand_owner": { "id": "org-481", "name": "Tesla, Inc." }, "description": "Ride-hailing service operated by Tesla, Inc" } } ] ``` > Wait about 150 ms after the user stops typing before requesting suggestions. This avoids a request for every keystroke. ## Step 2: Open articles about the selected entity {#step-2-pivot-to-the-entity-s-news-feed} When the user selects a match, open its `links.self` URL to get the [entity](/platform/news-api/common-workflows/examples/entity-examples) feed. Add filters such as `published_at`, `language.code` and `sort.by`, or request another page. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/entity/474?sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/entity/474", params={ "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/entity/474?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/entity/474?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/entity/474") q := u.Query() q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/entity/474?sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/entity/474?sort.by=published_at 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/everything ``` ::: ## Suggest categories, topics and industries {#suggest-other-classifiers} Use the same approach to suggest categories, topics and industries: * [`/v1/suggest/categories`](/platform/news-api/suggest/categories) — category picker. * [`/v1/suggest/topics`](/platform/news-api/suggest/topics) — topic picker. * [`/v1/suggest/industries`](/platform/news-api/suggest/industries) — industry picker. Each endpoint returns matches with an `id`. Use it in the matching `/v1/news/everything` filter: `category.id`, `topic.id` or `industry.id`. > Tip: the `prefix` parameter requires at least one character — skip the call while the input is empty. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/category-examples.md description: Examples of using categories in News API --- # Category Query Examples ## Choose a category {#getting-news-from-a-specific-category} Find articles in the business category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Find technology news {#getting-technology-news} Find articles in the technology category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000 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/everything ``` ::: ## Choose a category and language {#filtering-news-by-category-and-language} Find political news in French. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Track category coverage over time {#time-based-category-analysis} Get health articles in date order to track coverage over time. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:07000000&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:07000000", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:07000000", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:07000000", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:07000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?category.id=medtop:07000000&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:07000000&sort.by=published_at&sort.order=asc&per_page=100 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/everything ``` ::: ## Find category articles with images {#category-based-media-analysis} Find sports articles with images. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:15000000&media.images.count=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:15000000", "media.images.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:15000000", "media.images.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:15000000", "media.images.count" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:15000000") q.Set("media.images.count", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:15000000&media.images.count=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:15000000&media.images.count=1&sort.by=media.images.count&sort.order=desc 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/everything ``` ::: ## Compare sentiment across categories {#comparing-sentiment-across-different-categories} Compare positive coverage across categories. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000,medtop:13000000&sentiment.overall.polarity=positive&sort.by=category.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000,medtop:13000000", "sentiment.overall.polarity": "positive", "sort.by": "category.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000,medtop:13000000", "sentiment.overall.polarity": "positive", "sort.by": "category.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000,medtop:13000000", "sentiment.overall.polarity" => "positive", "sort.by" => "category.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000,medtop:13000000") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "category.id") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000,medtop:13000000&sentiment.overall.polarity=positive&sort.by=category.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000,medtop:13000000&sentiment.overall.polarity=positive&sort.by=category.id 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/everything ``` ::: ## Compare category coverage by location {#category-and-location-correlation-analysis} Compare entertainment coverage across regions. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:01000000&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:01000000", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:01000000", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:01000000", "language.code" => "en", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:01000000") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:01000000&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:01000000&language.code=en&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find positive technology coverage {#multi-category-emerging-trend-identification} Find technology news with positive sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&title=AI,innovation,breakthrough&sentiment.overall.polarity=positive&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "title": "AI,innovation,breakthrough", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "title": "AI,innovation,breakthrough", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "title" => "AI,innovation,breakthrough", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("title", "AI,innovation,breakthrough") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&title=AI,innovation,breakthrough&sentiment.overall.polarity=positive&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&title=AI,innovation,breakthrough&sentiment.overall.polarity=positive&sort.by=published_at&sort.order=desc 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/changelog.md' description: APITube Changelog --- # Changelog :::info New features, changes and fixes in each APITube release. ::: ## 1.0.55 — October 16, 2026 * `[Cyber Security API]` New **[Cyber Security API](/platform/cyber-security/)** — a news feed of cyber crime and cyber warfare with vulnerability details on every article: * Each article has a **`cyber`** block with its category (`type`), vulnerability IDs (`cves`), CISA KEV status (`in_kev`, `exploited`), affected vendors (`vendors`) and the highest CVSS score stated in the text (`cvss`). CVE IDs are read from the title, description or body. The CISA Known Exploited Vulnerabilities (KEV) catalog is refreshed every 24 hours. If it is unavailable, `in_kev` and `exploited` are `null`, not `false`. * Every filter, sort, facet, highlighting, `fl` and `export` option of `/v1/news/everything` works here and only narrows the cyber selection. `fl=cyber.cves` returns a single field; CSV, TSV and XLSX carry the block in a `Cyber` column, XML, JSONL and Parquet in `cyber`, RSS as item categories * **1 point** per request that returns articles, the same plan limits as `/v1/news/everything`, available on every plan. API keys restricted to specific endpoints need the new `cyber_security_news` scope * New codes: **ER0900** (`400`, invalid `cyber.type`) and the **ER0901** warning (some stored articles were left out, the page may be short — keep following `next_page`). Start with the **[Quickstart](/platform/cyber-security/quickstart)** ## 1.0.54 — September 11, 2026 * `[Dashboard]` **Dataset exports** — bulk export of articles to a file, straight from the dashboard (**Datasets** in the sidebar): * Choose filters from `/v1/news/everything`, set a `published_at` range of up to 366 days and select **JSONL**, **CSV** or **Parquet**. The page shows export progress. Download the completed file within **7 days**. JSONL and CSV files use gzip compression; Parquet uses its own compression * **Basic plan and above.** Free and Starter see the page but cannot queue an export * Title searches (`title`, `title_*`, `query`) keep their 31-day window per request — the export splits a longer range into 31-day chunks automatically ## 1.0.53 — September 1, 2026 * `[Plans]` Pay-as-you-go now needs your explicit consent — a **balance switch** in the dashboard decides whether prepaid money can pay for requests: * The switch lives on **Pay as you go** and on **Account → Plan & usage**, and it is **off by default**. With it off, your balance is never touched: requests beyond the plan quota return `402 ER0176` instead of spending money, on REST, [SSE](/platform/news-api/sse-stream), [WebSocket](/platform/news-api/websocket-stream) and [webhook](/platform/news-api/webhooks) deliveries alike * `X-Balance-Remaining` keeps reporting the real money on the account whether the switch is on or off; it says how much you have, not how much may be spent ## 1.0.52 — August 15, 2026 * `[News API]` Added the **[`prompt`](/platform/news-api/filters#prompt)** parameter — describe the news you want in plain language and the API builds the filters for you, inside the same request: * Send a sentence of **3–500 characters**, such as `prompt=Elon Musk and Tesla news for the last 10 days`. The API converts it to filters before searching. Supported filters include: * Headline keywords and phrases; names in `person.name`, `organization.name`, `location.name`, `brand.name`, `event.name`, `disease.name`, `disaster.name` and `sport.name` * Categories, topics and industries: `category.id`, `topic.id`, `industry.id` * Publishers, authors, language and country: `source.domain`, `author.name`, `language.code`, `source.country.code` * Dates, tone and sorting: `published_at.start`, `published_at.end`, `sentiment.overall.polarity`, `sort.by`, `sort.order` * Yes-or-no filters: `is_breaking`, `has_image`, `has_video`, `is_paywall`, `is_long_read`; result count: `per_page` * Check `meta.prompt` for the original `text`, `applied` filters, `ignored` values with reasons, and whether the translation was `cached`. Unknown entity names are searched in headlines * **Parameters you send directly take priority.** For example, `language.code=de` overrides a language chosen from the prompt. The unused value is reported with `reason: explicit_param`. * Accepted on `/v1/news/everything`, `/v1/news/top-headlines`, `/v1/news/local`, `/v1/news/count`, `/v1/news/trends`, `/v1/news/stream`, `/v1/news/ws` and the `/v1/news/category` · `/topic` · `/industry` · `/entity` endpoints. `/v1/news/raw` accepts it but only applies dates, `sort.order` and `per_page`; `/v1/news/article`, `/v1/news/story` and `/v1/fact-check` ignore it * **2 points** per translation, charged only when that wording has not been parsed before — interpretations are cached for **24 hours**, so a repeated prompt is free * **A premium feature: Basic and above.** On Free and Starter the request returns `403 ER0706` before the translation runs, so nothing is charged. Every filter a prompt would build stays available on every plan — `prompt` only writes them for you * New error codes: **ER0800** (length outside 3–500), **ER0801** (translation service unavailable, `502`, nothing charged), **ER0802** (nothing usable in the prompt); a plan without this feature returns **ER0706** (`403`). Full walkthrough: **[Natural Language Search](/platform/news-api/ai/natural-language-search)** * `[Plans]` Quota raised again on the same two tiers, prices unchanged: **Basic 35,000 → 50,000** and **Professional 90,000 → 150,000** requests per cycle. The annual plans (`basic_yearly`, `professional_yearly`) get the same allowance. ## 1.0.51 — August 9, 2026 * `[News API]` **Free plan returns full links, images and descriptions.** Article body text remains a preview: * `href`, `image`, `description`, `source.domain`, `source.home_page_url`, `source.favicon`, `links[].url` and `media[].url` are no longer truncated. Links on the Free plan are clickable, images load. * `translations.en.title` and `translations.en.description` are returned in full on every plan (they were cut to 30 and 200 characters on Free). * Entities, sentiment, categories, topics, industries and readability remain available in full on Free. * `body` and `body_html` remain a 200-character preview ending in `...[Upgrade subscription plan]`. A paid plan with a live key returns the full text. * `[Plans]` `per_page` is now capped per plan: **10 on Free**, **50 on Starter**, 250 on Basic and up. Requesting more returns `400 ER0171` with the plan ceiling in the message, and the default page size drops to the ceiling. * `[Plans]` Quota raised on two tiers at the same price: **Basic 20,000 → 35,000** and **Professional 50,000 → 90,000** requests per cycle. ## 1.0.50 — August 5, 2026 * `[Plans]` New **Starter** plan — the entry paid tier, between Free and Basic: * **$29/month** or **$279/year**, renewing every 31 days (366 on the annual plan) * **10,000 requests** per cycle, **3,000** streaming credits for SSE, WebSocket and webhook deliveries each (the annual plan carries 10,000 SSE deliveries) * **2** concurrent SSE and **2** concurrent WebSocket connections, **5** saved webhooks * Paid plans include full article text with a live key, access beyond the first 5 pages, **50 requests per minute** and `/v1/fact-check`. You can also choose to pay from your balance when plan credits run out. * `[Plans]` Starter allows **50** articles per request and one third of Basic's streaming deliveries. It has the same connection and webhook limits as Basic. Higher plans allow larger page sizes. * `[Plans]` The tier ladder is now **Free → Starter → Basic → Professional → Corporate**; upgrade and downgrade buttons in the dashboard follow that order. ## 1.0.49 — July 31, 2026 * `[News API]` Added **[English translations](/platform/news-api/response-structure#article-object-fields)** to every article — non-English coverage is now readable without a translation step of your own: * New `translations` block on the article object: `translations.en.title` and `translations.en.description` (the article body is not translated) * The block is returned **always**, with no request parameter to enable it; for English articles its fields are `null`, since the source text is already English * Original `title` and `description` are never replaced — the translation sits next to them, and `language` still reports the article's original language * English translations are available for **48 source languages** * Available in JSON, JSONL/NDJSON, XML (`` node), CSV/TSV/XLSX (`Translations` column) and Parquet (`translations` column); request a single field with `fl=translations.en.title` * On the Free plan both translated fields are truncated: `translations.en.description` after 200 characters (exactly like `description`) and `translations.en.title` after 30 characters. The original `title` stays full on every plan ## 1.0.48 — July 29, 2026 * `[News API]` **Breaking:** title searches can cover at most a **[31-day `published_at` window](/platform/news-api/everything#limits)** per request: * Applies to `title`, `title_starts_with`, `title_ends_with`, `title_pattern` and the boolean `query` parameter, on **every plan** and every endpoint, including exports, SSE stream and WebSocket * A title search with `published_at.start` / `published_at.end` more than 31 days apart now returns **`400 ER0110`**. The same applies to an open-ended `published_at.start` older than 31 days, since the window then runs to the current time * A title search **without** any `published_at` dates keeps working and searches the **last 31 days**. The response says so explicitly: warning `ER0366` in `meta.warnings`, plus an `x-query-window-clamped: 31` header for export formats that carry no JSON body * The single-day `published_at` parameter is unaffected, and requests that do not match on the title (`category.id`, `entity.id`, `source.domain`, `language.code` and the rest) keep their unlimited range * Previously this window was narrowed silently and only on the Free plan; it is now an explicit, uniform limit. To search a longer period, issue one request per month-sized window ## 1.0.47 — July 10, 2026 * `[MCP Server]` **[MCP Server](/platform/news-api/ai/mcp-server)** update — revised tooling for AI agents and MCP clients (Claude Desktop, Cursor, and others): * The news-search tool is now **`search_news`** (renamed from `everything`) — a clearer name for agents picking tools autonomously; filters and behavior are unchanged * **`suggest`** finds the ID for a name or the start of a name. Use the returned ID in `search_news`: numeric `entity.id` or `industry.id`, an IPTC `category.id` such as `medtop:…`, or a text `topic.id`. Agents can look up these IDs before searching. * Four ready-made **prompts** for common workflows: `monitor_company` (coverage digest for a company), `topic_sentiment` (how a topic is covered), `breaking_news` (what is breaking right now), and `compare_coverage` (side-by-side coverage of two subjects) * API-key restrictions are now enforced at the MCP layer too: per-endpoint **scopes**, key **expiration**, and **IP allowlists** are checked on every tool call ## 1.0.46 — July 3, 2026 * `[News API]` Added **[Fact Check](/platform/news-api/fact-check)** (`/v1/fact-check`) to check factual claims against recent news: * Check a single statement (`claim`), a full article's text (`text`), or any article already in the archive by its `id` — claims for `text`/`id` are extracted automatically * Every claim returns a verdict on an **8-level scale** (`true`, `mostly_true`, `mixed`, `misleading`, `mostly_false`, `false`, `unverified`, `outdated`), a confidence score, a short explanation, and the supporting/refuting **evidence articles** * Set `max_claims` to limit how many claims are checked and `evidence_per_claim` to limit how many articles support each check. Both default to 5, and values above the allowed maximum are reduced. * **Paid feature:** each request costs **5 points** and allows up to **10 requests per minute**. It is unavailable on Free * Both `GET` and `POST` supported ## 1.0.45 — June 26, 2026 * `[News API]` Added **[Entity-Level Sentiment](/platform/news-api/filters#sentiment)** — sentiment measured toward each detected entity, not only the article as a whole: * Every entity in the `entities` array now carries a `sentiment` block: `score` (−1 to 1), `polarity` (`positive`, `negative`, `neutral`), and per-mention counts `mentions` (`positive`, `neutral`, `negative`) * New filters to narrow results by how an entity is portrayed: `entity.sentiment.polarity` (`positive` / `negative` / `neutral`), `entity.sentiment.score.min`, `entity.sentiment.score.max` (range −1 to 1) * Combine with `entity.id` or a name filter (`person.name`, `organization.name`, …) to find positive or negative coverage of a specific entity. For example, find articles with negative coverage of one company. Use without an entity filter to match any entity with that sentiment. * New error codes: **ER0290** (invalid `entity.sentiment.polarity`), **ER0291** (invalid `entity.sentiment.score.min`), **ER0292** (invalid `entity.sentiment.score.max`) ## 1.0.44 — June 19, 2026 * `[News API]` Added **[Webhooks](/platform/news-api/webhooks)** — push delivery of new articles to your own endpoint as they are published, instead of polling: * Each webhook is a **saved query**: a destination `url` plus the same filters as `/v1/news/everything` (language, category, source, sentiment, entities, …). When a newly indexed article matches, APITube `POST`s it to your URL. * **Signed deliveries** — every request carries `X-Webhook-Signature` (`HMAC-SHA256` over `timestamp + "." + body`), plus `X-Webhook-Id` and `X-Webhook-Timestamp`, so you can verify authenticity. * **Automatic retries** with exponential backoff (1m → 5m → 30m → 2h → 12h, up to 5 attempts); a subscription that keeps failing is auto-disabled. * Create webhooks and inspect **delivery logs** (status, attempts, response code) in the [dashboard](https://dashboard.apitube.io/webhooks). Each delivered article costs **1 point**. * Per-plan limits: **Free 1 · Basic 5 · Professional 20 · Corporate 100** webhooks. ## 1.0.43 — June 12, 2026 * `[News API]` Added **Local News** endpoint (`/v1/news/local`) — find news near a point on the map, with the closest results first: * Set the search centre with `lat` and `lng`, or enter a name in `place`. Add `country` if the place name exists in more than one country. * `radius` in kilometers (default `50`, up to `20000`); each article includes `distance_km` and a `nearest_location` block (matched location entity, coordinates, country) * `sort` — `distance` (default), `published_at`, or `relevance` * **Relevance ranking** combines distance, publisher rank (Open PageRank), article age and importance. Choose a `ranking` preset (`balanced`, `proximity`, `authority`, `fresh`) or adjust the factors with `w.distance`, `w.opr`, `w.recency` and `w.important`. * Supports all `/v1/news/everything` filters except `location.*`, plus `fl` field selection, pagination and every export format. * Optional **`insights`** summaries describe coverage in the search area. Choose from `mood`, `hotspots`, `events`, `entities`, `bias`, `sources`, `timeline`, `top_categories`, `top_topics`, `breaking`, `velocity` and `movers`. * Both `GET` and `POST` supported; billing is **1 point** for the listing plus **1 point per requested insight block** ## 1.0.42 — June 5, 2026 * `[News API]` Added **Reference Endpoints** — searchable directories of the entities behind the news, each with a `coverage` block and the latest articles: * **[People](/platform/news-api/reference/people)** (`/v1/people`, `/v1/people/{id}`) — public figure profiles with background details (title, bio, nationality, social profiles) * **[Companies](/platform/news-api/reference/companies)** (`/v1/companies`, `/v1/companies/{id}`) — organizations and brands (headquarters, founded, website, key people, subsidiaries) * **[Journalists](/platform/news-api/reference/journalists)** (`/v1/journalists`, `/v1/journalists/{id}`) — profiles group records with the same author name and list where they publish in `outlets` * **Coverage** on each profile: article counts, monthly timeline, sentiment breakdown, momentum (last 30 days vs. previous), top sources / topics / countries / languages, related (co-mentioned) entities, and `recent_articles` * Each request costs **1 point**, charged only when the response contains at least one result ## 1.0.41 — May 29, 2026 * `[News API]` Added **[Raw Articles](/platform/news-api/raw)** (`/v1/news/raw`) for the earliest available articles in a basic format. Articles remain available for roughly 24 hours: * Article text in `body` and original HTML in `body_html`, just as on `/v1/news/everything` * Publisher details in `source`: domain, type, bias, Open PageRank, location and favicon. Original article keywords appear in `keywords`. * Filter by `source.id` / `ignore.source.id` or publication dates, and sort with `sort.by` / `sort.order` * Both `GET` and `POST` supported; each request costs **1 point** (charged only when the response contains at least one article) ## 1.0.40 — May 22, 2026 * `[News API]` Added **Suggest Endpoints** — suggest filter values as a user types. Each endpoint accepts `prefix` and returns matching IDs for its filter: * **[Category Suggestions](/platform/news-api/suggest/categories)** (`/v1/suggest/categories`) — `id` maps to the `category.id` filter * **[Topic Suggestions](/platform/news-api/suggest/topics)** (`/v1/suggest/topics`) — `id` maps to the `topic.id` filter * **[Industry Suggestions](/platform/news-api/suggest/industries)** (`/v1/suggest/industries`) — `id` maps to the `industry.id` filter * Authentication via `X-API-Key` header or `api_key` query parameter ## 1.0.39 — May 15, 2026 * `[News API]` Added **[Count Articles](/platform/news-api/count)** endpoint (`/v1/news/count`) — returns only the number of articles matching your filters, without loading any article content. Accepts the same filters as `/v1/news/everything`; ideal for dashboards, sample-size estimation, and progress bars. ## 1.0.38 — April 17, 2026 * `[News API]` Added **[Node.js SDK](https://github.com/apitube/news-api-node)** — official Node.js client library for APITube News API: * Call all News API endpoints from your application * Install via npm: [`npm install @apitube/news-api`](https://www.npmjs.com/package/@apitube/news-api) * Full support for all query parameters, filtering, and pagination * Promise-based HTTP client with TypeScript definitions ## 1.0.37 — April 10, 2026 * `[News API]` Added **[PHP SDK](https://github.com/apitube/news-api-php)** — official PHP client library for APITube News API: * Call all News API endpoints from your application * Install via Composer: `composer require apitube/news-api-php` * Full support for all query parameters, filtering, and pagination * PSR-compatible HTTP client ## 1.0.36 — March 30, 2026 * `[News API]` Added **[n8n Integration Guide](/platform/news-api/integrations/n8n)** — connect APITube News API to n8n with step-by-step instructions: * Setting up APITube credentials in n8n (Header Auth with `X-API-Key`) * Ready-to-import workflow: **News Monitoring** — scheduled polling with keyword, language, and sentiment filters * Ready-to-import workflow: **News to Slack / Telegram** — automatic alerts with formatted article cards * Import the **AI News Digest** workflow to summarise each day's news with OpenAI and email the result * Common parameters and tips for pagination, rate limits and avoiding duplicate articles ## 1.0.35 — March 18, 2026 * `[News API]` Added **[API Reference](https://api-reference.apitube.io/)** — interactive API documentation with request builder, response examples, and schema explorer * `[News API]` Added **[OpenAPI Specification](https://api-reference.apitube.io/openapi.json)** — an OpenAPI 3.0 file for generating client libraries, importing requests into Postman and using other API tools ## 1.0.34 — March 5, 2026 * `[News API]` Added **SSE Real-Time Stream** — new endpoint `/v1/news/stream` for receiving articles in real time via Server-Sent Events: * Live article delivery as they are published — no polling required * All `/v1/news/everything` filters are supported (`language.code`, `category`, `source.domain`, `sentiment.*`, etc.) * Field selection via `fl` parameter (e.g., `fl=id,title,source.domain`) * Automatic reconnection support via `Last-Event-ID` header — no articles missed during disconnects * SSE events: `article` (new article with JSON data), `error` (server error with code and message), heartbeat comments every 30 seconds * Authentication via `X-API-Key` header or `api_key` query parameter * Billing: 1 credit per delivered article * Compatible with native `EventSource` API in browsers, `curl`, Python, and any SSE client ## 1.0.33 — March 1, 2026 * `[News API]` Added **API Key Restrictions** — choose which IP addresses and HTTP Referrers can use each key: * Configure allowed IP addresses (exact match or wildcard patterns like `10.0.0.*`) * Configure allowed HTTP Referrers (exact match or wildcard patterns like `*.example.com`) * An empty list leaves access unrestricted * New error codes: **ER0601** (IP not allowed), **ER0602** (domain not allowed) * Restrictions are validated before rate limiting — blocked requests do not consume quota ## 1.0.32 — February 19, 2026 * `[News API]` Added article export formats: **Parquet file**, **JSONL**. ## 1.0.31 — February 5, 2026 * `[News API]` Added **Social Shares** - new object in article response with social media sharing metrics: * `shares.total` - total number of shares across all platforms * `shares.facebook` - number of Facebook shares * `shares.twitter` - number of Twitter/X shares * `shares.reddit` - number of Reddit shares * `[News API]` Added **Social Shares Sorting** - new sorting parameters: * `shares.facebook.min` / `shares.facebook.max` - sort by Facebook shares * `shares.twitter.min` / `shares.twitter.max` - sort by Twitter shares * `shares.reddit.min` / `shares.reddit.max` - sort by Reddit shares > **Note:** Share counts update during the first 2 hours after publication. A newly published article may show a low count; check again later for the full value. ## 1.0.30 — January 22, 2026 * `[News API]` Added **relative dates (Solr-style Date Math)** for all date and time parameters: * **NOW keyword**: `NOW` returns current time, `NOW+1DAY`, `NOW-1WEEK` for offsets * **Truncation/Rounding**: `NOW/DAY` (start of today), `NOW/MONTH` (start of month), `NOW/YEAR` (start of year) * **Combined**: `NOW-1DAY/DAY` (start of yesterday), `NOW+1MONTH/MONTH` (start of next month) * **Short aliases**: `1w` (1 week ago), `2m` (2 months ago), `3d`, `4h`, `5y` * **Direction modifiers**: `+1w` (future), `-2m` (past, explicit) * **Full units**: `1WEEK`, `2MONTHS`, `3DAYS`, `24HOURS`, `1YEAR` * Works with `published_at.start`, `published_at.end`, `compare_window`, and `facet.range.gap` * Examples: `published_at.start=NOW-7DAYS`, `published_at.start=NOW/WEEK`, `compare_window=1w` ## 1.0.29 — January 8, 2026 * `[News API]` Added new endpoint **/v1/news/trends** - get trending values for a specific field, ranked by article count. Discover the most popular entities, categories, topics, industries, sources, countries, languages, and authors across your filtered result set. * `field` - the field to group and count articles by. Allowed fields: `source.id`, `category.id`, `topic.id`, `industry.id`, `entity.id` * `limit` - number of top results to return (default: 10, max: 100) * Results include names and details for entities, categories, topics, industries, sources, countries, languages and authors ## 1.0.28 — December 25, 2025 * `[News API]` Added **Geo-location Search** - filter articles by location: * **Circle Search** - filter by radius around coordinates: * `location.lat` - latitude coordinate (e.g., `52.52` for Berlin) * `location.lng` - longitude coordinate (e.g., `13.40` for Berlin) * `location.radius` - search radius in kilometers (e.g., `50` for 50km radius) * `location.radius.min` - minimum radius for ring search (exclude inner circle) * `location.radius.max` - maximum radius for ring search * **Bounding Box Search** - filter within rectangular areas: * `location.bbox` - format: `minLat,maxLat,minLng,maxLng` (e.g., `40.0,45.0,-74.0,-73.0` for NYC area) * **Articles with coordinates** - filter by whether coordinates are available: * `has_location_geo=1` - only articles with coordinates * `has_location_geo=0` - only articles without coordinates * Example: `/v1/news?location.lat=52.52&location.lng=13.40&location.radius=50` * Use it for local news feeds and regional event monitoring ## 1.0.27 — December 11, 2025 * `[News API]` Added **Media Richness Sorting** - new `sort.by=media_richness` parameter to sort articles by total media content: * Ranks articles by their combined image and video count * Use it to find articles with images and videos * Use with `sort.order=desc` to get articles with the most images and videos first * `[News API]` Added **reading-time filters** to select short, medium-length or long articles: * `is_quick_read=1` - articles with read time ≤ 2 minutes (news briefs, updates) * `is_medium_read=1` - articles with read time 3-7 minutes (standard articles) * `is_deep_dive=1` - articles with read time ≥ 10 minutes (in-depth analysis, long-form journalism) * `[News API]` Added **High Quality Content Filter** - use `is_high_quality` to find articles that meet source, image and author requirements: * `is_high_quality=1` - articles that are not duplicates, have a source rank ≥ 5, include images and have an identified author * Use it to select articles for your feed ## 1.0.26 — November 27, 2025 * `[News API]` Added **Clickbait Detection Filter** - use `is_clickbait` to find headlines whose tone differs sharply from the article body: * `is_clickbait=1` - find articles where title polarity differs from body AND title has strong sentiment (|score| > 0.5) * `is_clickbait=0` - find articles with a similar tone in the headline and body * Use it to find attention-grabbing headlines whose tone differs from the article * `[News API]` Added **Sentiment Gap Filter** - measure the difference between title and body sentiment scores: * `sentiment_gap.min` - minimum gap between title and body sentiment (0-2 range) * `sentiment_gap.max` - maximum gap between title and body sentiment (0-2 range) * Use it to compare the tone of headlines and article text ## 1.0.25 — November 13, 2025 * `[News API]` Added **Readability Filters** - filter articles by reading difficulty and target audience: * **Flesch-Kincaid Grade**: `readability.fk_grade`, `readability.fk_grade.min`, `readability.fk_grade.max` - filter by US grade level (0-30) * **Flesch Reading Ease**: `readability.ease`, `readability.ease.min`, `readability.ease.max` - filter by ease score (0-100, higher = easier) * **Automated Readability Index**: `readability.ari`, `readability.ari.min`, `readability.ari.max` - filter by ARI score * **Difficulty Level**: `readability.difficulty` - filter by `beginner`, `intermediate`, `advanced`, `expert` * **Target Audience**: `readability.audience` - filter by `children`, `general`, `professional`, `academic` * **Reading Age**: `readability.age`, `readability.age.min`, `readability.age.max` - filter by recommended reader age (6-22) * **Convenience filters**: `is_easy_read` (FRE ≥ 60), `is_difficult_read` (FRE < 40) * `[News API]` New **readability** object in article response with all readability metrics ## 1.0.24 — October 30, 2025 * `[News API]` Added **12 image filters** for size, orientation and other image properties: * **Orientation filters**: `is_landscape_media`, `is_portrait_media` - filter by image orientation * **Resolution filters**: `has_fullhd_images` (1920px+), `has_4k_images` (3840px+), `has_mobile_optimized_images` (320-800px) * **Social media ready**: `is_instagram_ready` (1080px+, square/4:5 ratio), `is_twitter_card_ready` (800px+, landscape) * **Content filters**: `has_multiple_images` (2+ images), `has_thumbnail` (small images ≤300px), `has_social_share_image` (Open Graph compatible: 1200x630+) * **Quality filters**: `has_consistent_image_sizes` (uniform image sizes, variance <200px) * **Mixed content**: `has_mixed_media` (articles with both images and videos) ## 1.0.23 — October 16, 2025 * `[News API]` Added **5 new facet fields**: * `content.length` - categorize articles by length (`short`, `medium`, `long`) * `published.weekday` - distinguish `weekday` vs `weekend` articles * `published.time_of_day` - group by time of day (`morning`, `afternoon`, `evening`, `night`) * `sentiment.strength` - classify sentiment intensity (`strong`, `moderate`, `neutral`) * `entity.id` - count articles by entity ## 1.0.22 — October 2, 2025 * `[News API]` Added **Range Facets** to count articles within date or numeric intervals. Use the counts for publication timelines, sentiment charts and reading-time charts. * `[News API]` **Range Facet parameters**: * `facet.range` - Enable/disable range faceting * `facet.range.field` - Field to create ranges on (`published_at`, `sentiment.overall.score`, `read_time`, etc.) * `facet.range.start` - Start value for range * `facet.range.end` - End value for range * `facet.range.gap` - Gap/interval between ranges (e.g., `+1DAY`, `+1WEEK`, `0.1` for numeric) * `[News API]` **8 range facet fields** now available: * **Date fields**: `published_at` - analyze article distribution over time * **Sentiment scores**: `sentiment.overall.score`, `sentiment.title.score`, `sentiment.body.score` * **Content metrics**: `read_time`, `media.images.count`, `media.videos.count` * **Source quality**: `source.rank.opr` ## 1.0.21 — September 18, 2025 * `[News API]` Added **Faceting** support - count articles grouped by field. Use the counts in filters and dashboard charts. * `[News API]` **24 facet fields** now available including: * **Source fields**: `source.id`, `source.country.id`, `source.bias`, `source.rank.opr` * **Classification**: `category.id`, `topic.id`, `industry.id` * **Language & Author**: `language.id`, `author.id` * **Sentiment**: `sentiment.overall.polarity`, `sentiment.title.polarity`, `sentiment.body.polarity` * **Article attributes**: `is_duplicate`, `is_free`, `is_important` * **Media content**: `media.images.count`, `media.videos.count` * **Reading time**: `read_time` * **Publication dates and times**: `published.year`, `published.month`, `published.day_of_week`, `published.hour` ## 1.0.20 — September 4, 2025 * `[News API]` Added **Highlighting** support - get text snippets with matching search terms highlighted. Use these snippets on search result pages. * `[News API]` **Highlight related words** — highlighting now includes synonyms and word forms. For example, a search for "innovation" can highlight "innovative" and "innovator". * `[News API]` **Highlighting parameters**: * `hl` - Enable/disable highlighting * `hl.fl` - Fields to highlight (`title`, `description`, `body`) * `hl.fragsize` - Snippet size (50-500 characters) * `hl.snippets` - Number of snippets per field (1-10) * `hl.tag.pre` / `hl.tag.post` - Custom highlight tags (default: `` / ``) ## 1.0.19 — August 21, 2025 * `[News API]` Added **fl** (field list) to choose which fields a response returns. Use dots to select nested fields, for example `fl=id,title,source.name,sentiment.overall.score`. ## 1.0.18 — August 7, 2025 * `[News API]` Added new endpoint **/v1/suggest/entities** - find entities as a user starts typing a name. Returns matches with their details, types and Wikipedia/Wikidata links. ## 1.0.17 — July 24, 2025 * `[News API]` Added new endpoint **/v1/balance** - check your API key balance and remaining credits. Returns api\_key, points, and plan information. * `[News API]` Added rate limiting to **/v1/balance** endpoint - limited to 30 requests per minute per API key to prevent abuse. ## 1.0.16 — July 10, 2025 * `[News API]` Added **disaster.name** and **ignore.disaster.name** to include or exclude articles about named disasters. * `[News API]` Added **disease.name** and **ignore.disease.name** to include or exclude articles about named diseases. * `[News API]` Added **event.name** and **ignore.event.name** to include or exclude articles about named events. ## 1.0.15 — June 26, 2025 * `[News API]` Added **body\_html**, the article text with HTML formatting. Available since December 30, 2025. ## 1.0.14 — June 12, 2025 * `[News API]` Added **is\_breaking** to articles: `true` for breaking news, `false` otherwise. * `[News API]` Added **read\_time** to articles: estimated reading time in minutes. ## 1.0.13 — May 29, 2025 * `[News API]` Added **source.bias** to articles: the publisher's bias, **left**, **right** or **center**. * `[News API]` Added [List of Entities](/platform/news-api/filters#entities-people-organizations-brands). Use the listed entities to filter articles. ## 1.0.12 — May 15, 2025 * `[News API]` Updated categories. See the full list of categories in the [documentation](https://docs.apitube.io/platform/news-api/list-of-categories). ## 1.0.11 — May 1, 2025 * `[News API]` Added new topics with the latest news from [the commodities market](https://docs.apitube.io/platform/news-api/list-of-topics). ## 1.0.10 — April 17, 2025 * `[News API]` Fixed rate limiting across all plans. ## 1.0.9 — April 3, 2025 * `[News API]` Added **is\_paywall**: `true` for articles behind a paywall, `false` otherwise. * `[News API]` Filter articles by paywall status. Example: `https://api.apitube.io/v1/news/everything?is_paywall=0`. More examples in the [documentation](https://docs.apitube.io/platform/news-api/filters#article-flags). * `[News API]` Filter by duplicate articles. Example: `https://api.apitube.io/v1/news/everything?is_duplicate=1`. More examples in the [documentation](https://docs.apitube.io/platform/news-api/filters#article-flags). * `[News API]` Added **favicon** to `source`: the URL of the publisher's favicon. ## 1.0.8 — March 20, 2025 * `[News API]` Get news by topics: **crypto news**, **movie news**, **video game news** ## 1.0.7 — March 6, 2025 * `[News API]` Added article export formats: **XML**, **XLSX** and **CSV**. ## 1.0.6 — February 20, 2025 * `[News API]` Added `story_id` to articles as the story identifier. ## 1.0.5 — February 6, 2025 * `[News API]` Added `links` and `videos` to articles. `links` lists related article URLs. ## 1.0.4 — January 23, 2025 * `[News API]` Added the `opinion` resource type for articles that express the writer's opinion rather than report news. ## 1.0.3 — January 9, 2025 * `[News API]` Added the `search` filter to find articles by matching their title or content. Example: `https://api.apitube.io/v1/news/everything?search=bitcoin`. * `[News API]` Raised the page-size limit for paid users to 1,000 articles. ## 1.0.2 — December 26, 2024 * `[News API]` Added new integrations: **Dart**, **Elixir**, **Haskell**, **Lua**, **Scala**, **Rust**. ## 1.0.1 — December 12, 2024 * `[News API]` Added new categories. * `[News API]` Article body HTML is now trimmed. --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/clojure/clj-http-client.md description: >- Call the APITube News API from Clojure using the clj-http library for HTTP requests --- # clj-http integration ```clojure ; Install: add clj-http {:mvn/version "3.12.3"} to deps.edn (require '[clj-http.client :as client]) (defn fetch-data [] (let [url "https://api.apitube.io/v1/news/everything" params {:query-params {"per_page" 10 "api_key" "YOUR_API_KEY"}} response (client/get url params)] (if (= 200 (:status response)) (println (:body response)) (println "Error:" (:status response))))) (fetch-data) ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/code-examples.md' description: >- Ready-to-run APITube News API requests for cURL, Python, Node.js, PHP, Java, Go and 26 more languages. Pick a language once and every code sample in the docs opens on it. --- # Code examples Choose a language to see how to call `/v1/news/everything`. Each page sends the same request, so you can compare HTTP clients. Your language choice applies across the docs. Choose Python here, for example, and code samples on other pages will open on the Python tab. To change it, select another language here or on any code block. You can use any language with an HTTP client. Send your key in the `X-API-Key` header. See [Authentication](/platform/news-api/authentication) for other ways to send it and [Search articles](/platform/news-api/everything) for all parameters. --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/ocaml/co-http-client.md' description: >- Call the APITube News API from OCaml using the CoHTTP library for asynchronous HTTP requests --- # CoHTTP integration ```ocaml (* Install: opam install cohttp-lwt-unix lwt *) open Lwt.Infix open Cohttp_lwt_unix let () = let uri = Uri.of_string "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" in Client.get uri >>= fun (resp, body) -> match Cohttp.Response.status resp with | `OK -> body |> Cohttp_lwt.Body.to_string >|= print_endline | _ -> Lwt_io.printf "Error: %d\n" (Cohttp.Code.code_of_status (Cohttp.Response.status resp)) |> Lwt_main.run ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/raw-ingestion.md description: Check for new articles regularly and process their content yourself. --- # Collect Raw Articles in Near Real Time {#ingest-raw-articles-in-near-real-time} Use [Raw Articles](/platform/news-api/raw) (`/v1/news/raw`) to get the earliest available articles in a basic format. Process the content yourself, or use [`/v1/news/everything`](/platform/news-api/endpoints) for articles with language, entities and other search fields. ::: warning Only the last ~24 hours are available Raw articles are available for roughly **one day**. Check often enough to keep up with new articles. Use `/v1/news/everything` for historical searches. ## Step 1: Pull the newest raw articles Sort by `id` descending, the default, to get the newest articles first. Start with a small `per_page` while testing; the maximum is `250`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/raw?sort.by=id&sort.order=desc&per_page=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/raw", params={ "sort.by": "id", "sort.order": "desc", "per_page": 50, "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "id", "sort.order": "desc", "per_page": "50", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/raw?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "id", "sort.order" => "desc", "per_page" => 50, "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/raw?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/raw") q := u.Query() q.Set("sort.by", "id") q.Set("sort.order", "desc") q.Set("per_page", "50") 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) } ``` ```java [Java] 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/raw?sort.by=id&sort.order=desc&per_page=50&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/raw?sort.by=id&sort.order=desc&per_page=50 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/everything ``` ::: Each article includes basic content and publisher details. Detected language, categories, topics, entities, industries and sentiment are unavailable: ```json { "id": 84512377, "title": "AI advances reshape the chip industry in 2026", "href": "https://example.com/ai-advances-2026", "created_at": "2026-05-27 08:00:00", "body": "The field of artificial intelligence continues to move quickly...", "body_html": "

The field of artificial intelligence continues to move quickly...

", "author": "Jane Doe", "keywords": ["technology", "ai", "semiconductors"], "source": { "id": 1024, "domain": "example.com", "bias": "center" } } ``` ## Step 2: Poll without missing or re-processing rows Save the **highest `id` you have processed**. On each check, start from page 1 and stop when you reach that ID. This lets you avoid processing articles twice even when `created_at` values arrive out of order. ::: code-group ```python [Python] import time import requests seen_max_id = 0 while True: page = 1 batch = [] while True: resp = requests.get( "https://api.apitube.io/v1/news/raw", params={"sort.by": "id", "sort.order": "desc", "per_page": 100, "page": page, "api_key": "YOUR_API_KEY"}, ).json() rows = resp.get("results", []) fresh = [r for r in rows if r["id"] > seen_max_id] batch.extend(fresh) # stop paging once we hit already-seen rows or run out of pages if len(fresh) < len(rows) or not resp.get("has_next_pages"): break page += 1 if batch: seen_max_id = max(r["id"] for r in batch) # hand `batch` to your own parser / queue here print(f"ingested {len(batch)} new articles, cursor={seen_max_id}") time.sleep(60) ``` ```javascript [Node.js] let seenMaxId = 0; async function poll() { let page = 1; const batch = []; while (true) { const params = new URLSearchParams({ "sort.by": "id", "sort.order": "desc", "per_page": "100", "page": String(page), "api_key": "YOUR_API_KEY" }); const resp = await (await fetch(`https://api.apitube.io/v1/news/raw?${params}`)).json(); const rows = resp.results ?? []; const fresh = rows.filter(r => r.id > seenMaxId); batch.push(...fresh); if (fresh.length < rows.length || !resp.has_next_pages) break; page += 1; } if (batch.length) { seenMaxId = Math.max(...batch.map(r => r.id)); // hand `batch` to your own parser / queue here console.log(`ingested ${batch.length} new articles, cursor=${seenMaxId}`); } } setInterval(poll, 60_000); ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/raw 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/everything ``` ::: ## Step 3: Narrow the feed (optional) `/v1/news/raw` supports only a small set of filters. It does not support `title`, `language.code`, `category.*`, `entity.*`, `sentiment.*` or other filters that require additional article fields. * `source.id` / `ignore.source.id` — include or exclude up to 3 source ids (comma-separated). * `published_at` — single-day window; or `published_at.start` / `published_at.end` for a range. * `sort.by` — `id` (default), `published_at`, or `created_at`; `sort.order` — `desc` (default) or `asc`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/raw?source.id=1024,2048&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/raw", params={ "source.id": "1024,2048", "per_page": 100, "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.id": "1024,2048", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/raw?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.id" => "1024,2048", "per_page" => 100, "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/raw?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/raw") q := u.Query() q.Set("source.id", "1024,2048") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/raw?source.id=1024,2048&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/raw?source.id=1024,2048&per_page=100 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/everything ``` ::: > Use [`/v1/news/everything`](/platform/news-api/endpoints) when you need to search by language, category, entity or sentiment. --- --- url: 'https://docs.apitube.io/platform/news-api/reference/companies.md' description: >- Search company and brand profiles with background details, recent articles and coverage summaries. --- # Companies Search profiles of organizations and brands. Each profile includes headquarters, founding date, website, key people, subsidiaries, a `coverage` summary and recent articles. ::: tip Added in 1.0.42 Full response field definitions are in [API Response Structure](/platform/news-api/response-structure#reference-endpoints-response-structure). See also the [Monitor a company](/platform/news-api/common-workflows/recipes/company-monitoring) recipe. ::: ## Endpoints ``` GET /v1/companies # list & search GET /v1/companies/{id} # single company profile ``` Send your API key in the `X-API-Key` header or `api_key` URL parameter. ## List & search ``` GET /v1/companies ``` ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `name` | string | No | Filter by company name (substring match). | | `wikidata_id` | string | No | Filter by Wikidata ID (e.g. `Q478214` or `478214`). | | `page` | integer | No | Page number (default `1`). | | `per_page` | integer | No | Results per page (default `100`, max `250`; the plan ceiling applies — Free 10, Starter 50, Basic 200). | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ### Example ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/companies?name=Tesla&per_page=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/companies", params={"name": "Tesla", "per_page": 5, "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ name: "Tesla", per_page: "5", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/companies?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["name" => "Tesla", "per_page" => 5, "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/companies?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/companies") q := u.Query() q.Set("name", "Tesla") q.Set("per_page", "5") 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) } ``` ```java [Java] 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/companies?name=Tesla&per_page=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/companies?name=Tesla&per_page=5 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/everything ``` ::: ```json { "status": "ok", "limit": 5, "page": 1, "has_next_pages": true, "results": [ { "id": 474, "name": "Tesla Robotaxi", "type": "brand", "links": { "self": "https://api.apitube.io/v1/companies/474", "articles": "https://api.apitube.io/v1/news/entity/474", "wikipedia": "https://en.wikipedia.org/wiki/Tesla_Robotaxi", "wikidata": "https://www.wikidata.org/wiki/Q135277686" }, "profile": { "description": "Ride-hailing service operated by Tesla, Inc.", "website_url": "https://www.tesla.com/robotaxi/", "brand_owner": { "name": "Tesla, Inc." } } } ] } ``` ## Company profile ``` GET /v1/companies/{id} ``` Get one company's `profile`, including headquarters, founding date, website, logo, key people and subsidiaries. The response also includes `coverage` and `recent_articles`. ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `coverage` | string | No | Set to `false` to omit the `coverage` block. | | `api_key` | string | Yes\* | Your API key. | The `coverage` block uses the same fields as the [People coverage block](/platform/news-api/reference/people#coverage-fields): `article_count`, `first_seen`/`last_seen`, `sentiment`, `momentum`, `timeline`, `top_sources`, `top_topics`, `top_countries`, `top_languages` and `related_entities`. `recent_articles` contains the **5 latest** articles about the company. Each includes the full article fields from `/v1/news/everything`, including `body`, `body_html` and `entities`, so responses can be large. `coverage=false` removes only the coverage summary. You cannot omit recent articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/companies/474?api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/companies/474", params={"api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const resp = await fetch("https://api.apitube.io/v1/companies/474?api_key=YOUR_API_KEY"); console.log(await resp.json()); ``` ```php [PHP] $data = json_decode(file_get_contents("https://api.apitube.io/v1/companies/474?api_key=YOUR_API_KEY"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/companies/474") q := u.Query() 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) } ``` ```java [Java] 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/companies/474?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/companies/474 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/everything ``` ::: ## Pricing Each request with results costs **1 point**. Searches with no results are free. If you have no credits left, the API returns `402`. ## Errors A request for a non-existent company returns `404` with code `ER0151` (`Company not found.`). --- --- url: 'https://docs.apitube.io/platform/news-api/count.md' description: Get the number of articles matching your filters without loading any content --- # Count Articles Use `/v1/news/count` to get the **number of matching articles** without downloading their content. It accepts the same search filters as [`/v1/news/everything`](/platform/news-api/everything). Use the total in a dashboard, a progress bar or to estimate a sample size. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/news/count POST /v1/news/count ``` GET and POST return the same results. Send filters in the URL with `GET` or as JSON in the request body with `POST`. The [Interactive Query Builder](/platform/news-api/query-builder) can assemble the filters for you. > Each request costs **1 point**. > With a **test key** the result is capped at `100`: a filter matching millions still returns `100`. Use a live key when the number itself matters. ## Query Parameters Use filters from [`/v1/news/everything`](/platform/news-api/everything) to choose which articles to count. Result options (`page`, `per_page`, `sort.*`, `export`, `fl`, `facet.*`) have no effect here. For example, `export=csv` still returns JSON, and `facet=true` does not add `facets`. ### Prompt Describe the news you want in plain language. The API chooses the filters. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prompt` | string | No | Describe the news you want, for example "Elon Musk, Tesla, news for the last 10 days". Check meta.prompt for the filters used. Parameters you send directly take priority. A new translation costs 2 extra points; repeated prompts use the cached translation for free. Requires Basic or above. Free and Starter return 403 ER0706. Range: 3–500 characters. | **Find articles Described in Plain Language** Find recent English-language articles about Tesla and Elon Musk using a plain-language request. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "prompt": "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: ### Title search {#title-and-full-text-search} Search inside article titles. Limited to a 31-day `published_at` window. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.title` | string | No | Exclude articles containing this text in the title. Range: 2–100 characters. | | `query` | string | No | Combine conditions with `AND`, `OR`, `NOT` and parentheses. Use `field:value` to choose a field, quotes and `~N` to find nearby words, `[a TO b]` for a range, and `{{...}}` for entity conditions. Terms without a field search titles. A result must also match any other filters you send. Title searches cover at most 31 days of `published_at`. Invalid syntax returns `ER0701`–`ER0712`. Range: 0–4000 characters. Example: `bitcoin AND NOT (etf OR futures)`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | | `title` | string | No | Search article titles. To find words near each other, use a phrase such as "climate change"~2. Searches can cover at most 31 days of published\_at. Without dates, the API searches the last 31 days. A wider explicit range returns ER0110. Range: 2–100 characters. | | `title_ends_with` | string | No | Find articles whose titles end with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | | `title_pattern` | string | No | Find titles containing this text. Special characters are treated literally; this is not a regular expression. Searches cover at most 31 days, as with title. Range: 2–200 characters. | | `title_starts_with` | string | No | Find articles whose titles start with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | **Find articles with a Specific Title Keyword** Find articles with "technology" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "technology") 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) } ``` ```java [Java] 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/count?title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=technology 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/count ``` ::: **Find articles with Multiple Title Keywords** Find articles that contain **both** "AI" **and** "innovation" in their titles. Multiple comma- or space-separated keywords use **AND logic** — every word must be present (order does not matter). To match articles containing *either* word, send one request per keyword and merge the results. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=AI,innovation&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "AI,innovation", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI,innovation", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI,innovation", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "AI,innovation") 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) } ``` ```java [Java] 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/count?title=AI,innovation&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=AI,innovation 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/count ``` ::: **Find articles with Titles Excluding Certain Words** Find articles that do not have "celebrity" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?ignore.title=celebrity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.title" => "celebrity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("ignore.title", "celebrity") 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) } ``` ```java [Java] 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/count?ignore.title=celebrity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?ignore.title=celebrity 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/count ``` ::: **Combined Title Filters for Specific News** Find titles about AI and exclude titles about job losses. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=AI&ignore.title=layoffs,job%20losses&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "AI", "ignore.title": "layoffs,job losses", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "ignore.title": "layoffs,job losses", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "ignore.title" => "layoffs,job losses", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "AI") q.Set("ignore.title", "layoffs,job losses") 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) } ``` ```java [Java] 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/count?title=AI&ignore.title=layoffs,job%20losses&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=AI&ignore.title=layoffs,job%20losses 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/count ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22breaking%20news%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"breaking news\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"breaking news\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"breaking news\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"breaking 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) } ``` ```java [Java] 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/count?title=%22breaking%20news%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22breaking%20news%22 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/count ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. Search for exact organization or person names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22Federal%20Reserve%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"Federal Reserve\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Federal Reserve\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Federal Reserve\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"Federal Reserve\"") 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) } ``` ```java [Java] 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/count?title=%22Federal%20Reserve%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22Federal%20Reserve%22 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/count ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. Search for exact organization or person names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22United%20Nations%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"United Nations\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"United Nations\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"United Nations\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"United Nations\"") 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) } ``` ```java [Java] 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/count?title=%22United%20Nations%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22United%20Nations%22 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/count ``` ::: **Find words near each other** Find articles where "Apple" and "iPhone" appear near each other: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22Apple%20iPhone%22~5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"Apple iPhone\"~5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Apple iPhone\"~5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Apple iPhone\"~5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"Apple iPhone\"~5") 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) } ``` ```java [Java] 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/count?title=%22Apple%20iPhone%22~5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22Apple%20iPhone%22~5 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/count ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=artificial%20intelligence&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "artificial intelligence", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "artificial intelligence", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "artificial intelligence", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "artificial intelligence") 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) } ``` ```java [Java] 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/count?title=artificial%20intelligence&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=artificial%20intelligence 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/count ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): Matches: "Artificial Intelligence" "Intelligence in Artificial Systems", "AI", "intelligent artificial systems" **Phrase search** (exact phrase only): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22artificial%20intelligence%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"artificial intelligence\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"artificial intelligence\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"artificial intelligence\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"artificial intelligence\"") 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) } ``` ```java [Java] 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/count?title=%22artificial%20intelligence%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22artificial%20intelligence%22 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/count ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): Matches: "Artificial Intelligence" "Intelligence in Artificial Systems", "AI", "intelligent artificial systems" **Phrase search** (exact phrase only): Matches only: "Artificial Intelligence", "artificial intelligence" (exact phrase) **Proximity search** (words near each other): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22artificial%20intelligence%22~3&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"artificial intelligence\"~3", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"artificial intelligence\"~3", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"artificial intelligence\"~3", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"artificial intelligence\"~3") 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) } ``` ```java [Java] 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/count?title=%22artificial%20intelligence%22~3&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22artificial%20intelligence%22~3 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/count ``` ::: **Find a company and product near each other** Find articles mentioning company and product name near each other: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"Tesla Cybertruck\"~3", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Tesla Cybertruck\"~3", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Tesla Cybertruck\"~3", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"Tesla Cybertruck\"~3") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/count?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS 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/count ``` ::: **Search for an exact event name** Search for specific event names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22Super%20Bowl%202024%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"Super Bowl 2024\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Super Bowl 2024\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Super Bowl 2024\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"Super Bowl 2024\"") 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) } ``` ```java [Java] 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/count?title=%22Super%20Bowl%202024%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22Super%20Bowl%202024%22 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/count ``` ::: **Search for an exact event name** Search for specific event names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=%22World%20Cup%20Final%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "\"World Cup Final\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"World Cup Final\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"World Cup Final\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "\"World Cup Final\"") 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) } ``` ```java [Java] 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/count?title=%22World%20Cup%20Final%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=%22World%20Cup%20Final%22 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/count ``` ::: ### Article lookup | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `article.id` | string | No | Comma-separated article IDs (max 5). Example: `12345`. | ### Date 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`. | **Find articles within a specific date range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "published_at.start": "2022-01-01", "published_at.end": "2022-01-31", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find news using a relative time range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["published_at.start" => "NOW-7DAYS", "published_at.end" => "NOW", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Search between exact times** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google", "published_at.start": "2025-03-01T14:00:00Z", "published_at.end": "2025-03-02T14:00:00Z", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "published_at.start": "2025-03-01T14:00:00Z", "published_at.end": "2025-03-02T14:00:00Z", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "published_at.start" => "2025-03-01T14:00:00Z", "published_at.end" => "2025-03-02T14:00:00Z", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google") q.Set("published_at.start", "2025-03-01T14:00:00Z") q.Set("published_at.end", "2025-03-02T14:00:00Z") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc 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/count ``` ::: ### Languages | 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`. | **Exclude French articles and publishers in France** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.source.country.code" => "fr", "ignore.language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles in the English and French languages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=en,fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "language.code": "en,fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?language.code=en,fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Compare languages and sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "language.code": "en,ja,de", "source.rank.opr.min": "6", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,ja,de", "source.rank.opr.min": "6", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,ja,de", "source.rank.opr.min" => "6", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("language.code", "en,ja,de") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find business news in one language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "zh,ko", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Compare company sentiment across languages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "language.code": "en,fr,de", "organization.name": "Netflix", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr,de", "organization.name": "Netflix", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr,de", "organization.name" => "Netflix", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("language.code", "en,fr,de") q.Set("organization.name", "Netflix") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/count?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at 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/count ``` ::: **Compare news by language and region** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "language.code": "ar,he", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "ar,he", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "ar,he", "category.id" => "medtop:11000000", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("language.code", "ar,he") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score 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/count ``` ::: ### Source | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.source.bias` | string | No | Exclude publishers with these political biases, separated by commas. 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). | | `is_premium_source` | boolean | No | Filter by premium source status. | | `is_verified_source` | boolean | No | Filter by verified source status. | | `source.bias` | string | No | Filter by publishers' political bias, separated by commas. 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. | **Find articles from a specific source (e.g., "theguardian.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?source.domain=theguardian.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?source.domain=theguardian.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles from multiple sources (e.g., "theguardian.com" and "nytimes.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Choose a source and language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "source.domain": "theguardian.com", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles with rank between 0.5 and 0.9** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "source.rank.opr.min": "5", "source.rank.opr.max": "9", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Compare source bias across regions** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.green_energy_news", "source.country.code": "us,gb,de", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "source.country.code": "us,gb,de", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "source.country.code" => "us,gb,de", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("source.country.code", "us,gb,de") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score 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/count ``` ::: **Find premium source articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_premium_source=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_premium_source": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_premium_source": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_premium_source" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_premium_source", "1") 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) } ``` ```java [Java] 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/count?is_premium_source=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_premium_source=1&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/count ``` ::: **Find verified source articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_verified_source=1&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_verified_source": "1", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_verified_source": "1", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_verified_source" => "1", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_verified_source", "1") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?is_verified_source=1&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_verified_source=1&published_at.start=2024-01-01 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/count ``` ::: ### Authors | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `author.id` | string | No | Comma-separated author IDs (max 3). | | `author.name` | string | No | Filter by author name (comma-separated, max 3). Range: 0–100 characters. | | `has_author` | boolean | No | Filter articles with/without author. | | `ignore.author.id` | string | No | Exclude these author IDs (comma-separated, max 3). | | `ignore.author.name` | string | No | Exclude articles by these authors (comma-separated, max 3). Range: 0–100 characters. | **Find articles by a specific author (e.g., "AFP")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=AFP&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "AFP", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/count?author.name=AFP&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=AFP 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/count ``` ::: **Find articles by multiple authors (e.g., "AFP" and "Reuters")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=AFP,Reuters&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "AFP,Reuters") 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) } ``` ```java [Java] 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/count?author.name=AFP,Reuters&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=AFP,Reuters 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/count ``` ::: **Choose an author and language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=AFP&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/count?author.name=AFP&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=AFP&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/count ``` ::: **Find an author's articles on a subject** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "Ezra Klein", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "Ezra Klein", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "Ezra Klein", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "Ezra Klein") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "10") 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) } ``` ```java [Java] 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/count?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10 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/count ``` ::: **Compare sentiment by author** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "AFP,Reuters") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=AFP,Reuters&sort.by=sentiment.overall.score 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/count ``` ::: **Follow an author's coverage over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "Reuters", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("author.name", "Reuters") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/count?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100 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/count ``` ::: **Find articles with attributed authors** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_author=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_author": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_author": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_author" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_author", "1") 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) } ``` ```java [Java] 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/count?has_author=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_author=1&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/count ``` ::: **Find articles without authors** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_author=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_author": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_author": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_author" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_author", "0") 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) } ``` ```java [Java] 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/count?has_author=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_author=0 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/count ``` ::: ### Categories | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `category.id` | string | No | Category IDs, separated by commas (max 3). Use IPTC Media Topic IDs such as medtop:04000000. Example: `medtop:04000000`. | | `ignore.category.id` | string | No | Exclude these categories (comma-separated, max 3). | **Find articles from a specific category (e.g., "Sport")** Find articles in the "sport" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:15000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?category.id=medtop:15000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles in the Finance Category** Find articles in the "finance" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Choose a category and language** Find articles in the "politics" category that are in French. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Track category coverage over time** Get finance articles in date order to track coverage over time. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:04000000", "published_at.start": "NOW-30DAY", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "published_at.start": "NOW-30DAY", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "published_at.start" => "NOW-30DAY", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("published_at.start", "NOW-30DAY") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/count?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100 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/count ``` ::: **Find category articles with images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:01000000", "media.images.count": "3", "source.rank.opr.min": "6", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:01000000", "media.images.count": "3", "source.rank.opr.min": "6", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:01000000", "media.images.count" => "3", "source.rank.opr.min" => "6", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:01000000") q.Set("media.images.count", "3") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc 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/count ``` ::: **Compare sentiment across categories** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity" => "positive", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:20000003,medtop:11000000,medtop:20000607") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score 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/count ``` ::: ### Topics | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.topic.id` | string | No | Exclude these topics (comma-separated, max 3). | | `topic.id` | string | No | Topic IDs, separated by commas (max 3). Find IDs with /v1/suggest/topics, for example industry.technology\_news. Example: `industry.technology_news`. | **Find articles from a specific topic (e.g., "crypto\_news")** Find articles in the "crypto news" topic. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.crypto_news&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?topic.id=industry.crypto_news&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Compare sentiment across topics** Compare sentiment across related topics. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.green_energy_news,industry.energy_news") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive 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/count ``` ::: **Compare topic coverage by language** Compare topic coverage in different languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.ai_news", "language.code": "en,de,ja", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "language.code": "en,de,ja", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "language.code" => "en,de,ja", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("language.code", "en,de,ja") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find a subject within a topic** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.crypto_news", "entity.id": "326,327", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "entity.id": "326,327", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "entity.id" => "326,327", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.crypto_news") q.Set("entity.id", "326,327") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find expert coverage of a topic** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.technology_news", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.technology_news", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.technology_news", "language.code" => "en", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.technology_news") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc 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/count ``` ::: ### Industries | 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`. | **Follow industry coverage over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("industry.id", "400,438") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?industry.id=400,438&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find innovation news across industries** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "industry.id": "400,438", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "title" => "innovation", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("industry.id", "400,438") q.Set("title", "innovation") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive 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/count ``` ::: ### Entities, people, organizations, brands | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `brand.name` | string | No | Filter by brand name (comma-separated, max 3). Range: 0–120 characters. | | `disaster.name` | string | No | Filter by natural disaster name (comma-separated, max 3). Range: 0–120 characters. | | `disease.name` | string | No | Filter by disease name (comma-separated, max 3). Range: 0–120 characters. | | `entity.id` | string | No | Comma-separated entity IDs (max 3). Example: `12345`. | | `event.name` | string | No | Filter by event name (comma-separated, max 3). Range: 0–120 characters. | | `ignore.brand.name` | string | No | Exclude articles mentioning these brands (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disaster.name` | string | No | Exclude articles mentioning these disasters (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disease.name` | string | No | Exclude articles mentioning these diseases (comma-separated, max 3). Range: 0–120 characters. | | `ignore.entity.id` | string | No | Exclude these entity IDs (comma-separated, max 3). | | `ignore.event.name` | string | No | Exclude articles mentioning these events (comma-separated, max 3). Range: 0–120 characters. | | `ignore.location.name` | string | No | Exclude articles mentioning these locations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.organization.name` | string | No | Exclude articles mentioning these organizations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.person.name` | string | No | Exclude articles mentioning these persons (comma-separated, max 3). Range: 0–120 characters. | | `ignore.sport.name` | string | No | Exclude articles mentioning these sports (comma-separated, max 3). Range: 0–120 characters. | | `location.name` | string | No | Filter by up to 3 known location names, separated by commas. Use /v1/suggest/entities to check the spelling. An unknown name returns 400 ER0218. Range: 0–120 characters. Example: `New York City`. | | `organization.name` | string | No | Filter by organization name (comma-separated, max 3). Range: 0–120 characters. Example: `Google`. | | `person.name` | string | No | Filter by person name (comma-separated, max 3). Range: 0–120 characters. Example: `Elon Musk`. | | `sport.name` | string | No | Filter by sport name (comma-separated, max 3). Range: 0–120 characters. | **Find articles about a specific entity (e.g., "Brad Pitt")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?entity.id=1278268&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles about multiple entities (e.g., "Brad Pitt" and "Angelina Jolie")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268,1282301&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268,1282301", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?entity.id=1278268,1282301&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles about an entity while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268", "ignore.entity.id": "315", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "ignore.entity.id": "315", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "ignore.entity.id" => "315", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: **Find articles mentioning both entities** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268,1282301", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("entity.id", "1278268,1282301") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Track entity mentions over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "per_page" => "100", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("entity.id", "1278268") q.Set("per_page", "100") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find entities mentioned together** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("entity.id", "1278268") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/count?entity.id=1278268&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?entity.id=1278268&sort.by=published_at 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/count ``` ::: **Find sentiment about an entity in market news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "entity.id": "1278268,1282301", "category.id": "medtop:04000000", "sentiment.overall.score.min": "0.7", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "category.id": "medtop:04000000", "sentiment.overall.score.min": "0.7", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "category.id" => "medtop:04000000", "sentiment.overall.score.min" => "0.7", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("entity.id", "1278268,1282301") q.Set("category.id", "medtop:04000000") q.Set("sentiment.overall.score.min", "0.7") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Find articles about a specific person (e.g., "Elon Musk")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk 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/count ``` ::: **Find articles about multiple people (e.g., "Elon Musk" and "Donald Trump")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk,Donald%20Trump&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk,Donald Trump", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk,Donald Trump") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk,Donald%20Trump&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk,Donald%20Trump 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/count ``` ::: **Compare sentiment about a person across sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "source.domain" => "theguardian.com,foxnews.com,nytimes.com", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("source.domain", "theguardian.com,foxnews.com,nytimes.com") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Find articles about a person and organization** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "organization.name" => "Tesla", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("organization.name", "Tesla") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc 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/count ``` ::: **Track negative coverage of a public figure** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find mentions of a person in research news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Stephen Hawking", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Stephen Hawking", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Stephen Hawking", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Stephen Hawking") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find articles about a specific organization (e.g., "Google")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google") 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) } ``` ```java [Java] 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/count?organization.name=Google&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google 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/count ``` ::: **Find articles about multiple organizations (e.g., "Google" and "Apple")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google,Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google,Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google,Apple") 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) } ``` ```java [Java] 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/count?organization.name=Google,Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google,Apple 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/count ``` ::: **Include one organization and exclude another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "ignore.organization.name" => "Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google") q.Set("ignore.organization.name", "Apple") 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) } ``` ```java [Java] 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/count?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google&ignore.organization.name=Apple 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/count ``` ::: **Follow competitor coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla,Meta,Netflix", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla,Meta,Netflix", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla,Meta,Netflix", "category.id" => "medtop:13000000", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla,Meta,Netflix") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Track company sentiment around financial news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "sort.by" => "published_at", "sort.order" => "asc", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google&sort.by=published_at&sort.order=asc&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/count ``` ::: **Find company news about social responsibility** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Microsoft,Google,Amazon", "title" => "sustainability,ESG,green", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Microsoft,Google,Amazon") q.Set("title", "sustainability,ESG,green") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive 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/count ``` ::: **Follow leadership changes** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "title" => "CEO", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Google") q.Set("title", "CEO") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find articles about a specific disaster (e.g., "Earthquake")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") 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) } ``` ```java [Java] 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/count?disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake 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/count ``` ::: **Find articles about multiple disasters (e.g., "Earthquake" and "Tsunami")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disaster.name": "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire") 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) } ``` ```java [Java] 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/count?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire 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/count ``` ::: **Find articles about a disaster while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disaster.name": "Great Hanshin Earthquake", "ignore.disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "ignore.disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "ignore.disaster.name" => "Great Hanshin Earthquake", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") q.Set("ignore.disaster.name", "Great Hanshin Earthquake") 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) } ``` ```java [Java] 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/count?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake 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/count ``` ::: **Find disaster coverage by region** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disaster.name": "Great Hanshin Earthquake", "location.name": "Japan", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "location.name": "Japan", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "location.name" => "Japan", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") q.Set("location.name", "Japan") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/count?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at 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/count ``` ::: **Find articles about a specific disease (e.g., "COVID-19")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disease.name=COVID-19&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disease.name": "COVID-19", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "COVID-19", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "COVID-19", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disease.name", "COVID-19") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/count?disease.name=COVID-19&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disease.name=COVID-19&category.id=medtop:07000000 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/count ``` ::: **Find articles about multiple diseases** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disease.name=COVID-19,Influenza&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disease.name": "COVID-19,Influenza", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "COVID-19,Influenza", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "COVID-19,Influenza", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disease.name", "COVID-19,Influenza") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/count?disease.name=COVID-19,Influenza&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disease.name=COVID-19,Influenza&category.id=medtop:07000000 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/count ``` ::: **Find articles about a disease while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disease.name": "malaria", "ignore.disease.name": "dengue fever", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "malaria", "ignore.disease.name": "dengue fever", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "malaria", "ignore.disease.name" => "dengue fever", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disease.name", "malaria") q.Set("ignore.disease.name", "dengue fever") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/count?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000 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/count ``` ::: **Follow a disease outbreak** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "disease.name": "malaria", "category.id": "medtop:07000000", "published_at.start": "2024-01-01", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "malaria", "category.id": "medtop:07000000", "published_at.start": "2024-01-01", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "malaria", "category.id" => "medtop:07000000", "published_at.start" => "2024-01-01", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("disease.name", "malaria") q.Set("category.id", "medtop:07000000") q.Set("published_at.start", "2024-01-01") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find articles about a specific brand (e.g., "Apple")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Coca-Cola&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Coca-Cola") 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) } ``` ```java [Java] 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/count?brand.name=Coca-Cola&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Coca-Cola 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/count ``` ::: **Find articles about multiple brands (e.g., "Apple" and "Google")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Coca-Cola,Samsung%20Galaxy&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Coca-Cola,Samsung Galaxy", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola,Samsung Galaxy", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola,Samsung Galaxy", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Coca-Cola,Samsung Galaxy") 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) } ``` ```java [Java] 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/count?brand.name=Coca-Cola,Samsung%20Galaxy&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Coca-Cola,Samsung%20Galaxy 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/count ``` ::: **Include one brand and exclude another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Coca-Cola", "ignore.brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola", "ignore.brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola", "ignore.brand.name" => "Coca-Cola", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Coca-Cola") q.Set("ignore.brand.name", "Coca-Cola") 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) } ``` ```java [Java] 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/count?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola 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/count ``` ::: **Compare brand sentiment across markets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Tesla Robotaxi", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla Robotaxi", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla Robotaxi", "source.country.code" => "us,de,gb", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Tesla Robotaxi") q.Set("source.country.code", "us,de,gb") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Find brand sponsorship coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Coca-Cola,Samsung Galaxy,iPhone Air", "title": "sponsorship,tournament,championship", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola,Samsung Galaxy,iPhone Air", "title": "sponsorship,tournament,championship", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola,Samsung Galaxy,iPhone Air", "title" => "sponsorship,tournament,championship", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Coca-Cola,Samsung Galaxy,iPhone Air") q.Set("title", "sponsorship,tournament,championship") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Follow negative coverage of a brand** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "brand.name": "Tesla Robotaxi", "title": "recall", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla Robotaxi", "title": "recall", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla Robotaxi", "title" => "recall", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("brand.name", "Tesla Robotaxi") q.Set("title", "recall") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find articles about a specific sport (e.g., "Football")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sport.name=Road%20tennis&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sport.name": "Road tennis", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sport.name", "Road tennis") 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) } ``` ```java [Java] 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/count?sport.name=Road%20tennis&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sport.name=Road%20tennis 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/count ``` ::: **Find articles about multiple sports** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sport.name=Road%20tennis,Nike%20Hoop%20Summit&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sport.name": "Road tennis,Nike Hoop Summit", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis,Nike Hoop Summit", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis,Nike Hoop Summit", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sport.name", "Road tennis,Nike Hoop Summit") 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) } ``` ```java [Java] 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/count?sport.name=Road%20tennis,Nike%20Hoop%20Summit&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sport.name=Road%20tennis,Nike%20Hoop%20Summit 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/count ``` ::: **Find articles about a sport while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sport.name": "Road tennis", "ignore.sport.name": "Road tennis", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis", "ignore.sport.name": "Road tennis", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis", "ignore.sport.name" => "Road tennis", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sport.name", "Road tennis") q.Set("ignore.sport.name", "Road tennis") 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) } ``` ```java [Java] 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/count?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis 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/count ``` ::: ### Event types | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `event.category` | string | No | Filter by event category. One of: `business`, `society`, `environment`. | | `event.type` | string | No | Comma-separated event types (max 5). Values: merger-acquisition, ipo, layoffs, bankruptcy, product-launch, funding-round, earnings, partnership, executive-change, lawsuit, data-breach, recall, expansion, closure, stock-movement, contract-award, spin-off, regulatory-action, election, protest, crime, terrorism, accident, policy-change, scandal, death, award-ceremony, conflict, diplomacy, health-crisis, migration, human-rights, earthquake, hurricane, flood, wildfire, tornado, tsunami, volcanic-eruption, drought, climate-event, pollution, wildlife-event, avalanche. Example: `ipo`. | | `ignore.event.type` | string | No | Exclude these event types (comma-separated, max 5). | **Find articles about a specific event (e.g., "Black Friday")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?event.name=Black%20Friday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.name": "Black Friday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("event.name", "Black Friday") 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) } ``` ```java [Java] 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/count?event.name=Black%20Friday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?event.name=Black%20Friday 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/count ``` ::: **Find articles about multiple events** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?event.name=Black%20Friday,Cyber%20Monday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.name": "Black Friday,Cyber Monday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday,Cyber Monday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday,Cyber Monday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("event.name", "Black Friday,Cyber Monday") 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) } ``` ```java [Java] 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/count?event.name=Black%20Friday,Cyber%20Monday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?event.name=Black%20Friday,Cyber%20Monday 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/count ``` ::: **Find articles about an event while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?event.name=Black%20Friday&ignore.event.name=Black%20Friday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.name": "Black Friday", "ignore.event.name": "Black Friday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday", "ignore.event.name": "Black Friday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday", "ignore.event.name" => "Black Friday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("event.name", "Black Friday") q.Set("ignore.event.name", "Black Friday") 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) } ``` ```java [Java] 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/count?event.name=Black%20Friday&ignore.event.name=Black%20Friday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?event.name=Black%20Friday&ignore.event.name=Black%20Friday 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/count ``` ::: **Compare sentiment in event coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.name": "Super Bowl Sunday", "sentiment.overall.polarity": "positive", "published_at.start": "2024-01-01", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Super Bowl Sunday", "sentiment.overall.polarity": "positive", "published_at.start": "2024-01-01", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Super Bowl Sunday", "sentiment.overall.polarity" => "positive", "published_at.start" => "2024-01-01", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("event.name", "Super Bowl Sunday") q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "2024-01-01") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score 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/count ``` ::: ### Sentiment | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `entity.sentiment.polarity` | string | No | Filter by the tone of coverage about an entity. Choose the entity with entity.id, person.name, organization.name, location.name, brand.name, event.name, disease.name, disaster.name or sport.name. Without one of these fields, the API returns 400 ER0293. 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. | | `is_clickbait` | boolean | No | Filter by clickbait detection. | | `sentiment.body.polarity` | string | No | Filter by the tone of the article body. One of: `positive`, `negative`, `neutral`. | | `sentiment.body.score` | number | No | Exact body sentiment score. Range: -1–1. | | `sentiment.body.score.max` | number | No | Maximum body sentiment score. Range: -1–1. | | `sentiment.body.score.min` | number | No | Minimum body sentiment score. Range: -1–1. | | `sentiment.consistent` | boolean | No | Find articles whose title and body have the same tone. | | `sentiment.mixed` | boolean | No | Find articles whose title and body have different tones. | | `sentiment.overall.polarity` | string | No | Filter by the overall tone of the article. One of: `positive`, `negative`, `neutral`. | | `sentiment.overall.score` | number | No | Exact overall sentiment score. Range: -1–1. | | `sentiment.overall.score.max` | number | No | Maximum overall sentiment score. Range: -1–1. | | `sentiment.overall.score.min` | number | No | Minimum overall sentiment score. Range: -1–1. | | `sentiment.title.polarity` | string | No | Filter by the tone of the article title. One of: `positive`, `negative`, `neutral`. | | `sentiment.title.score` | number | No | Exact title sentiment score. Range: -1–1. | | `sentiment.title.score.max` | number | No | Maximum title sentiment score. Range: -1–1. | | `sentiment.title.score.min` | number | No | Minimum title sentiment score. Range: -1–1. | | `sentiment_gap.max` | number | No | Maximum difference between title and body sentiment scores. Range: 0–2. | | `sentiment_gap.min` | number | No | Minimum difference between title and body sentiment scores. Range: 0–2. | **Find positive news** Find articles with positive sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive 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/count ``` ::: **Find positive news from a Specific Country** Find articles with positive sentiment specifically from Japan ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "source.country.code" => "jp", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("source.country.code", "jp") 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) } ``` ```java [Java] 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/count?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&source.country.code=jp 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/count ``` ::: **Find positive news in the Last 24 Hours** Find articles with positive sentiment published in the last 24 hours. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.polarity": "positive", "published_at.start": "2024-12-02", "published_at.end": "2024-12-03", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "published_at.start": "2024-12-02", "published_at.end": "2024-12-03", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "published_at.start" => "2024-12-02", "published_at.end" => "2024-12-03", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "2024-12-02") q.Set("published_at.end", "2024-12-03") 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) } ``` ```java [Java] 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/count?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03 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/count ``` ::: **Find articles with Positive Sentiment and a Specific Title** Find articles with positive sentiment that have "technology" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("title", "technology") 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) } ``` ```java [Java] 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/count?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.polarity=positive&title=technology 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/count ``` ::: **Filter several sentiment fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.score.min": "0.7", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.score.min": "0.7", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.score.min" => "0.7", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.score.min", "0.7") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Compare sentiment across markets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "negative", "source.country.code" => "us,gb,de", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.overall.polarity", "negative") q.Set("source.country.code", "us,gb,de") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/count?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000 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/count ``` ::: **Compare sentiment across source types** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.green_energy_news", "sentiment.overall.polarity": "positive", "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "sentiment.overall.polarity": "positive", "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "sentiment.overall.polarity" => "positive", "source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&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/count ``` ::: **Find sentiment in product reviews** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "review", "organization.name": "Apple", "sentiment.overall.score.min": "-1.0", "sentiment.overall.score.max": "1.0", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "review", "organization.name": "Apple", "sentiment.overall.score.min": "-1.0", "sentiment.overall.score.max": "1.0", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "review", "organization.name" => "Apple", "sentiment.overall.score.min" => "-1.0", "sentiment.overall.score.max" => "1.0", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "review") q.Set("organization.name", "Apple") q.Set("sentiment.overall.score.min", "-1.0") q.Set("sentiment.overall.score.max", "1.0") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score 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/count ``` ::: **Find articles with mixed sentiment** Find articles where the title sentiment differs from body sentiment, useful for detecting clickbait or controversial framing. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.mixed=1&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.mixed": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.mixed": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.mixed" => "1", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.mixed", "1") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/count?sentiment.mixed=1&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.mixed=1&category.id=medtop:11000000 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/count ``` ::: **Find articles with consistent sentiment** Find articles whose title and body have the same sentiment label. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment.consistent=1&has_author=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment.consistent": "1", "has_author": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.consistent": "1", "has_author": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.consistent" => "1", "has_author" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment.consistent", "1") q.Set("has_author", "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) } ``` ```java [Java] 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/count?sentiment.consistent=1&has_author=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment.consistent=1&has_author=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/count ``` ::: **Find clickbait articles** Find articles whose title has strong positive or negative sentiment that differs from the body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_clickbait=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_clickbait": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_clickbait", "1") 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) } ``` ```java [Java] 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/count?is_clickbait=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_clickbait=1&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/count ``` ::: **Exclude clickbait and choose verified sources** Find articles with consistent headline-to-content sentiment from verified sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_clickbait=0&is_verified_source=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_clickbait": "0", "is_verified_source": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "0", "is_verified_source": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "0", "is_verified_source" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_clickbait", "0") q.Set("is_verified_source", "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) } ``` ```java [Java] 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/count?is_clickbait=0&is_verified_source=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_clickbait=0&is_verified_source=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/count ``` ::: **Filter by sentiment gap – find articles with significant title/body mismatch** Find articles where the sentiment score differs by at least 0.5 between title and body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment_gap.min=0.5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment_gap.min": "0.5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment_gap.min": "0.5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment_gap.min" => "0.5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment_gap.min", "0.5") 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) } ``` ```java [Java] 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/count?sentiment_gap.min=0.5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment_gap.min=0.5 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/count ``` ::: **Find articles with similar title and body sentiment** Find articles with minimal sentiment difference (gap < 0.2) between title and body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sentiment_gap.max=0.2&source.rank.opr.min=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sentiment_gap.max": "0.2", "source.rank.opr.min": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment_gap.max": "0.2", "source.rank.opr.min": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment_gap.max" => "0.2", "source.rank.opr.min" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sentiment_gap.max", "0.2") q.Set("source.rank.opr.min", "5") 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) } ``` ```java [Java] 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/count?sentiment_gap.max=0.2&source.rank.opr.min=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sentiment_gap.max=0.2&source.rank.opr.min=5 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/count ``` ::: **Combined clickbait analysis for political news** Find political articles flagged as clickbait. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_clickbait": "1", "category.id": "medtop:11000000", "sentiment_gap.min": "0.3", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "1", "category.id": "medtop:11000000", "sentiment_gap.min": "0.3", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "1", "category.id" => "medtop:11000000", "sentiment_gap.min" => "0.3", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_clickbait", "1") q.Set("category.id", "medtop:11000000") q.Set("sentiment_gap.min", "0.3") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/count?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score 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/count ``` ::: ### Media | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_4k_images` | boolean | No | Filter articles with 4K images (>= 3840px width). | | `has_consistent_image_sizes` | boolean | No | Filter articles with consistent image dimensions. | | `has_fullhd_images` | boolean | No | Filter articles with Full HD images (>= 1920px width). | | `has_hq_images` | boolean | No | Filter articles with high-quality images (>= 1200px width). | | `has_image` | boolean | No | Filter articles with/without images. | | `has_mixed_media` | boolean | No | Filter articles with both image and video media types. | | `has_mobile_optimized_images` | boolean | No | Filter articles with mobile-optimized images (320-800px width). | | `has_multiple_images` | boolean | No | Filter articles with 2+ images. | | `has_social_share_image` | boolean | No | Filter articles with social share images (>= 1200x630px). | | `has_thumbnail` | boolean | No | Filter articles with thumbnail images (<= 300px width). | | `has_video` | boolean | No | Filter articles with/without videos. | | `is_instagram_ready` | boolean | No | Find images at least 1080px wide with a square or 4:5 aspect ratio for Instagram. | | `is_landscape_media` | boolean | No | Filter articles with landscape-oriented media. | | `is_media_rich` | boolean | No | Filter articles with both images and videos. | | `is_portrait_media` | boolean | No | Filter articles with portrait-oriented media. | | `is_twitter_card_ready` | boolean | No | Find landscape images at least 800px wide for Twitter Cards. | | `media.images.count` | integer | No | Exact number of images. Range: min 0. | | `media.images.count.max` | integer | No | Maximum number of images. Range: min 0. | | `media.images.count.min` | integer | No | Minimum number of images. Range: min 0. | | `media.images.height.max` | integer | No | Maximum image height in pixels. Range: min 0. | | `media.images.height.min` | integer | No | Minimum image height in pixels. Range: min 0. | | `media.images.width.max` | integer | No | Maximum image width in pixels. Range: min 0. | | `media.images.width.min` | integer | No | Minimum image width in pixels. Range: min 0. | | `media.videos.count` | integer | No | Exact number of videos. Range: min 0. | | `media.videos.count.max` | integer | No | Maximum number of videos. Range: min 0. | | `media.videos.count.min` | integer | No | Minimum number of videos. Range: min 0. | **Find articles with a specific number of images and videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "media.videos.count" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.count", "2") q.Set("media.videos.count", "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) } ``` ```java [Java] 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/count?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.count=2&media.videos.count=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/count ``` ::: **Find articles with images of a specific size** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "200", "media.images.width.max" => "800", "media.images.height.min" => "200", "media.images.height.max" => "800", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.width.min", "200") q.Set("media.images.width.max", "800") q.Set("media.images.height.min", "200") q.Set("media.images.height.max", "800") 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) } ``` ```java [Java] 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/count?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800 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/count ``` ::: **Find articles with multiple images and videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.count": "3", "media.videos.count": "1", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "3", "media.videos.count": "1", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "3", "media.videos.count" => "1", "category.id" => "medtop:13000000", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.count", "3") q.Set("media.videos.count", "1") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc 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/count ``` ::: **Find news with large images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.width.min": "1200", "media.images.height.min": "800", "media.images.count": "2", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "source.rank.opr.min": "6", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "1200", "media.images.height.min": "800", "media.images.count": "2", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "source.rank.opr.min": "6", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "1200", "media.images.height.min" => "800", "media.images.count" => "2", "sentiment.overall.polarity" => "positive", "category.id" => "medtop:13000000", "source.rank.opr.min" => "6", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.width.min", "1200") q.Set("media.images.height.min", "800") q.Set("media.images.count", "2") q.Set("sentiment.overall.polarity", "positive") q.Set("category.id", "medtop:13000000") q.Set("source.rank.opr.min", "6") 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) } ``` ```java [Java] 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/count?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6 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/count ``` ::: **Find education articles with videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.videos.count": "2", "title": "education,learning,tutorial", "sort.by": "media.videos.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.videos.count": "2", "title": "education,learning,tutorial", "sort.by": "media.videos.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.videos.count" => "2", "title" => "education,learning,tutorial", "sort.by" => "media.videos.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.videos.count", "2") q.Set("title", "education,learning,tutorial") q.Set("sort.by", "media.videos.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc 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/count ``` ::: **Find media-rich articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_media_rich=1&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_media_rich": "1", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_media_rich": "1", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_media_rich" => "1", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_media_rich", "1") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/count?is_media_rich=1&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_media_rich=1&category.id=medtop:13000000 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/count ``` ::: **Find articles with high-quality images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_hq_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_hq_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_hq_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_hq_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_hq_images", "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) } ``` ```java [Java] 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/count?has_hq_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_hq_images=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/count ``` ::: **Find multimedia-rich content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_image=1&has_video=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_image": "1", "has_video": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "has_video": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "has_video" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_image", "1") q.Set("has_video", "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) } ``` ```java [Java] 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/count?has_image=1&has_video=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_image=1&has_video=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/count ``` ::: **Find landscape-oriented images (ideal for headers/banners)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_landscape_media=1&has_fullhd_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_landscape_media": "1", "has_fullhd_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_landscape_media": "1", "has_fullhd_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_landscape_media" => "1", "has_fullhd_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_landscape_media", "1") q.Set("has_fullhd_images", "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) } ``` ```java [Java] 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/count?is_landscape_media=1&has_fullhd_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_landscape_media=1&has_fullhd_images=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/count ``` ::: **Find portrait-oriented images (ideal for mobile)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_portrait_media=1&has_mobile_optimized_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_portrait_media": "1", "has_mobile_optimized_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_portrait_media": "1", "has_mobile_optimized_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_portrait_media" => "1", "has_mobile_optimized_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_portrait_media", "1") q.Set("has_mobile_optimized_images", "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) } ``` ```java [Java] 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/count?is_portrait_media=1&has_mobile_optimized_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_portrait_media=1&has_mobile_optimized_images=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/count ``` ::: **Find Instagram-ready content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_instagram_ready=1&category.id=medtop:08000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_instagram_ready": "1", "category.id": "medtop:08000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_instagram_ready": "1", "category.id": "medtop:08000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_instagram_ready" => "1", "category.id" => "medtop:08000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_instagram_ready", "1") q.Set("category.id", "medtop:08000000") 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) } ``` ```java [Java] 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/count?is_instagram_ready=1&category.id=medtop:08000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_instagram_ready=1&category.id=medtop:08000000 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/count ``` ::: **Find Twitter Card optimized content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_twitter_card_ready=1&has_social_share_image=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_twitter_card_ready": "1", "has_social_share_image": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_twitter_card_ready": "1", "has_social_share_image": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_twitter_card_ready" => "1", "has_social_share_image" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_twitter_card_ready", "1") q.Set("has_social_share_image", "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) } ``` ```java [Java] 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/count?is_twitter_card_ready=1&has_social_share_image=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_twitter_card_ready=1&has_social_share_image=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/count ``` ::: **Find 4K image galleries** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_4k_images": "1", "has_multiple_images": "1", "category.id": "medtop:01000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_4k_images": "1", "has_multiple_images": "1", "category.id": "medtop:01000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_4k_images" => "1", "has_multiple_images" => "1", "category.id" => "medtop:01000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_4k_images", "1") q.Set("has_multiple_images", "1") q.Set("category.id", "medtop:01000000") 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) } ``` ```java [Java] 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/count?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000 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/count ``` ::: **Find images with similar dimensions** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_consistent_image_sizes=1&has_multiple_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_consistent_image_sizes": "1", "has_multiple_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_consistent_image_sizes": "1", "has_multiple_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_consistent_image_sizes" => "1", "has_multiple_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_consistent_image_sizes", "1") q.Set("has_multiple_images", "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) } ``` ```java [Java] 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/count?has_consistent_image_sizes=1&has_multiple_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_consistent_image_sizes=1&has_multiple_images=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/count ``` ::: **Find mixed media articles (images + videos)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_mixed_media=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_mixed_media": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_mixed_media": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_mixed_media" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_mixed_media", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?has_mixed_media=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_mixed_media=1&sort.by=media.images.count&sort.order=desc 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/count ``` ::: ### Readability | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_difficult_read` | boolean | No | Filter for difficult-to-read articles (Flesch Reading Ease < 40). | | `is_easy_read` | boolean | No | Filter for easy-to-read articles (Flesch Reading Ease >= 60). | | `readability.age` | integer | No | Exact reading age. Range: 6–22. | | `readability.age.max` | integer | No | Maximum reading age. Range: 6–22. | | `readability.age.min` | integer | No | Minimum reading age. Range: 6–22. | | `readability.ari` | number | No | Exact Automated Readability Index. Range: 0–30. | | `readability.ari.max` | number | No | Maximum Automated Readability Index. Range: 0–30. | | `readability.ari.min` | number | No | Minimum Automated Readability Index. Range: 0–30. | | `readability.audience` | string | No | Target audience. One of: `children`, `general`, `professional`, `academic`. | | `readability.difficulty` | string | No | Difficulty level. One of: `beginner`, `intermediate`, `advanced`, `expert`. | | `readability.ease` | number | No | Exact Flesch Reading Ease score. Range: 0–100. | | `readability.ease.max` | number | No | Maximum Flesch Reading Ease score. Range: 0–100. | | `readability.ease.min` | number | No | Minimum Flesch Reading Ease score. Range: 0–100. | | `readability.fk_grade` | number | No | Exact Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.max` | number | No | Maximum Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.min` | number | No | Minimum Flesch-Kincaid grade level. Range: 0–30. | ### Read time | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_deep_dive` | boolean | No | Filter for deep dives (>= 10 minutes). | | `is_long_read` | boolean | No | Filter for long reads (>= 5 minutes). | | `is_medium_read` | boolean | No | Filter for medium-length reads (3-7 minutes). | | `is_quick_read` | boolean | No | Filter for quick reads (<= 2 minutes). | | `is_short_read` | boolean | No | Filter for short reads (< 3 minutes). | | `read_time` | integer | No | Exact read time in minutes. Range: 0–1000. | | `read_time.max` | integer | No | Maximum read time in minutes. Range: 0–1000. | | `read_time.min` | integer | No | Minimum read time in minutes. Range: 0–1000. | ### Geo and local | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_location_geo` | boolean | No | Filter articles with/without geo-location data. | | `location.bbox` | string | No | Bounding box: minLat,maxLat,minLng,maxLng. Example: `40.0,41.0,-74.5,-73.5`. | | `location.lat` | number | No | Latitude for radius search. Range: -90–90. | | `location.lng` | number | No | Longitude for radius search. Range: -180–180. | | `location.radius` | number | No | Search radius in kilometers (requires location.lat and location.lng). Range: max 20000, > 0. | | `location.radius.min` | number | No | Minimum distance from point in km. Range: 0–20000. | **Find articles from a specific location (e.g., "Tokyo")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=Tokyo&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "Tokyo", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Tokyo", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Tokyo", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "Tokyo") 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) } ``` ```java [Java] 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/count?location.name=Tokyo&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=Tokyo 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/count ``` ::: **Find articles from multiple locations (e.g., "London" and "Paris")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=London,Paris&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "London,Paris", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "London,Paris") 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) } ``` ```java [Java] 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/count?location.name=London,Paris&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=London,Paris 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/count ``` ::: **Find English news about London and exclude Ontario** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London", "language.code" => "en", "ignore.location.name" => "Ontario", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "London") q.Set("language.code", "en") q.Set("ignore.location.name", "Ontario") 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) } ``` ```java [Java] 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/count?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=London&language.code=en&ignore.location.name=Ontario 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/count ``` ::: **Search for news within 50 km of Berlin (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.lat=52.52&location.lng=13.40&location.radius=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.lat": "52.52", "location.lng": "13.40", "location.radius": "50", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "52.52", "location.lng": "13.40", "location.radius": "50", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "52.52", "location.lng" => "13.40", "location.radius" => "50", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.lat", "52.52") q.Set("location.lng", "13.40") q.Set("location.radius", "50") 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) } ``` ```java [Java] 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/count?location.lat=52.52&location.lng=13.40&location.radius=50&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.lat=52.52&location.lng=13.40&location.radius=50 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/count ``` ::: **Local news with positive sentiment (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.lat": "40.7128", "location.lng": "-74.0060", "location.radius": "25", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "40.7128", "location.lng": "-74.0060", "location.radius": "25", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "40.7128", "location.lng" => "-74.0060", "location.radius" => "25", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.lat", "40.7128") q.Set("location.lng", "-74.0060") q.Set("location.radius", "25") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive 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/count ``` ::: **Regional breaking news (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.lat=51.5074&location.lng=-0.1278&location.radius=100&is_breaking=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.lat": "51.5074", "location.lng": "-0.1278", "location.radius": "100", "is_breaking": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "51.5074", "location.lng": "-0.1278", "location.radius": "100", "is_breaking": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "51.5074", "location.lng" => "-0.1278", "location.radius" => "100", "is_breaking" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.lat", "51.5074") q.Set("location.lng", "-0.1278") q.Set("location.radius", "100") 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) } ``` ```java [Java] 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/count?location.lat=51.5074&location.lng=-0.1278&location.radius=100&is_breaking=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.lat=51.5074&location.lng=-0.1278&location.radius=100&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/count ``` ::: **Find coverage of geopolitical events** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "France,Italy", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "France,Italy") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc 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/count ``` ::: **Find business news about several places** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Berlin,Paris", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft,Amazon", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "London,Berlin,Paris") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft,Amazon") 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) } ``` ```java [Java] 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/count?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon 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/count ``` ::: **Find natural disaster coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Japan,Israel", "title" => "earthquake", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "Japan,Israel") q.Set("title", "earthquake") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc 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/count ``` ::: **Compare tourism sentiment by location** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris,Berlin", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.name", "London,Paris,Berlin") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/count?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at 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/count ``` ::: **Search within the bounding box (New York City area)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.bbox=40.4774,40.9176,-74.2591,-73.7004&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.bbox": "40.4774,40.9176,-74.2591,-73.7004", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "40.4774,40.9176,-74.2591,-73.7004", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "40.4774,40.9176,-74.2591,-73.7004", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.bbox", "40.4774,40.9176,-74.2591,-73.7004") 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) } ``` ```java [Java] 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/count?location.bbox=40.4774,40.9176,-74.2591,-73.7004&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.bbox=40.4774,40.9176,-74.2591,-73.7004 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/count ``` ::: **Bounding box with category filter (tech news in Silicon Valley)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.bbox": "37.0,38.0,-123.0,-121.0", "category.id": "medtop:13000000", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "37.0,38.0,-123.0,-121.0", "category.id": "medtop:13000000", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "37.0,38.0,-123.0,-121.0", "category.id" => "medtop:13000000", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.bbox", "37.0,38.0,-123.0,-121.0") q.Set("category.id", "medtop:13000000") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01 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/count ``` ::: **Ring search – articles between 100 km and 500 km from Berlin** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.lat": "52.52", "location.lng": "13.40", "location.radius.min": "100", "location.radius": "500", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "52.52", "location.lng": "13.40", "location.radius.min": "100", "location.radius": "500", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "52.52", "location.lng" => "13.40", "location.radius.min" => "100", "location.radius" => "500", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.lat", "52.52") q.Set("location.lng", "13.40") q.Set("location.radius.min", "100") q.Set("location.radius", "500") 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) } ``` ```java [Java] 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/count?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500 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/count ``` ::: **Exclude center area - articles more than 50km from Paris** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.lat=48.8566&location.lng=2.3522&location.radius.min=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.lat": "48.8566", "location.lng": "2.3522", "location.radius.min": "50", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "48.8566", "location.lng": "2.3522", "location.radius.min": "50", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "48.8566", "location.lng" => "2.3522", "location.radius.min" => "50", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.lat", "48.8566") q.Set("location.lng", "2.3522") q.Set("location.radius.min", "50") 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) } ``` ```java [Java] 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/count?location.lat=48.8566&location.lng=2.3522&location.radius.min=50&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.lat=48.8566&location.lng=2.3522&location.radius.min=50 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/count ``` ::: **Articles with geographic coordinates only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_location_geo=1&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_location_geo": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_location_geo": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_location_geo" => "1", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_location_geo", "1") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/count?has_location_geo=1&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_location_geo=1&category.id=medtop:11000000 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/count ``` ::: **Articles without coordinates (text-based location only)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_location_geo=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_location_geo": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_location_geo": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_location_geo" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_location_geo", "0") 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) } ``` ```java [Java] 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/count?has_location_geo=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_location_geo=0 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/count ``` ::: **Regional disaster tracking with a bounding box** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "location.bbox": "25.0,35.0,-120.0,-80.0", "title": "hurricane", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "25.0,35.0,-120.0,-80.0", "title": "hurricane", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "25.0,35.0,-120.0,-80.0", "title" => "hurricane", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("location.bbox", "25.0,35.0,-120.0,-80.0") q.Set("title", "hurricane") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/count?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS 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/count ``` ::: ### Article flags | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_breaking` | boolean | No | Filter breaking news articles. | | `is_duplicate` | boolean | No | Filter duplicate/unique articles. | | `is_high_quality` | boolean | No | Find articles that are not duplicates, have a rank of at least 5 and include images and an author. | | `is_paywall` | boolean | No | Filter paywalled articles. | **Get easy-to-read articles for the general audience** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_easy_read=1&readability.audience=general&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_easy_read": "1", "readability.audience": "general", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_easy_read": "1", "readability.audience": "general", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_easy_read" => "1", "readability.audience" => "general", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_easy_read", "1") q.Set("readability.audience", "general") 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) } ``` ```java [Java] 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/count?is_easy_read=1&readability.audience=general&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_easy_read=1&readability.audience=general 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/count ``` ::: **Get beginner-level content about technology** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.difficulty=beginner&topic.id=industry.technology_news&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.difficulty": "beginner", "topic.id": "industry.technology_news", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "beginner", "topic.id": "industry.technology_news", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "beginner", "topic.id" => "industry.technology_news", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.difficulty", "beginner") q.Set("topic.id", "industry.technology_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) } ``` ```java [Java] 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/count?readability.difficulty=beginner&topic.id=industry.technology_news&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.difficulty=beginner&topic.id=industry.technology_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/count ``` ::: **Get articles suitable for teenagers (age 12–16)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.age.min=12&readability.age.max=16&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.age.min": "12", "readability.age.max": "16", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.age.min": "12", "readability.age.max": "16", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.age.min" => "12", "readability.age.max" => "16", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.age.min", "12") q.Set("readability.age.max", "16") 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) } ``` ```java [Java] 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/count?readability.age.min=12&readability.age.max=16&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.age.min=12&readability.age.max=16 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/count ``` ::: **Get professional-level business news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.audience=professional&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.audience": "professional", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.audience": "professional", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.audience" => "professional", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.audience", "professional") 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) } ``` ```java [Java] 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/count?readability.audience=professional&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.audience=professional&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/count ``` ::: **Find easy-to-read articles (reading ease 70–90)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.ease.min=70&readability.ease.max=90&is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.ease.min": "70", "readability.ease.max": "90", "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.ease.min": "70", "readability.ease.max": "90", "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.ease.min" => "70", "readability.ease.max" => "90", "is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.ease.min", "70") q.Set("readability.ease.max", "90") q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/count?readability.ease.min=70&readability.ease.max=90&is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.ease.min=70&readability.ease.max=90&is_duplicate=0 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/count ``` ::: **Get academic-level articles about science** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.difficulty": "expert", "readability.audience": "academic", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "expert", "readability.audience": "academic", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "expert", "readability.audience" => "academic", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.difficulty", "expert") q.Set("readability.audience", "academic") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/count?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000 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/count ``` ::: **Combine with grade level for educational content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "readability.fk_grade.min": "8", "readability.fk_grade.max": "12", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.fk_grade.min": "8", "readability.fk_grade.max": "12", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.fk_grade.min" => "8", "readability.fk_grade.max" => "12", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("readability.fk_grade.min", "8") q.Set("readability.fk_grade.max", "12") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/count?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000 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/count ``` ::: **Filter by article quality** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_duplicate" => "0", "is_paywall" => "0", "source.rank.opr.min" => "6", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("source.rank.opr.min", "6") 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) } ``` ```java [Java] 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/count?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&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/count ``` ::: **Find long-read articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_long_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_long_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_long_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_long_read" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_long_read", "1") 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) } ``` ```java [Java] 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/count?is_long_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_long_read=1&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/count ``` ::: **Find quick-read articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_short_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_short_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_short_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_short_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_short_read", "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) } ``` ```java [Java] 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/count?is_short_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_short_read=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/count ``` ::: **Find quick news briefs (≤2 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_quick_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_quick_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_quick_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_quick_read" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_quick_read", "1") 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) } ``` ```java [Java] 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/count?is_quick_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_quick_read=1&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/count ``` ::: **Find standard-length articles (3-7 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_medium_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_medium_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_medium_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_medium_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_medium_read", "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) } ``` ```java [Java] 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/count?is_medium_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_medium_read=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/count ``` ::: **Find in-depth analysis articles (≥10 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_deep_dive=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_deep_dive": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_deep_dive": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_deep_dive" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_deep_dive", "1") 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) } ``` ```java [Java] 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/count?is_deep_dive=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_deep_dive=1&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/count ``` ::: **Combine article quality filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_high_quality=1&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_high_quality": "1", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_high_quality": "1", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_high_quality" => "1", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_high_quality", "1") 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) } ``` ```java [Java] 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/count?is_high_quality=1&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_high_quality=1&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/count ``` ::: **Find media-rich articles sorted by media content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_image=1&sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_image": "1", "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "sort.by" => "media_richness", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_image", "1") q.Set("sort.by", "media_richness") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?has_image=1&sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_image=1&sort.by=media_richness&sort.order=desc 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/count ``` ::: **Follow breaking news only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_breaking=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_breaking": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() 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) } ``` ```java [Java] 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/count?is_breaking=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?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/count ``` ::: ### Sorting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `sort.by` | string | No | Field to sort results by. One of: `published_at`, `relevance`, `engagement`, `quality`, `controversy`, `trust`, `id`, `new`, `created_at`, `source.rank.opr`, `sentiment.overall.score`, `sentiment.title.score` and 18 more. Default: `published_at`. | | `sort.order` | string | No | Sort order. One of: `asc`, `desc`. Default: `desc`. | **Find articles sorted by the published date in ascending order** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=published_at&sort.order=asc 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/count ``` ::: **Sort by sentiment score, highest first** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Get the most viral/engaging articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "engagement", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "engagement") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=engagement&sort.order=desc 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/count ``` ::: **Get engaging breaking news with media** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_breaking": "1", "media.images.count.min": "2", "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "media.images.count.min": "2", "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "media.images.count.min" => "2", "sort.by" => "engagement", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_breaking", "1") q.Set("media.images.count.min", "2") q.Set("sort.by", "engagement") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc 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/count ``` ::: **Get the most media-rich articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "media_richness", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "media_richness") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=media_richness&sort.order=desc 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/count ``` ::: **Get articles from high-ranking sources sorted by source rank** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "source.rank.opr.min": "5", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.rank.opr.min": "5", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.rank.opr.min" => "5", "sort.by" => "source.rank.opr", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("source.rank.opr.min", "5") q.Set("sort.by", "source.rank.opr") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc 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/count ``` ::: **Get quick-read articles sorted by read time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?read_time.max=5&sort.by=read_time&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "read_time.max": "5", "sort.by": "read_time", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "read_time.max": "5", "sort.by": "read_time", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["read_time.max" => "5", "sort.by" => "read_time", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("read_time.max", "5") q.Set("sort.by", "read_time") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/count?read_time.max=5&sort.by=read_time&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?read_time.max=5&sort.by=read_time&sort.order=asc 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/count ``` ::: **Sort images by size** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.count.min": "3", "sort.by": "media.images.width.max", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count.min": "3", "sort.by": "media.images.width.max", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count.min" => "3", "sort.by" => "media.images.width.max", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.count.min", "3") q.Set("sort.by", "media.images.width.max") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc 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/count ``` ::: **Combine ranking and filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:13000000", "source.rank.opr.min": "6", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "source.rank.opr.min": "6", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "source.rank.opr.min" => "6", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc 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/count ``` ::: **Show articles with more media first** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "media.images.count": "2", "media.videos.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "media.videos.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "media.videos.count" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("media.images.count", "2") q.Set("media.videos.count", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/count?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000 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/count ``` ::: **Find long analysis articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:04000000&sort.by=read_time&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:04000000", "sort.by": "read_time", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "sort.by": "read_time", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "sort.by" => "read_time", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("sort.by", "read_time") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?category.id=medtop:04000000&sort.by=read_time&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:04000000&sort.by=read_time&sort.order=desc 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/count ``` ::: **Find articles by sentiment** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.ai_news", "sort.by": "sentiment.title.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "sort.by": "sentiment.title.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "sort.by" => "sentiment.title.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("sort.by", "sentiment.title.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc 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/count ``` ::: **Find long articles from highly ranked sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=quality&sort.order=desc&is_long_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "quality", "sort.order": "desc", "is_long_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "quality", "sort.order": "desc", "is_long_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "quality", "sort.order" => "desc", "is_long_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "quality") q.Set("sort.order", "desc") q.Set("is_long_read", "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) } ``` ```java [Java] 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/count?sort.by=quality&sort.order=desc&is_long_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=quality&sort.order=desc&is_long_read=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/count ``` ::: **Find articles with mixed sentiment** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=controversy&sort.order=desc&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "controversy", "sort.order": "desc", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "controversy", "sort.order": "desc", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "controversy", "sort.order" => "desc", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "controversy") q.Set("sort.order", "desc") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/count?sort.by=controversy&sort.order=desc&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=controversy&sort.order=desc&category.id=medtop:11000000 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/count ``` ::: **Sort by source trust** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=trust&sort.order=desc&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "trust", "sort.order": "desc", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "trust", "sort.order": "desc", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "trust", "sort.order" => "desc", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "trust") q.Set("sort.order", "desc") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?sort.by=trust&sort.order=desc&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=trust&sort.order=desc&published_at.start=2024-01-01 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/count ``` ::: **Combine source quality and article filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=quality&source.rank.opr.min=5&is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "quality", "source.rank.opr.min": "5", "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "quality", "source.rank.opr.min": "5", "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "quality", "source.rank.opr.min" => "5", "is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "quality") q.Set("source.rank.opr.min", "5") q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/count?sort.by=quality&source.rank.opr.min=5&is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=quality&source.rank.opr.min=5&is_duplicate=0 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/count ``` ::: **Find articles ranked by engagement** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "engagement", "published_at.start": "2024-01-01", "media.images.count.min": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "engagement", "published_at.start": "2024-01-01", "media.images.count.min": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "engagement", "published_at.start" => "2024-01-01", "media.images.count.min" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "engagement") q.Set("published_at.start", "2024-01-01") q.Set("media.images.count.min", "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) } ``` ```java [Java] 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/count?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=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/count ``` ::: **Find highly ranked sources for research** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "sort.by": "trust", "source.rank.opr.min": "6", "sentiment.overall.polarity": "neutral", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "trust", "source.rank.opr.min": "6", "sentiment.overall.polarity": "neutral", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "trust", "source.rank.opr.min" => "6", "sentiment.overall.polarity" => "neutral", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("sort.by", "trust") q.Set("source.rank.opr.min", "6") q.Set("sentiment.overall.polarity", "neutral") 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) } ``` ```java [Java] 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/count?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral 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/count ``` ::: ### Pagination | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `page` | integer | No | Page number for pagination. Range: min 1. Default: `1`. | | `per_page` | integer | No | Number of results per page (max 250; Free is capped at 10, Starter at 50, Basic at 200). Range: 1–250. Default: `100`. | **Find articles with pagination** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?per_page=10&page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["per_page" => "10", "page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("per_page", "10") q.Set("page", "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) } ``` ```java [Java] 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/count?per_page=10&page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?per_page=10&page=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/count ``` ::: **Fetch articles in pages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "per_page" => "100", "page" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("per_page", "100") q.Set("page", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc 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/count ``` ::: **Combine filters and pagination** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "3", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "3", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Amazon", "sentiment.overall.polarity" => "positive", "per_page" => "25", "page" => "3", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Amazon") q.Set("sentiment.overall.polarity", "positive") q.Set("per_page", "25") q.Set("page", "3") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc 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/count ``` ::: ### Faceting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `facet` | string | No | Return article counts grouped by the fields in facet.field. One of: `0`, `1`. | | `facet.field` | string | No | Fields to count by, separated by commas (max 5). Allowed values: source.id, source.country.id, source.bias, language.id, author.id, category.id, topic.id, industry.id, entity.id, sentiment.overall.polarity, sentiment.title.polarity, sentiment.body.polarity, sentiment.strength, is\_duplicate, is\_free, is\_important, media.images.count, media.videos.count, read\_time, content.length, published.year, published.month, published.day\_of\_week, published.hour, published.weekday, published.time\_of\_day. Example: `source.id,category.id`. | | `facet.limit` | integer | No | Maximum number of facet values per field (max 100). Range: 1–100. Default: `10`. | | `facet.mincount` | integer | No | Minimum count for a facet value to be included. Range: min 1. Default: `1`. | | `facet.range` | string | No | Count articles within date or numeric intervals. One of: `0`, `1`. | | `facet.range.end` | string | No | End value for range faceting (required with facet.range). | | `facet.range.field` | string | No | Field to group into date or numeric intervals. Values: published\_at, sentiment.overall.score, sentiment.title.score, sentiment.body.score, read\_time, source.rank.opr, media.images.count, media.videos.count. | | `facet.range.gap` | string | No | Size of each interval. Use a time span for dates, such as +1DAY, or a number for numeric fields. Default: `+1DAY`. | | `facet.range.start` | string | No | Start value for range faceting (required with facet.range). | **Basic faceting by source** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "source.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=source.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id 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/count ``` ::: **Faceting with multiple fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "source.id,language.id,sentiment.overall.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id,language.id,sentiment.overall.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id,language.id,sentiment.overall.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id,language.id,sentiment.overall.polarity") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity 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/count ``` ::: **Faceting with custom limit** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id&facet.limit=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "source.id", "facet.limit": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id", "facet.limit": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id", "facet.limit" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id") q.Set("facet.limit", "20") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=source.id&facet.limit=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=source.id&facet.limit=20 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/count ``` ::: **Faceting with minimum count filter** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=category.id&facet.mincount=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "category.id", "facet.mincount": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "category.id", "facet.mincount": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "category.id", "facet.mincount" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "category.id") q.Set("facet.mincount", "10") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=category.id&facet.mincount=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=category.id&facet.mincount=10 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/count ``` ::: **Faceting combined with search filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "bitcoin", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "facet" => "true", "facet.field" => "source.id,sentiment.overall.polarity", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "bitcoin") q.Set("facet", "true") q.Set("facet.field", "source.id,sentiment.overall.polarity") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/count?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS 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/count ``` ::: **Count articles by language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "language.id,source.country.id", "facet.limit": "15", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "language.id,source.country.id", "facet.limit": "15", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "language.id,source.country.id", "facet.limit" => "15", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "language.id,source.country.id") q.Set("facet.limit", "15") 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) } ``` ```java [Java] 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/count?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15 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/count ``` ::: **Faceting for sentiment analysis by source** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:04000000", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "facet" => "true", "facet.field" => "source.id,sentiment.overall.polarity", "facet.limit" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("facet", "true") q.Set("facet.field", "source.id,sentiment.overall.polarity") q.Set("facet.limit", "10") 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) } ``` ```java [Java] 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/count?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10 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/count ``` ::: **Count articles by publisher bias** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.green_energy_news", "facet": "true", "facet.field": "source.bias,source.country.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "facet": "true", "facet.field": "source.bias,source.country.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "facet" => "true", "facet.field" => "source.bias,source.country.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("facet", "true") q.Set("facet.field", "source.bias,source.country.id") 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) } ``` ```java [Java] 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/count?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id 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/count ``` ::: **Faceting for category distribution in top headlines** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=category.id,language.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "category.id,language.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "category.id,language.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "category.id,language.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "category.id,language.id") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=category.id,language.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=category.id,language.id 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/count ``` ::: **Build a filter menu** Use counts by field to build a filter sidebar: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "AI", "facet": "true", "facet.field": "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "facet": "true", "facet.field": "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "facet" => "true", "facet.field" => "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "AI") q.Set("facet", "true") q.Set("facet.field", "source.id,category.id,language.id,sentiment.overall.polarity") q.Set("facet.limit", "10") 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) } ``` ```java [Java] 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/count?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10 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/count ``` ::: **Count articles by hour of the day** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "published.hour", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.hour", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.hour", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.hour") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=published.hour&published_at.start=2024-01-01 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/count ``` ::: **Count articles by day of the week** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=published.day_of_week&category.id=medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "published.day_of_week", "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.day_of_week", "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.day_of_week", "category.id" => "medtop:15000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.day_of_week") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=published.day_of_week&category.id=medtop:15000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=published.day_of_week&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/count ``` ::: **Media richness analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "media.images.count,media.videos.count", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "media.images.count,media.videos.count", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "media.images.count,media.videos.count", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "media.images.count,media.videos.count") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000 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/count ``` ::: **Source quality distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "source.rank.opr,is_duplicate", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.rank.opr,is_duplicate", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.rank.opr,is_duplicate", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.rank.opr,is_duplicate") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01 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/count ``` ::: **Breaking news distribution by hour** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_breaking=1&facet=true&facet.field=published.hour,category.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_breaking": "1", "facet": "true", "facet.field": "published.hour,category.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet": "true", "facet.field": "published.hour,category.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet" => "true", "facet.field" => "published.hour,category.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_breaking", "1") q.Set("facet", "true") q.Set("facet.field", "published.hour,category.id") 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) } ``` ```java [Java] 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/count?is_breaking=1&facet=true&facet.field=published.hour,category.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_breaking=1&facet=true&facet.field=published.hour,category.id 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/count ``` ::: **Content length analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=read_time&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "read_time", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "read_time", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "read_time", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "read_time") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=read_time&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=read_time&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/count ``` ::: **Compare sentiment in titles, bodies and whole articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity") 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) } ``` ```java [Java] 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/count?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity 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/count ``` ::: **Yearly trend analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.ai_news", "facet": "true", "facet.field": "published.year,published.month", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "facet": "true", "facet.field": "published.year,published.month", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "facet" => "true", "facet.field" => "published.year,published.month", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("facet", "true") q.Set("facet.field", "published.year,published.month") 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) } ``` ```java [Java] 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/count?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month 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/count ``` ::: **Content length distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=content.length&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "content.length", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "content.length", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "content.length", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "content.length") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=content.length&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=content.length&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/count ``` ::: **Weekday vs weekend publishing patterns** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=published.weekday,published.time_of_day&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "published.weekday,published.time_of_day", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.weekday,published.time_of_day", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.weekday,published.time_of_day", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.weekday,published.time_of_day") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=published.weekday,published.time_of_day&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=published.weekday,published.time_of_day 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/count ``` ::: **Sentiment strength analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.strength,sentiment.overall.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.strength,sentiment.overall.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "sentiment.strength,sentiment.overall.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "sentiment.strength,sentiment.overall.polarity") 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) } ``` ```java [Java] 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/count?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity 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/count ``` ::: **Most mentioned entities** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?facet=true&facet.field=entity.id&facet.limit=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "facet": "true", "facet.field": "entity.id", "facet.limit": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "entity.id", "facet.limit": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "entity.id", "facet.limit" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "entity.id") q.Set("facet.limit", "20") 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) } ``` ```java [Java] 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/count?facet=true&facet.field=entity.id&facet.limit=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?facet=true&facet.field=entity.id&facet.limit=20 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/count ``` ::: **Time of day publishing analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_breaking": "1", "facet": "true", "facet.field": "published.time_of_day,published.weekday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet": "true", "facet.field": "published.time_of_day,published.weekday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet" => "true", "facet.field" => "published.time_of_day,published.weekday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_breaking", "1") q.Set("facet", "true") q.Set("facet.field", "published.time_of_day,published.weekday") 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) } ``` ```java [Java] 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/count?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday 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/count ``` ::: **Date range faceting - articles per week** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "bitcoin", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-03-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-03-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-03-01", "facet.range.gap" => "1WEEK", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "bitcoin") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-03-01") q.Set("facet.range.gap", "1WEEK") 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) } ``` ```java [Java] 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/count?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK 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/count ``` ::: **Date range faceting – articles per day** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-01-31", "facet.range.gap": "1DAY", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-01-31", "facet.range.gap": "1DAY", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-01-31", "facet.range.gap" => "1DAY", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-01-31") q.Set("facet.range.gap", "1DAY") 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) } ``` ```java [Java] 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/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY 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/count ``` ::: **Date range faceting - hourly distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "is_breaking": "1", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-15", "facet.range.end": "2024-01-16", "facet.range.gap": "1HOUR", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-15", "facet.range.end": "2024-01-16", "facet.range.gap": "1HOUR", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-15", "facet.range.end" => "2024-01-16", "facet.range.gap" => "1HOUR", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("is_breaking", "1") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-15") q.Set("facet.range.end", "2024-01-16") q.Set("facet.range.gap", "1HOUR") 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) } ``` ```java [Java] 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/count?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR 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/count ``` ::: **Count articles by sentiment score range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Apple", "facet.range" => "true", "facet.range.field" => "sentiment.overall.score", "facet.range.start" => "-1", "facet.range.end" => "1", "facet.range.gap" => "0.25", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Apple") q.Set("facet.range", "true") q.Set("facet.range.field", "sentiment.overall.score") q.Set("facet.range.start", "-1") q.Set("facet.range.end", "1") q.Set("facet.range.gap", "0.25") 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) } ``` ```java [Java] 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/count?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25 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/count ``` ::: **Reading time distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "category.id": "medtop:04000000", "facet.range": "true", "facet.range.field": "read_time", "facet.range.start": "0", "facet.range.end": "30", "facet.range.gap": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "facet.range": "true", "facet.range.field": "read_time", "facet.range.start": "0", "facet.range.end": "30", "facet.range.gap": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "facet.range" => "true", "facet.range.field" => "read_time", "facet.range.start" => "0", "facet.range.end" => "30", "facet.range.gap" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("facet.range", "true") q.Set("facet.range.field", "read_time") q.Set("facet.range.start", "0") q.Set("facet.range.end", "30") q.Set("facet.range.gap", "5") 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) } ``` ```java [Java] 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/count?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5 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/count ``` ::: **Source quality distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "topic.id": "industry.ai_news", "facet.range": "true", "facet.range.field": "source.rank.opr", "facet.range.start": "0.1", "facet.range.end": "0.9", "facet.range.gap": "0.1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "facet.range": "true", "facet.range.field": "source.rank.opr", "facet.range.start": "0.1", "facet.range.end": "0.9", "facet.range.gap": "0.1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "facet.range" => "true", "facet.range.field" => "source.rank.opr", "facet.range.start" => "0.1", "facet.range.end" => "0.9", "facet.range.gap" => "0.1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("facet.range", "true") q.Set("facet.range.field", "source.rank.opr") q.Set("facet.range.start", "0.1") q.Set("facet.range.end", "0.9") q.Set("facet.range.gap", "0.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) } ``` ```java [Java] 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/count?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.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/count ``` ::: **Combined regular and range faceting** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "climate", "facet": "true", "facet.field": "source.country.id,language.id", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1MONTH", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "climate", "facet": "true", "facet.field": "source.country.id,language.id", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1MONTH", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "climate", "facet" => "true", "facet.field" => "source.country.id,language.id", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-06-01", "facet.range.gap" => "1MONTH", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "climate") q.Set("facet", "true") q.Set("facet.field", "source.country.id,language.id") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-06-01") q.Set("facet.range.gap", "1MONTH") 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) } ``` ```java [Java] 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/count?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH 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/count ``` ::: **Track image and video counts over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "has_image": "1", "facet.range": "true", "facet.range.field": "media.images.count", "facet.range.start": "1", "facet.range.end": "20", "facet.range.gap": "2", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "facet.range": "true", "facet.range.field": "media.images.count", "facet.range.start": "1", "facet.range.end": "20", "facet.range.gap": "2", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "facet.range" => "true", "facet.range.field" => "media.images.count", "facet.range.start" => "1", "facet.range.end" => "20", "facet.range.gap" => "2", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("has_image", "1") q.Set("facet.range", "true") q.Set("facet.range.field", "media.images.count") q.Set("facet.range.start", "1") q.Set("facet.range.end", "20") q.Set("facet.range.gap", "2") 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) } ``` ```java [Java] 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/count?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2 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/count ``` ::: **Building a sentiment timeline dashboard** Track how sentiment about a brand changes over time: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-12-31", "facet.range.gap": "1MONTH", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-12-31", "facet.range.gap": "1MONTH", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Apple", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-12-31", "facet.range.gap" => "1MONTH", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Apple") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-12-31") q.Set("facet.range.gap", "1MONTH") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/count?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive 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/count ``` ::: **Compare subjects over the same period** Run multiple queries to compare different entities over the same time period: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-06-01", "facet.range.gap" => "1WEEK", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-06-01") q.Set("facet.range.gap", "1WEEK") 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) } ``` ```java [Java] 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/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK 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/count ``` ::: ### Highlighting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `hl` | string | No | Enable highlighting. One of: `0`, `1`. | | `hl.fl` | string | No | Comma-separated fields to highlight (max 5). Values: title, description, body. Default: `title,description`. Example: `title,description`. | | `hl.fragsize` | integer | No | Size of highlighted fragment in characters (50-500). Range: 50–500. Default: `150`. | | `hl.snippets` | integer | No | Number of highlighted snippets per field (max 10). Range: 1–10. Default: `3`. | | `hl.tag.post` | string | No | Closing tag for highlighted text. Default: ``. | | `hl.tag.pre` | string | No | Opening tag for highlighted text. Default: ``. | | `search` | string | No | List extra terms to highlight, separated by commas. Terms from `title` are included automatically. Requires `hl=1`. This parameter only changes highlighting; it does not filter articles. Example: `tesla,elon musk`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | **Basic highlighting for search results** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=bitcoin&hl=true&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "bitcoin", "hl": "true", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "hl": "true", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "hl" => "true", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "bitcoin") q.Set("hl", "true") 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) } ``` ```java [Java] 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/count?title=bitcoin&hl=true&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=bitcoin&hl=true 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/count ``` ::: **Highlighting with custom fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=artificial%20intelligence&hl=true&hl.fl=title,description,body&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "artificial intelligence", "hl": "true", "hl.fl": "title,description,body", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "artificial intelligence", "hl": "true", "hl.fl": "title,description,body", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "artificial intelligence", "hl" => "true", "hl.fl" => "title,description,body", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "artificial intelligence") q.Set("hl", "true") q.Set("hl.fl", "title,description,body") 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) } ``` ```java [Java] 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/count?title=artificial%20intelligence&hl=true&hl.fl=title,description,body&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=artificial%20intelligence&hl=true&hl.fl=title,description,body 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/count ``` ::: **Highlighting with larger snippets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "climate change", "hl": "true", "hl.fragsize": "300", "hl.snippets": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "climate change", "hl": "true", "hl.fragsize": "300", "hl.snippets": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "climate change", "hl" => "true", "hl.fragsize" => "300", "hl.snippets" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "climate change") q.Set("hl", "true") q.Set("hl.fragsize", "300") q.Set("hl.snippets", "5") 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) } ``` ```java [Java] 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/count?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5 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/count ``` ::: **Custom highlight tags for HTML** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "Tesla", "hl": "true", "hl.tag.pre": "%3Cmark%3E", "hl.tag.post": "%3C%2Fmark%3E", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "Tesla", "hl": "true", "hl.tag.pre": "%3Cmark%3E", "hl.tag.post": "%3C%2Fmark%3E", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "Tesla", "hl" => "true", "hl.tag.pre" => "%3Cmark%3E", "hl.tag.post" => "%3C%2Fmark%3E", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "Tesla") q.Set("hl", "true") q.Set("hl.tag.pre", "%3Cmark%3E") q.Set("hl.tag.post", "%3C%2Fmark%3E") 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) } ``` ```java [Java] 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/count?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E 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/count ``` ::: **Custom highlight tags for Markdown** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "SpaceX", "hl": "true", "hl.tag.pre": "%2A%2A", "hl.tag.post": "%2A%2A", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "SpaceX", "hl": "true", "hl.tag.pre": "%2A%2A", "hl.tag.post": "%2A%2A", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "SpaceX", "hl" => "true", "hl.tag.pre" => "%2A%2A", "hl.tag.post" => "%2A%2A", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "SpaceX") q.Set("hl", "true") q.Set("hl.tag.pre", "%2A%2A") q.Set("hl.tag.post", "%2A%2A") 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) } ``` ```java [Java] 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/count?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A 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/count ``` ::: **Combined with other filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "Apple", "organization.name": "Apple", "hl": "true", "hl.fl": "title,description", "sentiment.overall.polarity": "positive", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "Apple", "organization.name": "Apple", "hl": "true", "hl.fl": "title,description", "sentiment.overall.polarity": "positive", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "Apple", "organization.name" => "Apple", "hl" => "true", "hl.fl" => "title,description", "sentiment.overall.polarity" => "positive", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "Apple") q.Set("organization.name", "Apple") q.Set("hl", "true") q.Set("hl.fl", "title,description") q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/count?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS 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/count ``` ::: **Highlighting for entity search** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "person.name": "Elon Musk", "hl": "true", "hl.fl": "title,body", "hl.snippets": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "hl": "true", "hl.fl": "title,body", "hl.snippets": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "hl" => "true", "hl.fl" => "title,body", "hl.snippets" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("hl", "true") q.Set("hl.fl", "title,body") q.Set("hl.snippets", "5") 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) } ``` ```java [Java] 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/count?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5 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/count ``` ::: **Highlight synonyms and related word forms** Highlighting includes synonyms and related word forms. For example, searching for "innovation" also highlights "innovative", "innovate" and "innovator". ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=innovation&hl=true&hl.fl=title,description&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "innovation", "hl": "true", "hl.fl": "title,description", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "innovation", "hl": "true", "hl.fl": "title,description", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "innovation", "hl" => "true", "hl.fl" => "title,description", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "innovation") q.Set("hl", "true") q.Set("hl.fl", "title,description") 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) } ``` ```java [Java] 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/count?title=innovation&hl=true&hl.fl=title,description&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=innovation&hl=true&hl.fl=title,description 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/count ``` ::: **Building a search results page** Return highlighted text and selected fields for a search interface: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "title": "AI", "fl": "id,title,description,published_at,source.domain", "hl": "true", "hl.fl": "title,description", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "fl": "id,title,description,published_at,source.domain", "hl": "true", "hl.fl": "title,description", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "fl" => "id,title,description,published_at,source.domain", "hl" => "true", "hl.fl" => "title,description", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("title", "AI") q.Set("fl", "id,title,description,published_at,source.domain") q.Set("hl", "true") q.Set("hl.fl", "title,description") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/count?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20 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/count ``` ::: ### Field selection | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `fl` | string | No | Comma-separated list of fields to include in the response. Example: `id,title,published_at,source.domain`. | **Get only ID and title** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title") 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) } ``` ```java [Java] 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/count?fl=id,title&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title 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/count ``` ::: **Get an article with specific source fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,source.domain,source.rank.opr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,source.domain,source.rank.opr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain,source.rank.opr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain,source.rank.opr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,source.domain,source.rank.opr") 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) } ``` ```java [Java] 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/count?fl=id,title,source.domain,source.rank.opr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,source.domain,source.rank.opr 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/count ``` ::: **Get sentiment analysis data only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score") 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) } ``` ```java [Java] 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/count?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score 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/count ``` ::: **Get media information** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,media.images.count,media.videos.count&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,media.images.count,media.videos.count", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,media.images.count,media.videos.count", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,media.images.count,media.videos.count", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,media.images.count,media.videos.count") 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) } ``` ```java [Java] 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/count?fl=id,title,media.images.count,media.videos.count&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,media.images.count,media.videos.count 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/count ``` ::: **Return fewer fields for a combined news feed** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,published_at,source.domain", "category.id": "medtop:04000000", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,published_at,source.domain", "category.id": "medtop:04000000", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,published_at,source.domain", "category.id" => "medtop:04000000", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,published_at,source.domain") q.Set("category.id", "medtop:04000000") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/count?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100 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/count ``` ::: **Sentiment monitoring with minimal data** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name": "Tesla", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name": "Tesla", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name" => "Tesla", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at") q.Set("organization.name", "Tesla") 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) } ``` ```java [Java] 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/count?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla 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/count ``` ::: **Lightweight news ticker** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,source.domain,published_at", "is_breaking": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain,published_at", "is_breaking": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain,published_at", "is_breaking" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,source.domain,published_at") q.Set("is_breaking", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/count?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc 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/count ``` ::: **Return fewer fields for large result sets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "fl": "id,title,source.domain", "per_page": "100", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain", "per_page": "100", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain", "per_page" => "100", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("fl", "id,title,source.domain") q.Set("per_page", "100") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/count?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01 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/count ``` ::: ### Export | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `export` | string | No | Export format. One of: `json`, `csv`, `tsv`, `xml`, `rss`, `xlsx`, `parquet`, `jsonl`, `ndjson`. | ### Request and debug | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `debug` | string | No | Include user\_input in response for debugging. One of: `0`, `1`. | ## Response Format ```json { "status": "ok", "count": 0, "request_id": "string" } ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `status` | string | Always `ok` on success. | | `count` | integer | Number of articles matching the filters. | | `request_id` | string | Unique identifier for the request. | ## Request Examples ### GET with query filters ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?language.code=en&category.id=medtop:20000199&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/news/count", params={"language.code": "en", "category.id": "medtop:20000199", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en", "category.id": "medtop:20000199", api_key: "YOUR_API_KEY", }); const resp = await fetch(`https://api.apitube.io/v1/news/count?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query([ "language.code" => "en", "category.id" => "medtop:20000199", "api_key" => "YOUR_API_KEY", ]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/count?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("language.code", "en") q.Set("category.id", "medtop:20000199") 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) } ``` ```java [Java] 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/count?language.code=en&category.id=medtop:20000199&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?language.code=en&category.id=medtop:20000199 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/everything ``` ::: ### POST with JSON body ::: code-group ```bash [cURL] curl -X POST "https://api.apitube.io/v1/news/count" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "climate change", "language.code": "en", "published_at.start": "2026-01-01" }' ``` ```python [Python] import requests resp = requests.post( "https://api.apitube.io/v1/news/count", headers={"X-API-Key": "YOUR_API_KEY"}, json={"title": "climate change", "language.code": "en", "published_at.start": "2026-01-01"}, ) print(resp.json()) ``` ```javascript [Node.js] const resp = await fetch("https://api.apitube.io/v1/news/count", { method: "POST", headers: { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ title: "climate change", "language.code": "en", "published_at.start": "2026-01-01", }), }); console.log(await resp.json()); ``` ```php [PHP] $ch = curl_init("https://api.apitube.io/v1/news/count"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode([ "title" => "climate change", "language.code" => "en", "published_at.start" => "2026-01-01", ]), ]); $data = json_decode(curl_exec($ch), true); print_r($data); ``` ```go [Go] package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { payload, _ := json.Marshal(map[string]any{ "title": "climate change", "language.code": "en", "published_at.start": "2026-01-01", }) req, _ := http.NewRequest("POST", "https://api.apitube.io/v1/news/count", bytes.NewBuffer(payload)) req.Header.Set("X-API-Key", "YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) var data map[string]any json.Unmarshal(body, &data) fmt.Println(data) } ``` ```java [Java] 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 { String payload = "{\"title\": \"climate change\", \"language.code\": \"en\", \"published_at.start\": \"2026-01-01\"}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.apitube.io/v1/news/count")) .header("X-API-Key", "YOUR_API_KEY") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: POST https://api.apitube.io/v1/news/count Body (JSON): { "title": "climate change", "language.code": "en", "published_at.start": "2026-01-01" } 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/everything ``` ::: ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/news/count?source.id=1024" ``` ## Response Example ```json { "status": "ok", "count": 12345, "request_id": "req_abc123def456" } ``` ## Error Responses ### Invalid or Missing API Key ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 401, "code": "ER0175", "message": "API key is invalid or missing.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-24T14:30:00Z" } ] } ``` **Status Code:** 401 A missing, incorrectly formatted or unknown key returns `401 ER0175`. Article endpoints use the same error for all three cases. ### No Points on Account ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 402, "code": "ER0176", "message": "You have no points on your account.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-24T14:30:00Z" } ] } ``` **Status Code:** 402 ### Rate Limit Exceeded ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 429, "code": "ER0203", "message": "Rate limit exceeded.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-24T14:30:00Z" } ] } ``` **Status Code:** 429 --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/crystal/crest-client.md' description: Call the APITube News API from Crystal using the Crest HTTP client --- # Crest integration ```crystal require "crest" response = Crest.get( "https://api.apitube.io/v1/news/everything", params: {:per_page => "50", :api_key => "YOUR_API_KEY"} ) puts response.body ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/php/curl-client.md' description: Call the APITube News API from PHP using the cURL extension for HTTP requests --- # cURL integration ```php "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/shell/http-client.md' description: Integrate APITube News API with shell scripts using the cURL command-line tool --- # cURL integration ```shell curl --request GET \ --url 'https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY' ``` --- --- url: 'https://docs.apitube.io/platform/cyber-security.md' description: >- Search cyber security news. Read vulnerability IDs, affected product vendors and severity scores in each article. --- # Cyber Security API Get cyber security news from `/v1/cyber-security/news`. Each article includes a `cyber` block with vulnerability IDs (CVEs), affected vendors and the highest severity score (CVSS) stated in the article. It also shows whether a mentioned vulnerability appears in CISA's Known Exploited Vulnerabilities (KEV) catalog. Other fields use the standard News API format. ## What the Cyber Security API gives you * **Vulnerability details per article.** Read CVE IDs, KEV status, affected vendors and severity scores from `cyber.cves`, `cyber.in_kev`, `cyber.vendors` and `cyber.cvss`, without searching the article text yourself. * **The full News API filter set.** Language, date range, source, title search, entities, sentiment, event types, sorting, pagination, facets, field selection and exports work exactly as on [`/v1/news/everything`](/platform/news-api/everything). ## How the Cyber Security API selects articles 1. Add language, date, source or other filters to narrow the feed. 2. Read `cyber` for vulnerability details. The CVE IDs come from the article's title, description or body. KEV status shows whether a mentioned vulnerability is known to have been used in real attacks. ## Coverage limits * **CVE IDs must be written out.** `cyber.cves` lists IDs in the `CVE-YYYY-NNNN` form found in the text. An article that only says "a critical Fortinet flaw" has an empty list. * `cyber.cvss` is the highest score stated in the article. If the article gives no score, the field is `null`. * `cyber.vendors` lists vendors for the article's CVEs that are in KEV. Other companies mentioned in the article do not appear in this field. ## Pricing and plans * A request that returns articles costs **1 point**, the same as `/v1/news/everything`. A request that returns an empty page is not charged. * The endpoint is available on every plan, including Free. Plan limits are the same as for `/v1/news/everything`: on Free, `per_page` is capped at 10, the article body is hidden and exports other than JSON are not available. See [Rate limits and quotas](/platform/news-api/rate-limits). * The [`prompt`](/platform/news-api/ai/natural-language-search) parameter works here too. It requires Basic or above and adds 2 points when the wording has not been parsed before. * If your API key is restricted to specific endpoints, it needs the `cyber_security_news` scope. Unrestricted keys work as they are. ## Next steps * [Quickstart](/platform/cyber-security/quickstart) — GET and POST requests, response fields, limits and error codes. * [Filters](/platform/cyber-security/filters) — News API filters for security feeds. * [Response format](/platform/cyber-security/response-format) — what each `cyber` field means. * [Use cases](/platform/cyber-security/use-cases) — exploited-vulnerability alerts, vendor watch, daily digests. --- --- url: 'https://docs.apitube.io/platform/cyber-security/filters.md' description: >- Filter cyber security news by category, language, date, publisher, title, company, event type or tone. --- # Cyber Security API filters Use the filters below to narrow the cyber security news returned by `/v1/cyber-security/news`. Combine filters for titles, dates, languages, sources, entities, sentiment and other criteria. ## How the Cyber Security API combines filters Articles must match both the cyber category and every filter you add. Filters narrow the feed to a smaller selection of cyber news. * `organization.name=Fortinet&title=vulnerability` narrows the feed to articles mentioning Fortinet with "vulnerability" in their titles. * A boolean `query` such as `ransomware OR phishing` searches inside the cyber selection, never outside it. ## All filters and request options All parameters are optional. Every example below uses `/v1/cyber-security/news`. ### Prompt Describe the news you want in plain language. The API chooses the filters. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prompt` | string | No | Describe the news you want, for example "ransomware attacks affecting Microsoft in the last 10 days". Check meta.prompt for the filters used. Parameters you send directly take priority. A new translation costs 2 extra points; repeated prompts use the cached translation for free. Requires Basic or above. Free and Starter return 403 ER0706. Range: 3–500 characters. | **Find ransomware and vulnerability reports using plain language** Find recent English-language news about ransomware and vulnerabilities affecting Microsoft and Fortinet using a plain-language request. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?prompt=Ransomware%20attacks%20and%20security%20vulnerabilities%20affecting%20Microsoft%20and%20Fortinet%2C%20in%20English%2C%20from%20the%20last%2010%20days&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "prompt": "Ransomware attacks and security vulnerabilities affecting Microsoft and Fortinet, in English, from the last 10 days", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"prompt": "Ransomware attacks and security vulnerabilities affecting Microsoft and Fortinet, in English, from the last 10 days", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["prompt" => "Ransomware attacks and security vulnerabilities affecting Microsoft and Fortinet, in English, from the last 10 days", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("prompt", "Ransomware attacks and security vulnerabilities affecting Microsoft and Fortinet, in English, from the last 10 days") 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) } ``` ```java [Java] 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/cyber-security/news?prompt=Ransomware%20attacks%20and%20security%20vulnerabilities%20affecting%20Microsoft%20and%20Fortinet%2C%20in%20English%2C%20from%20the%20last%2010%20days&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?prompt=Ransomware%20attacks%20and%20security%20vulnerabilities%20affecting%20Microsoft%20and%20Fortinet%2C%20in%20English%2C%20from%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/cyber-security/filters ``` ::: ### Title search {#title-and-full-text-search} Search inside article titles. Limited to a 31-day `published_at` window. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.title` | string | No | Exclude articles containing this text in the title. Range: 2–100 characters. | | `query` | string | No | Combine conditions with `AND`, `OR`, `NOT` and parentheses. Use `field:value` to choose a field, quotes and `~N` to find nearby words, `[a TO b]` for a range, and `{{...}}` for entity conditions. Terms without a field search titles. A result must also match any other filters you send. Title searches cover at most 31 days of `published_at`. Invalid syntax returns `ER0701`–`ER0712`. Range: 0–4000 characters. Example: `ransomware OR phishing`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | | `title` | string | No | Search article titles. To find words near each other, use a phrase such as "data breach"~2. Searches can cover at most 31 days of published\_at. Without dates, the API searches the last 31 days. A wider explicit range returns ER0110. Range: 2–100 characters. | | `title_ends_with` | string | No | Find articles whose titles end with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | | `title_pattern` | string | No | Find titles containing this text. Special characters are treated literally; this is not a regular expression. Searches cover at most 31 days, as with title. Range: 2–200 characters. | | `title_starts_with` | string | No | Find articles whose titles start with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | **Find phishing reports** Find articles with "phishing" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=phishing&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "phishing", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "phishing", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "phishing", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "phishing") 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) } ``` ```java [Java] 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/cyber-security/news?title=phishing&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=phishing 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/cyber-security/filters ``` ::: **Find reports of ransomware attacks** Find titles containing both "ransomware" and "attack". Comma-separated keywords use AND logic: every word must be present. To search for either ransomware or phishing, use `query=ransomware OR phishing`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=ransomware%2Cattack&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "ransomware,attack", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "ransomware,attack", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ransomware,attack", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "ransomware,attack") 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) } ``` ```java [Java] 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/cyber-security/news?title=ransomware%2Cattack&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=ransomware%2Cattack 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/cyber-security/filters ``` ::: **Search for the exact phrase "zero day"** Find articles with the exact phrase "zero day" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22zero%20day%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"zero day\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"zero day\"", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"zero day\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"zero day\"") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22zero%20day%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22zero%20day%22 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/cyber-security/filters ``` ::: **Search for the exact phrase "remote code execution"** Find articles with the exact phrase "remote code execution" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"remote code execution\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"remote code execution\"", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"remote code execution\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"remote code execution\"") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22remote%20code%20execution%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22 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/cyber-security/filters ``` ::: **Search for the exact phrase "privilege escalation"** Find articles with the exact phrase "privilege escalation" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22privilege%20escalation%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"privilege escalation\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"privilege escalation\"", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"privilege escalation\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"privilege escalation\"") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22privilege%20escalation%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22privilege%20escalation%22 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/cyber-security/filters ``` ::: **Find Patch Tuesday security update reports** Find articles whose titles contain the exact phrase "Patch Tuesday". ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22Patch%20Tuesday%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"Patch Tuesday\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"Patch Tuesday\"", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Patch Tuesday\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"Patch Tuesday\"") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22Patch%20Tuesday%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22Patch%20Tuesday%22 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/cyber-security/filters ``` ::: **Search for the exact phrase "supply chain attack"** Find articles with the exact phrase "supply chain attack" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22supply%20chain%20attack%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"supply chain attack\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"supply chain attack\"", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"supply chain attack\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"supply chain attack\"") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22supply%20chain%20attack%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22supply%20chain%20attack%22 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/cyber-security/filters ``` ::: ### Article lookup | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `article.id` | string | No | Comma-separated article IDs (max 5). Example: `12345`. | ### Date 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`. | **Review ransomware reports from a specific period** Find ransomware coverage published between October 1 and October 15, 2026. The dates filter article publication, not the date an attack happened. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "ransomware", "published_at.start": "2026-10-01", "published_at.end": "2026-10-15", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "ransomware", "published_at.start": "2026-10-01", "published_at.end": "2026-10-15", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ransomware", "published_at.start" => "2026-10-01", "published_at.end" => "2026-10-15", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "ransomware") q.Set("published_at.start", "2026-10-01") q.Set("published_at.end", "2026-10-15") 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) } ``` ```java [Java] 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/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15 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/cyber-security/filters ``` ::: **Find vulnerability and exploit reports from the last seven days** Find titles containing "vulnerability" and either "exploit" or "exploited", limited to articles published in the last seven days. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?query=vulnerability%20AND%20%28exploit%20OR%20exploited%29&published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "query": "vulnerability AND (exploit OR exploited)", "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"query": "vulnerability AND (exploit OR exploited)", "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["query" => "vulnerability AND (exploit OR exploited)", "published_at.start" => "NOW-7DAYS", "published_at.end" => "NOW", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("query", "vulnerability AND (exploit OR exploited)") 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) } ``` ```java [Java] 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/cyber-security/news?query=vulnerability%20AND%20%28exploit%20OR%20exploited%29&published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?query=vulnerability%20AND%20%28exploit%20OR%20exploited%29&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/cyber-security/filters ``` ::: ### Languages | 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`. | **Find phishing reports in English and French** Find English- and French-language articles that mention "phishing" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=phishing&language.code=en%2Cfr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "phishing", "language.code": "en,fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "phishing", "language.code": "en,fr", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "phishing", "language.code" => "en,fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "phishing") 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) } ``` ```java [Java] 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/cyber-security/news?title=phishing&language.code=en%2Cfr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=phishing&language.code=en%2Cfr 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/cyber-security/filters ``` ::: ### Source | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.source.bias` | string | No | Exclude publishers with these political biases, separated by commas. 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). | | `is_premium_source` | boolean | No | Filter by premium source status. | | `is_verified_source` | boolean | No | Filter by verified source status. | | `source.bias` | string | No | Filter by publishers' political bias, separated by commas. 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: `bleepingcomputer.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. | **Find ransomware reports from BleepingComputer** Limit ransomware title searches to articles published by BleepingComputer. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=ransomware&source.domain=bleepingcomputer.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "ransomware", "source.domain": "bleepingcomputer.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "ransomware", "source.domain": "bleepingcomputer.com", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ransomware", "source.domain" => "bleepingcomputer.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "ransomware") q.Set("source.domain", "bleepingcomputer.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) } ``` ```java [Java] 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/cyber-security/news?title=ransomware&source.domain=bleepingcomputer.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=ransomware&source.domain=bleepingcomputer.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/cyber-security/filters ``` ::: **Find remote code execution reports from security publications** Search BleepingComputer and The Hacker News for titles containing the exact phrase "remote code execution". ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22&source.domain=bleepingcomputer.com%2Cthehackernews.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"remote code execution\"", "source.domain": "bleepingcomputer.com,thehackernews.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"remote code execution\"", "source.domain": "bleepingcomputer.com,thehackernews.com", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"remote code execution\"", "source.domain" => "bleepingcomputer.com,thehackernews.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"remote code execution\"") q.Set("source.domain", "bleepingcomputer.com,thehackernews.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) } ``` ```java [Java] 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/cyber-security/news?title=%22remote%20code%20execution%22&source.domain=bleepingcomputer.com%2Cthehackernews.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22&source.domain=bleepingcomputer.com%2Cthehackernews.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/cyber-security/filters ``` ::: ### Authors | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `author.id` | string | No | Comma-separated author IDs (max 3). | | `author.name` | string | No | Filter by author name (comma-separated, max 3). Range: 0–100 characters. | | `has_author` | boolean | No | Filter articles with/without author. | | `ignore.author.id` | string | No | Exclude these author IDs (comma-separated, max 3). | | `ignore.author.name` | string | No | Exclude articles by these authors (comma-separated, max 3). Range: 0–100 characters. | ### Categories | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `category.id` | string | No | Category IDs, separated by commas (max 3). Use IPTC Media Topic IDs such as medtop:20000086 (cyber crime). Example: `medtop:20000086`. | | `ignore.category.id` | string | No | Exclude these categories (comma-separated, max 3). | ### Topics | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.topic.id` | string | No | Exclude these topics (comma-separated, max 3). | | `topic.id` | string | No | Topic IDs, separated by commas (max 3). Find IDs with /v1/suggest/topics. | ### Industries | 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: `877` (Cybersecurity). | ### Entities, people, organizations, brands | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `brand.name` | string | No | Filter by brand name (comma-separated, max 3). Range: 0–120 characters. | | `disaster.name` | string | No | Filter by natural disaster name (comma-separated, max 3). Range: 0–120 characters. | | `disease.name` | string | No | Filter by disease name (comma-separated, max 3). Range: 0–120 characters. | | `entity.id` | string | No | Comma-separated entity IDs (max 3). Example: `1328071` (Microsoft). | | `event.name` | string | No | Filter by event name (comma-separated, max 3). Range: 0–120 characters. | | `ignore.brand.name` | string | No | Exclude articles mentioning these brands (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disaster.name` | string | No | Exclude articles mentioning these disasters (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disease.name` | string | No | Exclude articles mentioning these diseases (comma-separated, max 3). Range: 0–120 characters. | | `ignore.entity.id` | string | No | Exclude these entity IDs (comma-separated, max 3). | | `ignore.event.name` | string | No | Exclude articles mentioning these events (comma-separated, max 3). Range: 0–120 characters. | | `ignore.location.name` | string | No | Exclude articles mentioning these locations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.organization.name` | string | No | Exclude articles mentioning these organizations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.person.name` | string | No | Exclude articles mentioning these persons (comma-separated, max 3). Range: 0–120 characters. | | `ignore.sport.name` | string | No | Exclude articles mentioning these sports (comma-separated, max 3). Range: 0–120 characters. | | `location.name` | string | No | Filter by up to 3 known location names, separated by commas. Use /v1/suggest/entities to check the spelling. An unknown name returns 400 ER0218. Range: 0–120 characters. Example: `New York City`. | | `organization.name` | string | No | Filter by organization name (comma-separated, max 3). Range: 0–120 characters. Example: `Microsoft`. | | `person.name` | string | No | Filter by person name (comma-separated, max 3). Range: 0–120 characters. Example: `Brian Krebs`. | | `sport.name` | string | No | Filter by sport name (comma-separated, max 3). Range: 0–120 characters. | **Find vulnerability reports mentioning Microsoft** Combine the Microsoft entity ID with a title search for "vulnerability". This selects articles mentioning Microsoft; it does not identify the affected vendor of every CVE. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=vulnerability&entity.id=1328071&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "vulnerability", "entity.id": "1328071", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "vulnerability", "entity.id": "1328071", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "vulnerability", "entity.id" => "1328071", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "vulnerability") q.Set("entity.id", "1328071") 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) } ``` ```java [Java] 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/cyber-security/news?title=vulnerability&entity.id=1328071&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=vulnerability&entity.id=1328071 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/cyber-security/filters ``` ::: **Find vulnerability reports mentioning Fortinet** Combine the Fortinet organization filter with a title search for "vulnerability". Check the returned `cyber.cves` entries for the vulnerabilities described. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=vulnerability&organization.name=Fortinet&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "vulnerability", "organization.name": "Fortinet", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "vulnerability", "organization.name": "Fortinet", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "vulnerability", "organization.name" => "Fortinet", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "vulnerability") q.Set("organization.name", "Fortinet") 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) } ``` ```java [Java] 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/cyber-security/news?title=vulnerability&organization.name=Fortinet&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=vulnerability&organization.name=Fortinet 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/cyber-security/filters ``` ::: ### Event types | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `event.category` | string | No | Filter by event category. One of: `business`, `society`, `environment`. | | `event.type` | string | No | Comma-separated event types (max 5). Values: merger-acquisition, ipo, layoffs, bankruptcy, product-launch, funding-round, earnings, partnership, executive-change, lawsuit, data-breach, recall, expansion, closure, stock-movement, contract-award, spin-off, regulatory-action, election, protest, crime, terrorism, accident, policy-change, scandal, death, award-ceremony, conflict, diplomacy, health-crisis, migration, human-rights, earthquake, hurricane, flood, wildfire, tornado, tsunami, volcanic-eruption, drought, climate-event, pollution, wildlife-event, avalanche. Example: `data-breach`. | | `ignore.event.type` | string | No | Exclude these event types (comma-separated, max 5). | ### Sentiment | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `entity.sentiment.polarity` | string | No | Filter by the tone of coverage about an entity. Choose the entity with entity.id, person.name, organization.name, location.name, brand.name, event.name, disease.name, disaster.name or sport.name. Without one of these fields, the API returns 400 ER0293. 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. | | `is_clickbait` | boolean | No | Filter by clickbait detection. | | `sentiment.body.polarity` | string | No | Filter by the tone of the article body. One of: `positive`, `negative`, `neutral`. | | `sentiment.body.score` | number | No | Exact body sentiment score. Range: -1–1. | | `sentiment.body.score.max` | number | No | Maximum body sentiment score. Range: -1–1. | | `sentiment.body.score.min` | number | No | Minimum body sentiment score. Range: -1–1. | | `sentiment.consistent` | boolean | No | Find articles whose title and body have the same tone. | | `sentiment.mixed` | boolean | No | Find articles whose title and body have different tones. | | `sentiment.overall.polarity` | string | No | Filter by the overall tone of the article. One of: `positive`, `negative`, `neutral`. | | `sentiment.overall.score` | number | No | Exact overall sentiment score. Range: -1–1. | | `sentiment.overall.score.max` | number | No | Maximum overall sentiment score. Range: -1–1. | | `sentiment.overall.score.min` | number | No | Minimum overall sentiment score. Range: -1–1. | | `sentiment.title.polarity` | string | No | Filter by the tone of the article title. One of: `positive`, `negative`, `neutral`. | | `sentiment.title.score` | number | No | Exact title sentiment score. Range: -1–1. | | `sentiment.title.score.max` | number | No | Maximum title sentiment score. Range: -1–1. | | `sentiment.title.score.min` | number | No | Minimum title sentiment score. Range: -1–1. | | `sentiment_gap.max` | number | No | Maximum difference between title and body sentiment scores. Range: 0–2. | | `sentiment_gap.min` | number | No | Minimum difference between title and body sentiment scores. Range: 0–2. | ### Media | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_4k_images` | boolean | No | Filter articles with 4K images (>= 3840px width). | | `has_consistent_image_sizes` | boolean | No | Filter articles with consistent image dimensions. | | `has_fullhd_images` | boolean | No | Filter articles with Full HD images (>= 1920px width). | | `has_hq_images` | boolean | No | Filter articles with high-quality images (>= 1200px width). | | `has_image` | boolean | No | Filter articles with/without images. | | `has_mixed_media` | boolean | No | Filter articles with both image and video media types. | | `has_mobile_optimized_images` | boolean | No | Filter articles with mobile-optimized images (320-800px width). | | `has_multiple_images` | boolean | No | Filter articles with 2+ images. | | `has_social_share_image` | boolean | No | Filter articles with social share images (>= 1200x630px). | | `has_thumbnail` | boolean | No | Filter articles with thumbnail images (<= 300px width). | | `has_video` | boolean | No | Filter articles with/without videos. | | `is_instagram_ready` | boolean | No | Find images at least 1080px wide with a square or 4:5 aspect ratio for Instagram. | | `is_landscape_media` | boolean | No | Filter articles with landscape-oriented media. | | `is_media_rich` | boolean | No | Filter articles with both images and videos. | | `is_portrait_media` | boolean | No | Filter articles with portrait-oriented media. | | `is_twitter_card_ready` | boolean | No | Find landscape images at least 800px wide for Twitter Cards. | | `media.images.count` | integer | No | Exact number of images. Range: min 0. | | `media.images.count.max` | integer | No | Maximum number of images. Range: min 0. | | `media.images.count.min` | integer | No | Minimum number of images. Range: min 0. | | `media.images.height.max` | integer | No | Maximum image height in pixels. Range: min 0. | | `media.images.height.min` | integer | No | Minimum image height in pixels. Range: min 0. | | `media.images.width.max` | integer | No | Maximum image width in pixels. Range: min 0. | | `media.images.width.min` | integer | No | Minimum image width in pixels. Range: min 0. | | `media.videos.count` | integer | No | Exact number of videos. Range: min 0. | | `media.videos.count.max` | integer | No | Maximum number of videos. Range: min 0. | | `media.videos.count.min` | integer | No | Minimum number of videos. Range: min 0. | ### Readability | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_difficult_read` | boolean | No | Filter for difficult-to-read articles (Flesch Reading Ease < 40). | | `is_easy_read` | boolean | No | Filter for easy-to-read articles (Flesch Reading Ease >= 60). | | `readability.age` | integer | No | Exact reading age. Range: 6–22. | | `readability.age.max` | integer | No | Maximum reading age. Range: 6–22. | | `readability.age.min` | integer | No | Minimum reading age. Range: 6–22. | | `readability.ari` | number | No | Exact Automated Readability Index. Range: 0–30. | | `readability.ari.max` | number | No | Maximum Automated Readability Index. Range: 0–30. | | `readability.ari.min` | number | No | Minimum Automated Readability Index. Range: 0–30. | | `readability.audience` | string | No | Target audience. One of: `children`, `general`, `professional`, `academic`. | | `readability.difficulty` | string | No | Difficulty level. One of: `beginner`, `intermediate`, `advanced`, `expert`. | | `readability.ease` | number | No | Exact Flesch Reading Ease score. Range: 0–100. | | `readability.ease.max` | number | No | Maximum Flesch Reading Ease score. Range: 0–100. | | `readability.ease.min` | number | No | Minimum Flesch Reading Ease score. Range: 0–100. | | `readability.fk_grade` | number | No | Exact Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.max` | number | No | Maximum Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.min` | number | No | Minimum Flesch-Kincaid grade level. Range: 0–30. | ### Read time | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_deep_dive` | boolean | No | Filter for deep dives (>= 10 minutes). | | `is_long_read` | boolean | No | Filter for long reads (>= 5 minutes). | | `is_medium_read` | boolean | No | Filter for medium-length reads (3-7 minutes). | | `is_quick_read` | boolean | No | Filter for quick reads (<= 2 minutes). | | `is_short_read` | boolean | No | Filter for short reads (< 3 minutes). | | `read_time` | integer | No | Exact read time in minutes. Range: 0–1000. | | `read_time.max` | integer | No | Maximum read time in minutes. Range: 0–1000. | | `read_time.min` | integer | No | Minimum read time in minutes. Range: 0–1000. | ### Geo and local | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_location_geo` | boolean | No | Filter articles with/without geo-location data. | | `location.bbox` | string | No | Bounding box: minLat,maxLat,minLng,maxLng. Example: `40.0,41.0,-74.5,-73.5`. | | `location.lat` | number | No | Latitude for radius search. Range: -90–90. | | `location.lng` | number | No | Longitude for radius search. Range: -180–180. | | `location.radius` | number | No | Search radius in kilometers (requires location.lat and location.lng). Range: max 20000, > 0. | | `location.radius.min` | number | No | Minimum distance from point in km. Range: 0–20000. | ### Article flags | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_breaking` | boolean | No | Filter breaking news articles. | | `is_duplicate` | boolean | No | Filter duplicate/unique articles. | | `is_high_quality` | boolean | No | Find articles that are not duplicates, have a rank of at least 5 and include images and an author. | | `is_paywall` | boolean | No | Filter paywalled articles. | ### Sorting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `sort.by` | string | No | Field to sort results by. One of: `published_at`, `relevance`, `engagement`, `quality`, `controversy`, `trust`, `id`, `new`, `created_at`, `source.rank.opr`, `sentiment.overall.score`, `sentiment.title.score` and 18 more. Default: `published_at`. | | `sort.order` | string | No | Sort order. One of: `asc`, `desc`. Default: `desc`. | **Read ransomware coverage in publication order** Return ransomware reports from the last seven days, starting with the earliest publication. Publication order does not establish the order of attacks. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=NOW-7DAYS&published_at.end=NOW&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "ransomware", "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "ransomware", "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ransomware", "published_at.start" => "NOW-7DAYS", "published_at.end" => "NOW", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "ransomware") q.Set("published_at.start", "NOW-7DAYS") q.Set("published_at.end", "NOW") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/cyber-security/news?title=ransomware&published_at.start=NOW-7DAYS&published_at.end=NOW&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=NOW-7DAYS&published_at.end=NOW&sort.by=published_at&sort.order=asc 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/cyber-security/filters ``` ::: ### Pagination | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `page` | integer | No | Page number for pagination. Range: min 1. Default: `1`. | | `per_page` | integer | No | Number of results per page (max 250; Free is capped at 10, Starter at 50, Basic at 200). Range: 1–250. Default: `100`. | **Read the second page of data breach reports** Search titles for the exact phrase "data breach" and request the second page of ten results. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22data%20breach%22&per_page=10&page=2&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"data breach\"", "per_page": "10", "page": "2", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"data breach\"", "per_page": "10", "page": "2", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"data breach\"", "per_page" => "10", "page" => "2", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"data breach\"") q.Set("per_page", "10") q.Set("page", "2") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22data%20breach%22&per_page=10&page=2&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22data%20breach%22&per_page=10&page=2 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/cyber-security/filters ``` ::: ### Faceting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `facet` | string | No | Return article counts grouped by the fields in facet.field. One of: `0`, `1`. | | `facet.field` | string | No | Fields to count by, separated by commas (max 5). Allowed values: source.id, source.country.id, source.bias, language.id, author.id, category.id, topic.id, industry.id, entity.id, sentiment.overall.polarity, sentiment.title.polarity, sentiment.body.polarity, sentiment.strength, is\_duplicate, is\_free, is\_important, media.images.count, media.videos.count, read\_time, content.length, published.year, published.month, published.day\_of\_week, published.hour, published.weekday, published.time\_of\_day. Example: `source.id,category.id`. | | `facet.limit` | integer | No | Maximum number of facet values per field (max 100). Range: 1–100. Default: `10`. | | `facet.mincount` | integer | No | Minimum count for a facet value to be included. Range: min 1. Default: `1`. | | `facet.range` | string | No | Count articles within date or numeric intervals. One of: `0`, `1`. | | `facet.range.end` | string | No | End value for range faceting (required with facet.range). | | `facet.range.field` | string | No | Field to group into date or numeric intervals. Values: published\_at, sentiment.overall.score, sentiment.title.score, sentiment.body.score, read\_time, source.rank.opr, media.images.count, media.videos.count. | | `facet.range.gap` | string | No | Size of each interval. Use a time span for dates, such as +1DAY, or a number for numeric fields. Default: `+1DAY`. | | `facet.range.start` | string | No | Start value for range faceting (required with facet.range). | **Count ransomware reports by publication day** Count articles mentioning "ransomware" in their titles between October 1 and October 15, 2026. These are article counts, not counts of distinct attacks. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15&facet.range=1&facet.range.field=published_at&facet.range.start=2026-10-01&facet.range.end=2026-10-15&facet.range.gap=%2B1DAY&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "ransomware", "published_at.start": "2026-10-01", "published_at.end": "2026-10-15", "facet.range": "1", "facet.range.field": "published_at", "facet.range.start": "2026-10-01", "facet.range.end": "2026-10-15", "facet.range.gap": "+1DAY", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "ransomware", "published_at.start": "2026-10-01", "published_at.end": "2026-10-15", "facet.range": "1", "facet.range.field": "published_at", "facet.range.start": "2026-10-01", "facet.range.end": "2026-10-15", "facet.range.gap": "+1DAY", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ransomware", "published_at.start" => "2026-10-01", "published_at.end" => "2026-10-15", "facet.range" => "1", "facet.range.field" => "published_at", "facet.range.start" => "2026-10-01", "facet.range.end" => "2026-10-15", "facet.range.gap" => "+1DAY", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "ransomware") q.Set("published_at.start", "2026-10-01") q.Set("published_at.end", "2026-10-15") q.Set("facet.range", "1") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2026-10-01") q.Set("facet.range.end", "2026-10-15") q.Set("facet.range.gap", "+1DAY") 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) } ``` ```java [Java] 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/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15&facet.range=1&facet.range.field=published_at&facet.range.start=2026-10-01&facet.range.end=2026-10-15&facet.range.gap=%2B1DAY&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=ransomware&published_at.start=2026-10-01&published_at.end=2026-10-15&facet.range=1&facet.range.field=published_at&facet.range.start=2026-10-01&facet.range.end=2026-10-15&facet.range.gap=%2B1DAY 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/cyber-security/filters ``` ::: ### Highlighting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `hl` | string | No | Enable highlighting. One of: `0`, `1`. | | `hl.fl` | string | No | Comma-separated fields to highlight (max 5). Values: title, description, body. Default: `title,description`. Example: `title,description`. | | `hl.fragsize` | integer | No | Size of highlighted fragment in characters (50-500). Range: 50–500. Default: `150`. | | `hl.snippets` | integer | No | Number of highlighted snippets per field (max 10). Range: 1–10. Default: `3`. | | `hl.tag.post` | string | No | Closing tag for highlighted text. Default: ``. | | `hl.tag.pre` | string | No | Opening tag for highlighted text. Default: ``. | | `search` | string | No | List extra terms to highlight, separated by commas. Terms from `title` are included automatically. Requires `hl=1`. This parameter only changes highlighting; it does not filter articles. Example: `ransomware,phishing`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | **Highlight data breach mentions in search results** Find titles containing the exact phrase "data breach" and highlight matching terms in titles and descriptions. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22data%20breach%22&hl=1&hl.fl=title%2Cdescription&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"data breach\"", "hl": "1", "hl.fl": "title,description", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"data breach\"", "hl": "1", "hl.fl": "title,description", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"data breach\"", "hl" => "1", "hl.fl" => "title,description", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"data breach\"") q.Set("hl", "1") q.Set("hl.fl", "title,description") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22data%20breach%22&hl=1&hl.fl=title%2Cdescription&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22data%20breach%22&hl=1&hl.fl=title%2Cdescription 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/cyber-security/filters ``` ::: ### Field selection | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `fl` | string | No | Comma-separated list of fields to include in the response. Example: `id,title,published_at,source.domain`. | **Read CVE details alongside remote code execution reports** Find titles containing the exact phrase "remote code execution" and return article links with their `cyber` enrichment. Check each returned CVE entry; the title search does not guarantee that a CVE was identified. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22&fl=id%2Ctitle%2Chref%2Ccyber&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "title": "\"remote code execution\"", "fl": "id,title,href,cyber", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({"title": "\"remote code execution\"", "fl": "id,title,href,cyber", "api_key": "YOUR_API_KEY"}); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"remote code execution\"", "fl" => "id,title,href,cyber", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/cyber-security/news?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/cyber-security/news") q := u.Query() q.Set("title", "\"remote code execution\"") q.Set("fl", "id,title,href,cyber") 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) } ``` ```java [Java] 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/cyber-security/news?title=%22remote%20code%20execution%22&fl=id%2Ctitle%2Chref%2Ccyber&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube Cyber Security API: GET https://api.apitube.io/v1/cyber-security/news?title=%22remote%20code%20execution%22&fl=id%2Ctitle%2Chref%2Ccyber 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/cyber-security/filters ``` ::: ### Export | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `export` | string | No | Export format. One of: `json`, `csv`, `tsv`, `xml`, `rss`, `xlsx`, `parquet`, `jsonl`, `ndjson`. | ### Request and debug | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `debug` | string | No | Include user\_input in response for debugging. One of: `0`, `1`. | ## Filter limits A few limits carry over from `/v1/news/everything`: * Title search (`title`, `title_starts_with`, `title_ends_with`, `title_pattern`, `query`) covers at most **31 days** of `published_at`. A wider range returns `400 ER0110`; without a range the last 31 days are searched. * Multi-value filters keep the first **3** values (`source.domain`, `language.code`, `category.id`, `*.name` filters) or the first **5** (`event.type`). Extra values are dropped without an error. * `location.name` must match a known location entity. Check the spelling with [`/v1/suggest/entities`](/platform/news-api/suggest/entities); an unknown name returns `400 ER0218`. * `prompt` requires Basic or above. The filters it produces are combined with the cyber selection like any other filter. ## Fields you cannot filter on The response includes `cyber.cves`, `cyber.vendors`, `cyber.in_kev`, `cyber.exploited` and `cyber.cvss`, but these fields cannot filter a request. For example, `cyber.cves=…` or `cyber.cvss.min=…` returns `200` without applying that condition. The `ER0368` warning in `meta.warnings` names the ignored parameter. To keep only some vulnerabilities — for example, articles with `in_kev: true` or `cvss` of 9 and above — filter the results in your code. The [quickstart](/platform/cyber-security/quickstart#step-4-keep-only-exploited-vulnerabilities) has a ready script. ## Field selection, facets and highlighting Use these parameters to choose response fields, counts and highlighted text: * **`fl`** returns only the listed fields. `cyber` returns the whole block; `cyber.cves` or `cyber.in_kev` return a single field of it. Example: `fl=id,title,href,cyber.cves,cyber.in_kev`. * **`facet=1`** with `facet.field` counts values across all matching cyber articles, not only the current page. For ransomware coverage by publisher, combine `title=ransomware` with `facet=1&facet.field=source.id`. * **`facet.range=1`** counts matching articles within intervals, such as days. The ransomware example above groups reports by publication day; the counts do not represent distinct attacks. * **`hl=1`** marks the terms from `title` (and extra terms from `search`) in the title and description, and returns the fragments in `highlighting`. ## Related * [Response format](/platform/cyber-security/response-format) — what each `cyber` field contains. * [Quickstart](/platform/cyber-security/quickstart) — the endpoint, request examples, limits and error codes. * [Search articles](/platform/news-api/filters#parameters) — the full parameter list shared by this endpoint. --- --- url: 'https://docs.apitube.io/platform/cyber-security/quickstart.md' description: >- Use GET and POST to fetch cyber security news, read vulnerability details, filter results and export articles. Includes request costs, plan limits and error codes. --- # Cyber Security API quickstart Fetch security news, read vulnerability details and add filters in five steps. The examples use `/v1/cyber-security/news` and show how to keep articles about actively exploited vulnerabilities. ## Before you start Sign up and copy your key from the [APITube dashboard](https://apitube.io). The Free plan is enough for the requests below, except export. Send your key in `X-API-Key`, an `Authorization: Bearer` header, or the `api_key` URL parameter. See [Authentication](/platform/news-api/authentication). API keys restricted to specific endpoints need the `cyber_security_news` scope. Unrestricted keys work as they are. ## Endpoint ``` GET /v1/cyber-security/news POST /v1/cyber-security/news ``` Base URL: `https://api.apitube.io`. Send filters in the URL with `GET` or as JSON with `POST`. If a POST request also includes URL parameters, values in the body take priority. ## Step 1: Fetch the latest cyber security news Call the endpoint without filters. It returns the newest articles from the cyber crime and cyber warfare categories. Use `per_page=1` to fetch one article with every field. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?per_page=1" \ -H "X-API-Key: YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={"per_page": 1}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"], article["cyber"]["cves"]) ``` ```javascript [Node.js] const params = new URLSearchParams({ per_page: '1' }); const response = await fetch(`https://api.apitube.io/v1/cyber-security/news?${params}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); const data = await response.json(); for (const article of data.results) { console.log(article.published_at, article.title, article.cyber.cves); } ``` ::: ## Step 2: Read the response The complete JSON response contains one article in `results`, pagination links, export URLs and a `request_id`. The article values below are illustrative. On Free, `body` and `body_html` contain a preview; the full text shown here is available on paid plans. ```json { "status": "ok", "limit": 1, "path": "https://api.apitube.io/v1/cyber-security/news?per_page=1", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/cyber-security/news?per_page=1&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=json", "xlsx": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=xlsx", "csv": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=csv", "tsv": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=tsv", "xml": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=xml", "rss": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=rss", "parquet": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=parquet", "jsonl": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=jsonl" }, "request_id": "a4dd55a0-6cca-47a4-a5e5-4da27211e5b0", "results": [ { "id": 1234567890, "href": "https://example.com/security/firewall-vulnerability-review", "published_at": "2026-10-16T08:30:00.000Z", "title": "Security teams review firewall vulnerabilities and ongoing attacks", "description": "A sample security report covering firewall flaws, exploited vulnerabilities and vendor updates.", "body": "Security teams are reviewing reports of cyber crime and state-backed attacks involving firewall and email security products. The report mentions CVE-2025-20393, CVE-2025-40602, CVE-2025-23006 and CVE-2025-14733. Cisco, SonicWall and WatchGuard appear in the report. The highest stated CVSS score is 9. 8. Administrators are checking vendor advisories and reviewing affected deployments.", "body_html": "

Security teams are reviewing reports of cyber crime and state-backed attacks involving firewall and email security products. The report mentions CVE-2025-20393, CVE-2025-40602, CVE-2025-23006 and CVE-2025-14733.

Cisco, SonicWall and WatchGuard appear in the report. The highest stated CVSS score is 9.8. Administrators are checking vendor advisories and reviewing affected deployments.

", "language": "en", "translations": { "en": { "title": null, "description": null } }, "author": { "id": 5, "name": "Example Security Desk" }, "image": "https://example.com/images/security-review.jpg", "categories": [ { "id": 118, "name": "cyber crime", "score": 0.96, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:20000086" } }, { "id": 90, "name": "cyber warfare", "score": 0.87, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:20001361" } } ], "topics": [], "industries": [], "entities": [], "locations_mentioned": [], "source": { "id": 508004, "domain": "example.com", "home_page_url": "https://example.com", "type": "news", "bias": "", "rankings": { "opr": 0 }, "location": { "country_name": "United States", "country_code": "us" }, "favicon": "https://www.google.com/s2/favicons?domain=https://example.com" }, "sentiment": { "overall": { "score": -0.4, "polarity": "negative" }, "title": { "score": -0.3, "polarity": "negative" }, "body": { "score": -0.4, "polarity": "negative" } }, "summary": [ { "sentence": "Security teams are reviewing vulnerabilities affecting firewall and email security products.", "sentiment": { "score": -0.4, "polarity": "negative" } } ], "keywords": [ "cyber security", "firewall", "vulnerability", "Cisco", "SonicWall", "WatchGuard" ], "links": [ { "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog", "type": "external" } ], "media": [ { "url": "https://example.com/images/security-review.jpg", "type": "image" } ], "readability": { "flesch_kincaid_grade": 0, "flesch_reading_ease": 0, "automated_readability_index": 0, "difficulty_level": "unknown", "target_audience": "unknown", "reading_age": 0, "avg_words_per_sentence": 0, "avg_syllables_per_word": 0 }, "story": { "id": 1234567890, "uri": "https://api.apitube.io/v1/news/story/1234567890" }, "shares": { "total": 0, "facebook": 0, "twitter": 0, "reddit": 0 }, "is_duplicate": false, "is_free": true, "is_breaking": false, "read_time": 1, "sentences_count": 5, "paragraphs_count": 2, "words_count": 50, "characters_count": 386, "cyber": { "type": [ "crime", "warfare" ], "cves": [ "CVE-2025-20393", "CVE-2025-40602", "CVE-2025-23006", "CVE-2025-14733" ], "vendors": [ "Cisco", "SonicWall", "WatchGuard" ], "in_kev": true, "exploited": true, "cvss": 9.8 } } ] } ``` What the `cyber` block tells you about this article: * `type` — the article is in both cyber categories, crime and warfare. * `cves` — the CVE IDs mentioned in the title, description or body, in the order they first appear. * `in_kev` and `exploited` — at least one of those CVEs is in the CISA Known Exploited Vulnerabilities catalog. * `vendors` — the vendors of the CVEs that are in the KEV catalog. * `cvss` — the highest CVSS score written in the article, here 9.8. Every field is described in [Response format](/platform/cyber-security/response-format). ## Step 3: Narrow the feed Pick one cyber category with `cyber.type`, then add any News API filter. This request returns English cyber crime articles published since a given date, newest first: | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `cyber.type` | string | No | `crime` for cyber crime, `warfare` for cyber warfare. Omit to include both. One lowercase value; anything else returns `400 ER0900`. | ```bash curl "https://api.apitube.io/v1/cyber-security/news?cyber.type=crime&language.code=en&published_at.start=2026-10-01&sort.by=published_at&sort.order=desc&per_page=10&fl=id,title,href,cyber" \ -H "X-API-Key: YOUR_API_KEY" ``` Combine `cyber.type` with title, language, date, source, entity and other filters. Sorting, pagination, facets, highlighting, `fl` and `export` also work here. See [Filters](/platform/cyber-security/filters) for the complete reference. ### Send filters with POST Use a JSON body for long queries or lists of values: ```bash curl -X POST "https://api.apitube.io/v1/cyber-security/news" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "cyber.type": "warfare", "query": "satellite OR \"power grid\"", "language.code": "en", "published_at.start": "2026-10-01", "published_at.end": "2026-10-15", "sort.by": "published_at", "per_page": 10 }' ``` `query` searches titles, so it needs a `published_at` window of 31 days or less. Without `published_at.end`, the window runs to the current moment. ## Step 4: Keep only exploited vulnerabilities You cannot use `cyber.in_kev` or `cyber.cvss` as API filters. Check these fields in your code after receiving the response. This script collects CVEs from articles with at least one actively exploited vulnerability: ```python import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "cyber.type": "crime", "language.code": "en", "per_page": 10, "fl": "id,title,href,published_at,cyber", }, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: cyber = article["cyber"] if cyber["in_kev"]: score = cyber["cvss"] if cyber["cvss"] is not None else "n/a" print(f"{article['published_at']} CVSS {score} {', '.join(cyber['vendors'])}") print(f" {article['title']}") print(f" {', '.join(cyber['cves'])}") ``` Treat `in_kev: null` as unknown. It means the KEV catalog was unavailable, so it does not tell you whether the vulnerability has been exploited. ## Step 5: Page through results and export When `has_next_pages` is `true`, request the URL in `next_page`. It keeps all your filters, including `cyber.type`. A page may contain fewer articles than `per_page`; continue until `has_next_pages` is `false`. On paid plans the same request can return a file. Add `export=csv` (or `tsv`, `xlsx`, `xml`, `rss`, `jsonl`, `parquet`); the `cyber` block is written to a `Cyber` column in tabular formats: ```bash curl "https://api.apitube.io/v1/cyber-security/news?cyber.type=crime&language.code=en&per_page=10&export=csv" \ -H "X-API-Key: YOUR_API_KEY" -o cyber-news.csv ``` ## Limits and request costs {#limits} * Each request that returns articles costs **1 point**. Empty pages are free. * `prompt` requires Basic or above and adds **2 points** when the wording has not been parsed before. Repeated prompts use the cached interpretation without the extra charge. * `per_page` is capped by plan: Free 10, Starter 50, Basic 200, Professional and Corporate 250. Free cannot go past page 5. See [Rate limits and quotas](/platform/news-api/rate-limits). * Free returns previews in `body` and `body_html`. Exports other than JSON require a paid plan. * Title search (`title`, `title_starts_with`, `title_ends_with`, `title_pattern`, `query`) covers at most **31 days** of `published_at`. * A page may contain fewer articles than `per_page`. If some results are unavailable, the response includes an `ER0901` warning. Follow `next_page` to continue. * The `cyber` fields are output only. Check CVE IDs, vendors, KEV status and CVSS scores in your code, as in Step 4. ## Errors Errors use the shared format described in [HTTP response codes](/platform/news-api/http-response-codes). | Code | Status | What went wrong | |------|--------|-----------------| | `ER0900` | 400 | `cyber.type` is not `crime` or `warfare` — for example `ransomware`, `CRIME` or `crime,warfare` | | `ER0179` | 400 | `cyber.type` (or another parameter) appears twice in the URL | | `ER0110` | 400 | Title search covers more than 31 days of `published_at` | | `ER0171` | 400 | `per_page` is above your plan's limit (10 on Free) | | `ER0201` | 401 | No API key in the request | | `ER0202` | 401 | The API key is invalid | | `ER0176` | 402 | No points left on the account | | `ER0603` | 403 | The API key is restricted and lacks the `cyber_security_news` scope | | `ER0706` | 403 | Export or `prompt` used on a plan that does not include it | | `ER0203` | 429 | Rate limit exceeded | Warnings arrive in `meta.warnings` with HTTP `200`: | Code | Meaning | |------|---------| | `ER0901` | Some matching articles are unavailable or no longer in the cyber categories; the page may contain fewer results | | `ER0368` | Unknown parameters were ignored; the warning names them | ## Next steps * [Filters](/platform/cyber-security/filters) — every way to narrow the feed. * [Use cases](/platform/cyber-security/use-cases) — alert feeds, vendor watch and daily digests built on this endpoint. * [Response format](/platform/cyber-security/response-format) — what CVE IDs, KEV status and CVSS scores mean. --- --- url: 'https://docs.apitube.io/platform/cyber-security/response-format.md' description: >- Understand the article fields, vulnerability details and export formats returned by the APITube Cyber Security API. --- # Cyber Security API response format The response uses the same format as [`/v1/news/everything`](/platform/news-api/everything#response-format). Each article has the standard fields, including `title`, `href`, `published_at`, `source`, `categories`, `entities` and `sentiment`, plus `cyber`. ## Top-level response fields {#response-envelope} Complete response for `GET /v1/cyber-security/news?per_page=1`. Article values are illustrative. Full article text is shown; Free responses contain a body preview. ```json { "status": "ok", "limit": 1, "path": "https://api.apitube.io/v1/cyber-security/news?per_page=1", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/cyber-security/news?per_page=1&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=json", "xlsx": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=xlsx", "csv": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=csv", "tsv": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=tsv", "xml": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=xml", "rss": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=rss", "parquet": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=parquet", "jsonl": "https://api.apitube.io/v1/cyber-security/news?per_page=1&export=jsonl" }, "request_id": "a4dd55a0-6cca-47a4-a5e5-4da27211e5b0", "results": [ { "id": 1234567890, "href": "https://example.com/security/firewall-vulnerability-review", "published_at": "2026-10-16T08:30:00.000Z", "title": "Security teams review firewall vulnerabilities and ongoing attacks", "description": "A sample security report covering firewall flaws, exploited vulnerabilities and vendor updates.", "body": "Security teams are reviewing reports of cyber crime and state-backed attacks involving firewall and email security products. The report mentions CVE-2025-20393, CVE-2025-40602, CVE-2025-23006 and CVE-2025-14733. Cisco, SonicWall and WatchGuard appear in the report. The highest stated CVSS score is 9. 8. Administrators are checking vendor advisories and reviewing affected deployments.", "body_html": "

Security teams are reviewing reports of cyber crime and state-backed attacks involving firewall and email security products. The report mentions CVE-2025-20393, CVE-2025-40602, CVE-2025-23006 and CVE-2025-14733.

Cisco, SonicWall and WatchGuard appear in the report. The highest stated CVSS score is 9.8. Administrators are checking vendor advisories and reviewing affected deployments.

", "language": "en", "translations": { "en": { "title": null, "description": null } }, "author": { "id": 5, "name": "Example Security Desk" }, "image": "https://example.com/images/security-review.jpg", "categories": [ { "id": 118, "name": "cyber crime", "score": 0.96, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:20000086" } }, { "id": 90, "name": "cyber warfare", "score": 0.87, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:20001361" } } ], "topics": [], "industries": [], "entities": [], "locations_mentioned": [], "source": { "id": 508004, "domain": "example.com", "home_page_url": "https://example.com", "type": "news", "bias": "", "rankings": { "opr": 0 }, "location": { "country_name": "United States", "country_code": "us" }, "favicon": "https://www.google.com/s2/favicons?domain=https://example.com" }, "sentiment": { "overall": { "score": -0.4, "polarity": "negative" }, "title": { "score": -0.3, "polarity": "negative" }, "body": { "score": -0.4, "polarity": "negative" } }, "summary": [ { "sentence": "Security teams are reviewing vulnerabilities affecting firewall and email security products.", "sentiment": { "score": -0.4, "polarity": "negative" } } ], "keywords": [ "cyber security", "firewall", "vulnerability", "Cisco", "SonicWall", "WatchGuard" ], "links": [ { "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog", "type": "external" } ], "media": [ { "url": "https://example.com/images/security-review.jpg", "type": "image" } ], "readability": { "flesch_kincaid_grade": 0, "flesch_reading_ease": 0, "automated_readability_index": 0, "difficulty_level": "unknown", "target_audience": "unknown", "reading_age": 0, "avg_words_per_sentence": 0, "avg_syllables_per_word": 0 }, "story": { "id": 1234567890, "uri": "https://api.apitube.io/v1/news/story/1234567890" }, "shares": { "total": 0, "facebook": 0, "twitter": 0, "reddit": 0 }, "is_duplicate": false, "is_free": true, "is_breaking": false, "read_time": 1, "sentences_count": 5, "paragraphs_count": 2, "words_count": 50, "characters_count": 386, "cyber": { "type": [ "crime", "warfare" ], "cves": [ "CVE-2025-20393", "CVE-2025-40602", "CVE-2025-23006", "CVE-2025-14733" ], "vendors": [ "Cisco", "SonicWall", "WatchGuard" ], "in_kev": true, "exploited": true, "cvss": 9.8 } } ] } ``` | Field | Type | Description | |-------|------|-------------| | `status` | string | `ok` for a successful request | | `limit` | integer | Articles per page (`per_page`) | | `path` | string | The request URL | | `page` | integer | Current page number | | `has_next_pages` | boolean | Whether another page exists | | `next_page` | string | URL of the next page with all filters kept, or an empty string | | `has_previous_page` | boolean | Whether a previous page exists | | `previous_page` | string | URL of the previous page, or an empty string | | `export` | object | The same request as download links, one per export format | | `request_id` | string | ID of this request, useful when you contact support | | `results` | array | The articles | | `facets` | object | Facet counts, only with `facet=1` or `facet.range=1` | | `highlighting` | object | Highlighted fragments, only with `hl=1` | | `meta` | object | Warnings and `prompt` details, only when there is something to report | The full article object is documented in [API Response Structure](/platform/news-api/response-structure#article-object-fields). ## The cyber object Every article in `results` has a `cyber` object with six fields. All six are always present; empty values are `[]` or `null`, never missing. ```json "cyber": { "type": ["crime"], "cves": ["CVE-2025-43529", "CVE-2025-14174"], "vendors": ["Apple", "Google"], "in_kev": true, "exploited": true, "cvss": null } ``` | Field | Type | Description | |-------|------|-------------| | `type` | array of strings | The article's cyber categories: `crime`, `warfare` or both. Lists both cyber categories if both apply, even when you selected only one with `cyber.type`. | | `cves` | array of strings | CVE IDs mentioned in the title, description or body, in the order they first appear. Each ID appears once. Empty when the article mentions none. | | `vendors` | array of strings | Vendors of the mentioned CVEs that are listed in the CISA KEV catalog, as KEV names them (`Microsoft`, `Fortinet`, `Hewlett Packard Enterprise (HPE)`). Empty when no mentioned CVE is in KEV. | | `in_kev` | boolean or null | `true` when at least one mentioned CVE is in the CISA Known Exploited Vulnerabilities catalog. `null` when the catalog was not available. | | `exploited` | boolean or null | `true` if a mentioned vulnerability has been used in real attacks. Currently has the same value as `in_kev`. `null` when KEV status is unavailable. | | `cvss` | number or null | The highest CVSS score written in the article, from 0 to 10. `null` when the article states no score. | ### Which CVE IDs are returned {#how-cve-ids-are-found} The `cves` list contains vulnerability IDs mentioned in the article's title, description or body. IDs use the `CVE-YYYY-NNNN` format, with four to seven digits after the year. Returned IDs are uppercase and use plain hyphens, even if the article uses another kind of dash. If the article says only "a critical flaw in FortiOS" without an ID, `cves` is empty. ### KEV status and vendor names {#how-kev-status-and-vendors-are-set} `in_kev` and `exploited` are `true` when at least one mentioned CVE is listed as actively exploited in CISA KEV. The `vendors` list contains the vendors for those CVEs. If KEV status is unavailable, `in_kev` and `exploited` are `null` and `vendors` is empty. Treat `null` as unknown. ### Which severity score is returned {#how-the-cvss-score-is-read} `cvss` is the highest CVSS score stated in the article. Examples include "CVSS 9.8", "CVSS v3.1: 7.5" and "CVSS score of 8.8". Version numbers such as "CVSS 3.1" and vector strings such as `CVSS:3.1/AV:N/...` do not count as scores. If no score is stated, the field is `null`. ## Selecting cyber fields with fl `fl` limits each article to the fields you list. Name the whole block with `cyber`, or single fields with `cyber.type`, `cyber.cves`, `cyber.vendors`, `cyber.in_kev`, `cyber.exploited` and `cyber.cvss`. ```bash curl "https://api.apitube.io/v1/cyber-security/news?fl=id,cyber.cves,cyber.in_kev&per_page=1&api_key=YOUR_API_KEY" ``` The complete response keeps pagination and export links. Each article contains only the selected fields: ```json { "status": "ok", "limit": 1, "path": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=json", "xlsx": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=xlsx", "csv": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=csv", "tsv": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=tsv", "xml": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=xml", "rss": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=rss", "parquet": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=parquet", "jsonl": "https://api.apitube.io/v1/cyber-security/news?fl=id%2Ccyber.cves%2Ccyber.in_kev&per_page=1&api_key=YOUR_API_KEY&export=jsonl" }, "request_id": "a4dd55a0-6cca-47a4-a5e5-4da27211e5b0", "results": [ { "id": 3017161400, "cyber": { "cves": [ "CVE-2025-43529", "CVE-2025-14174" ], "in_kev": true } } ] } ``` If `fl` does not name `cyber` or any of its fields, the block is left out. ## The cyber block in exports With `export`, the same articles come back as a file. Each format stores the `cyber` block in its own way: | Format | Where the cyber block goes | |--------|----------------------------| | `csv`, `tsv`, `xlsx` | A `Cyber` column holding the block as a JSON string | | `xml` | A `` element with child elements; empty lists and `null` values become empty elements | | `jsonl`, `ndjson` | A `cyber` object on each line, as in the JSON response | | `parquet` | A `cyber` column holding the block as a JSON string | | `rss` | The values of `cyber.type` as `` elements of each item | Exports other than JSON require a paid plan; on Free they return `403 ER0706`. ## Warnings in meta `meta.warnings` lists problems that did not stop the request. Two are common on this endpoint: * **`ER0901`** means some matching articles are unavailable or no longer in the selected categories. A page may have fewer articles than `per_page`, or be empty while `has_next_pages` is `true`. Keep following `next_page`. Empty pages are free. * **`ER0368`** — the request had a parameter the endpoint does not know, such as `cyber.cves`. The parameter was ignored; the warning names it. ## Related * [Filters](/platform/cyber-security/filters) — `cyber.type` and the filters you can combine with it. * [Use cases](/platform/cyber-security/use-cases) — working examples that read the `cyber` block. * [API Response Structure](/platform/news-api/response-structure) — every standard article field. --- --- url: 'https://docs.apitube.io/platform/cyber-security/use-cases.md' description: >- Build vulnerability alerts, monitor vendors and cyber warfare, and create daily news summaries with the APITube Cyber Security API. --- # Cyber Security API use cases Use these examples to build alerts, vendor monitoring and daily digests with `/v1/cyber-security/news`. Each includes a request and code for reading the [`cyber` block](/platform/cyber-security/response-format#the-cyber-object). Replace `YOUR_API_KEY` with your key. ## Alert on actively exploited vulnerabilities **Goal:** get a message when an article mentions a CVE that CISA lists as used in real attacks. Check the API on a schedule for articles published since the previous check. Keep those with `cyber.in_kev: true` and record the CVEs you have already reported, so several articles about one vulnerability produce only one alert. ```python import time from datetime import datetime, timedelta, timezone import requests API_URL = "https://api.apitube.io/v1/cyber-security/news" HEADERS = {"X-API-Key": "YOUR_API_KEY"} seen_cves = set() since = datetime.now(timezone.utc) - timedelta(hours=1) while True: started = datetime.now(timezone.utc) response = requests.get( API_URL, params={ "published_at.start": since.strftime("%Y-%m-%dT%H:%M:%SZ"), "sort.by": "published_at", "sort.order": "asc", "per_page": 50, "fl": "title,href,published_at,cyber", }, headers=HEADERS, ) for article in response.json()["results"]: cyber = article["cyber"] new_cves = [cve for cve in cyber["cves"] if cve not in seen_cves] if cyber["in_kev"] and new_cves: seen_cves.update(new_cves) print(f"EXPLOITED {', '.join(new_cves)} ({', '.join(cyber['vendors'])})") print(f" {article['title']}\n {article['href']}") since = started time.sleep(600) ``` Each check that returns articles costs 1 point; a check with no new articles is free. If more than 50 articles can arrive between checks, follow `next_page` until `has_next_pages` is `false`. ## Watch vulnerabilities of one vendor **Goal:** follow news about vulnerabilities in the products of one company, for example Fortinet. `organization.name` keeps articles that mention the company. `cyber.vendors` tells you whether a mentioned CVE of that vendor is in the KEV catalog. Use both: the first narrows the search, the second marks the urgent articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/cyber-security/news?organization.name=Fortinet&language.code=en&per_page=20&fl=title,href,published_at,cyber" \ -H "X-API-Key: YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "organization.name": "Fortinet", "language.code": "en", "per_page": 20, "fl": "title,href,published_at,cyber", }, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: cyber = article["cyber"] urgent = "Fortinet" in cyber["vendors"] label = "KEV" if urgent else " " print(label, article["published_at"], article["title"], cyber["cves"]) ``` ::: `organization.name` takes up to 3 names. Vendor names in `cyber.vendors` are spelled as in the KEV catalog, so compare them with the same spelling — `Microsoft`, `Fortinet`, `Cisco`. ## Build a daily digest ranked by severity **Goal:** a morning list of yesterday's cyber crime news, with the most severe vulnerabilities on top. Set `published_at` to one date to get that day's articles. Sort them by `cyber.cvss` in your code; the API does not support `sort.by=cvss`. Put articles with a `null` score last. ```python from datetime import date, timedelta import requests yesterday = (date.today() - timedelta(days=1)).isoformat() response = requests.get( "https://api.apitube.io/v1/cyber-security/news", params={ "cyber.type": "crime", "language.code": "en", "published_at": yesterday, "per_page": 100, "fl": "title,href,source,cyber", }, headers={"X-API-Key": "YOUR_API_KEY"}, ) articles = response.json()["results"] articles.sort(key=lambda a: a["cyber"]["cvss"] if a["cyber"]["cvss"] is not None else -1, reverse=True) for article in articles: score = article["cyber"]["cvss"] print(f"{score if score is not None else '—':>4} {article['title']}") print(f" {article['href']}") ``` On a paid plan, add `export=xlsx` to download the digest as a spreadsheet. The `Cyber` column contains each article's CVE IDs, KEV status and score. ## Monitor cyber warfare around a country **Goal:** follow state-backed attacks and cyber operations connected to one country, and see which countries' media report them. Combine `cyber.type=warfare` with `location.name`. Add a facet on `source.country.id` to count the matching articles by the country of the outlet. ```bash curl "https://api.apitube.io/v1/cyber-security/news?cyber.type=warfare&location.name=Ukraine&per_page=20&facet=1&facet.field=source.country.id&fl=title,href,published_at,source" \ -H "X-API-Key: YOUR_API_KEY" ``` The `facets["source.country.id"]` array in the response counts every matching article, not only the 20 on the page. Its values are numeric country IDs, not ISO codes. `location.name` must match a known location — check the spelling with [`/v1/suggest/entities`](/platform/news-api/suggest/entities) first. ## Count attack news per day **Goal:** a daily volume chart of cyber crime coverage, without downloading the articles. Use range facets to count matching articles by day. Set `per_page=1` and `fl=id` to keep the response small: ```bash curl "https://api.apitube.io/v1/cyber-security/news?cyber.type=crime&per_page=1&fl=id&facet.range=1&facet.range.field=published_at&facet.range.start=2026-10-01&facet.range.end=2026-10-15&facet.range.gap=%2B1DAY" \ -H "X-API-Key: YOUR_API_KEY" ``` ```json { "facets": { "published_at_ranges": [ { "range_start": "2026-10-01", "range_end": "2026-10-02", "count": 412 }, { "range_start": "2026-10-02", "range_end": "2026-10-03", "count": 388 } ] } } ``` Encode the `+` in `+1DAY` as `%2B` in a URL, otherwise it arrives as a space. Days with no articles are not listed. Run the request once for `cyber.type=crime` and once for `cyber.type=warfare` to chart the two categories separately. ## Related * [Quickstart](/platform/cyber-security/quickstart) — the first request, step by step. * [Filters](/platform/cyber-security/filters) — every filter used on this page. * [Track data breaches and lawsuits](/platform/news-api/common-workflows/recipes/breach-feed) — a related recipe built on `event.type`. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/date-time-examples.md description: Examples of using date and time parameters in News API --- # Date and Time Query Examples ## Choose a date range {#getting-news-in-a-specific-date-range} Find articles published within a date range. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?published_at.start=2026-03-01&published_at.end=2026-03-08&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "published_at.start": "2026-03-01", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "published_at.start": "2026-03-01", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["published_at.start" => "2026-03-01", "published_at.end" => "2026-03-08", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("published_at.start", "2026-03-01") q.Set("published_at.end", "2026-03-08") 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) } ``` ```java [Java] 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/everything?published_at.start=2026-03-01&published_at.end=2026-03-08&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?published_at.start=2026-03-01&published_at.end=2026-03-08 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/everything ``` ::: ## Use a relative date range {#using-relative-time-ranges} Use different date formats to set the publication range. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?published_at.start=2026-03-07&published_at.end=2026-03-08&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "published_at.start": "2026-03-07", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "published_at.start": "2026-03-07", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["published_at.start" => "2026-03-07", "published_at.end" => "2026-03-08", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("published_at.start", "2026-03-07") q.Set("published_at.end", "2026-03-08") 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) } ``` ```java [Java] 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/everything?published_at.start=2026-03-07&published_at.end=2026-03-08&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?published_at.start=2026-03-07&published_at.end=2026-03-08 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/everything ``` ::: ## Follow event coverage over time {#historical-event-coverage-analysis} Get coverage of Donald Trump in date order. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Donald Trump", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Donald Trump", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Donald Trump", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Donald Trump") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&per_page=100 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/everything ``` ::: ## Set exact start and end times {#precise-time-analysis-using-timestamps} Find news about Google within a time range. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "per_page": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "per_page": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "10") 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) } ``` ```java [Java] 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/everything?organization.name=Google&sort.by=published_at&sort.order=asc&per_page=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&per_page=10 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/debugging.md' description: 'Find and fix problems with API keys, filters, request values and rate limits.' --- # Debugging API Requests Check `user_input` in the response to see which parameters the API received. This helps you find misspelled names and characters affected by URL encoding. Add `debug=1` to include `user_input` in the response. #### Parameters `0` is for false and `1` is for true. | Parameter | Description | Type | Required | |-----------|--------------------------------------------------|---------|----------| | `debug` | Include the `user_input` object in the response | integer | No | ## Request Example ```shell curl "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY&debug=1" ``` :::warning Use `debug` while investigating a request. Remove it from production requests. ::: Use the checks below to find common request problems. ## Common Issues and Solutions ### 1. Authentication Errors If you're receiving 401 or 403 errors, check the following: * Check that you copied the API key correctly * Check that the key has not expired * Check that you have points left and have not exceeded your request limit * Check the authentication header name and value **Example of a correct authentication request:** ```bash # Option 1: API key in header curl -H "X-API-Key: YOUR_API_KEY" https://api.apitube.io/v1/news/everything # Option 2: Bearer token curl -H "Authorization: Bearer YOUR_API_KEY" https://api.apitube.io/v1/news/everything # Option 3: API key in URL (not recommended for production) curl https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY ``` ### 2. Request Parameter Issues If you're getting unexpected results or 400 errors: * Check if the parameters are spelled correctly * Make sure parameter values match expected formats * Use proper URL encoding for special characters **Example of a request with multiple parameters:** ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/everything?title=Apple iPhone&language.code=en&published_at.start=NOW-7DAYS&per_page=10" ``` ### 3. Rate Limit Restrictions If you're receiving 429 errors (Too Many Requests): * Check your current usage in your account dashboard * Add delays between requests * Consider caching results * Request the articles and fields you need in each call ## Additional Tips 1. Start with one filter, then add the others one at a time. 2. Check the API version in your request URL. 3. Check your plan's rate limit. 4. Handle error responses in your code. 5. If the problem continues, contact [support](mailto:hello@apitube.io). --- --- url: 'https://docs.apitube.io/platform/news-api/reference.md' description: >- Find people, company and journalist profiles with background details, coverage summaries and recent articles. --- # Directories Find profiles of people, companies and journalists. Each profile includes background information, a `coverage` summary of their news coverage and recent articles. ## The three directories | Directory | Endpoints | Contains | |:----------|:----------|:---------| | [People](/platform/news-api/reference/people) | `GET /v1/people` · `GET /v1/people/{id}` | Public figures — politicians, executives, other known persons. | | [Companies](/platform/news-api/reference/companies) | `GET /v1/companies` · `GET /v1/companies/{id}` | Organizations and brands, with headquarters, founding date, website, key people and subsidiaries. | | [Journalists](/platform/news-api/reference/journalists) | `GET /v1/journalists` · `GET /v1/journalists/{id}` | Journalist profiles that group articles with the same author name and list the publishing outlets in `outlets`. | Use a list endpoint to search profiles. Use its `{id}` endpoint to get a full profile. ## Directories vs. entity search Choose based on the information you need: * **[`/v1/news/entity/{entity_id}`](/platform/news-api/entity)** returns *articles* mentioning the entity — a feed you page through. * **A directory profile** returns the *entity* — who they are, how much coverage they get, which outlets and topics dominate it, plus a handful of recent articles. Use a directory to build a profile page. Use the entity endpoint to browse all articles about that person or company. ## Billing A directory request costs **1 point** when it returns results. Searches with no results are free. If you have no points left, the API returns `402`. See [Balance and usage](/platform/news-api/balance). ## Next steps * [Build a public figure profile](/platform/news-api/common-workflows/recipes/person-dossier) — get background details and news coverage in one response * [Monitor a company](/platform/news-api/common-workflows/recipes/company-monitoring) — volume, sentiment and momentum over time * [Find journalists by topic](/platform/news-api/common-workflows/recipes/journalists-by-beat) — who writes about a subject, and where --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/python/django-framework.md description: >- Call the APITube News API from Django Python using the requests library in view functions --- # Django integration ```python from django.http import HttpResponse import requests def make_request(request): url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" response = requests.get(url) if response.status_code == 200: return HttpResponse(response.text, content_type="application/json") else: return HttpResponse(f"HTTP Request Error: {response.status_code}", content_type="text/plain") ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/julia/downloads-client.md description: Call the APITube News API from Julia using the standard Downloads module --- # Downloads.jl integration ```julia using Downloads using JSON url = "https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY" response = Downloads.download(url, IOBuffer()) data = String(take!(response)) println(data) ``` --- --- url: 'https://docs.apitube.io/platform/news-api/endpoints.md' description: >- Find the News API endpoint for your task, with links to parameters and request examples. --- # Endpoints for News API Send requests to `https://api.apitube.io` with your API key in the `X-API-Key` header or `api_key` parameter. Find an endpoint by task below. Each guide lists the endpoint's parameters, request examples and response format. ## Which endpoint do I need? | What you need | Use this | Notes | |:--------------|:---------|:------| | Search or monitor the news | [Search articles](/platform/news-api/everything) | The full filter set. Every other article endpoint is a narrowed version of it. | | A front page or breaking-news feed | [Top headlines](/platform/news-api/top-headlines) | Same filters, restricted to highly ranked sources. | | Everything about one category, topic, industry or entity | [Browse endpoints](#browse-articles-by-attribute) | Put the category, topic, industry or entity ID in the URL path. | | One article, or up to 100, by ID | [Get an article by ID](/platform/news-api/article) | Lookup by ID; no search. | | Every outlet that covered the same event | [Get a story](/platform/news-api/story) | Cluster of articles related to one article. | | Only a number, not the articles | [Count articles](/platform/news-api/count) | Same filters, returns just the total. | | A ranking of who or what is being talked about | [Trends](/platform/news-api/trends) | Aggregates instead of returning articles. | | News near a point on the map | [Local news](/platform/news-api/local) | Adds geo search, distance sorting and local insights. | | Verify a claim against the archive | [Fact check](/platform/news-api/fact-check) | Paid plans only, separate rate limit. | | Find the ID for a name | [Suggest endpoints](#autocomplete-suggest) | Suggest names as a user types: entities, categories, topics and industries. | | The earliest available articles in a basic format | [Raw articles (Lite)](/platform/news-api/raw) | No detected language, entities or sentiment. Covers roughly the last 24 hours. | ## Browse articles by attribute Get articles in one category, topic or industry, or about one entity. | Endpoint | Description | |:---------|:------------| | `/v1/news/category/{taxonomy}/{category_id}` | Articles in a category — [guide](/platform/news-api/category). | | `/v1/news/topic/{topic_id}` | Articles for a topic — [guide](/platform/news-api/topic). | | `/v1/news/industry/{industry_id}` | Articles for an industry — [guide](/platform/news-api/industry). | | `/v1/news/entity/{entity_id}` | Articles mentioning an entity — [guide](/platform/news-api/entity). | | `/v1/news/local` | Local news by geo-coordinates or place name — [guide](/platform/news-api/local). | ## Reference directories Search profiles of people, companies and journalists. Each profile includes a coverage summary and recent articles. | Endpoint | Description | |:---------|:------------| | `/v1/people` · `/v1/people/{id}` | People (public figures) — [guide](/platform/news-api/reference/people). | | `/v1/companies` · `/v1/companies/{id}` | Companies & brands — [guide](/platform/news-api/reference/companies). | | `/v1/journalists` · `/v1/journalists/{id}` | Journalists (bylines) — [guide](/platform/news-api/reference/journalists). | ## Reference lists Get the list of allowed filter values from the API. | Endpoint | Description | |:---------|:------------| | `/v1/news/event-types` | Valid values for the `event.type` and `event.category` filters — [guide](/platform/news-api/reference/event-types). | ## Autocomplete (Suggest) Suggest matches as a user types, then use the selected `id` in a filter. | Endpoint | Description | |:---------|:------------| | `/v1/suggest/entities` | Autocomplete entities — [guide](/platform/news-api/suggest/entities). | | `/v1/suggest/categories` | Autocomplete categories — [guide](/platform/news-api/suggest/categories). | | `/v1/suggest/topics` | Autocomplete topics — [guide](/platform/news-api/suggest/topics). | | `/v1/suggest/industries` | Autocomplete industries — [guide](/platform/news-api/suggest/industries). | --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/entity-examples.md description: Examples of using entities in News API --- # Entity Query Examples ## Find news about one entity {#getting-news-about-a-specific-entity} Find articles about an entity by its ID. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?entity.id=1278268&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Filter by sentiment about an entity {#filtering-an-entity-by-its-sentiment} Entity sentiment describes the tone of coverage about a specific subject. Choose the subject with an entity selector, then add `entity.sentiment.polarity`, `entity.sentiment.score.min` or `entity.sentiment.score.max`. For example, find articles that describe a company negatively even when the overall article is positive. Each entity in the response also carries a `sentiment` object (`score`, `polarity`, and per-mention `mentions` counts). ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&entity.sentiment.polarity=negative&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "entity.sentiment.polarity": "negative", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "entity.sentiment.polarity": "negative", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "entity.sentiment.polarity" => "negative", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268") q.Set("entity.sentiment.polarity", "negative") 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) } ``` ```java [Java] 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/everything?entity.id=1278268&entity.sentiment.polarity=negative&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268&entity.sentiment.polarity=negative 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/everything ``` ::: ## Find news about several entities {#getting-news-about-multiple-entities} Find articles about several entities. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1309610&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1309610", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1309610", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1309610", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268,1309610") 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1309610&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268,1309610 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/everything ``` ::: ## Include one entity and exclude another {#filtering-by-including-and-excluding-entities} Find articles about one entity and exclude another. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&ignore.entity.id=1309610&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "ignore.entity.id": "1309610", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "ignore.entity.id": "1309610", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "ignore.entity.id" => "1309610", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268") q.Set("ignore.entity.id", "1309610") 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) } ``` ```java [Java] 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/everything?entity.id=1278268&ignore.entity.id=1309610&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268&ignore.entity.id=1309610 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/everything ``` ::: ## Find entities mentioned together {#entity-correlation-analysis} Get articles mentioning several entities, sorted by sentiment score. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1333257&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1333257", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1333257", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1333257", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268,1333257") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1333257&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268,1333257&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Track entity mentions over time {#tracking-entity-mentions-over-time} Get mentions of an entity in date order. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1309610&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1309610", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1309610", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1309610", "per_page" => "100", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1309610") q.Set("per_page", "100") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?entity.id=1309610&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1309610&per_page=100&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Find entity sentiment in market news {#entity-impact-on-market-sentiment} Find business articles about an entity, sorted by sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "sentiment.overall.polarity" => "positive", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Compare entity coverage across languages {#cross-lingual-entity-reputation-tracking} Compare coverage of an entity across languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1309610&language.code=en,fr,de&sort.by=language.code,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1309610", "language.code": "en,fr,de", "sort.by": "language.code,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1309610", "language.code": "en,fr,de", "sort.by": "language.code,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1309610", "language.code" => "en,fr,de", "sort.by" => "language.code,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1309610") q.Set("language.code", "en,fr,de") q.Set("sort.by", "language.code,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?entity.id=1309610&language.code=en,fr,de&sort.by=language.code,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1309610&language.code=en,fr,de&sort.by=language.code,sentiment.overall.score 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/everything ``` ::: ## Compare coverage of competing entities {#multi-entity-competitive-analysis-with-media-richness} Compare recent coverage of competing entities with image and source-rank filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1309610,1333257&title=innovation,technology,development&media.images.count=1&sort.by=entity.id,published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1309610,1333257", "title": "innovation,technology,development", "media.images.count": "1", "sort.by": "entity.id,published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1309610,1333257", "title": "innovation,technology,development", "media.images.count": "1", "sort.by": "entity.id,published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1309610,1333257", "title" => "innovation,technology,development", "media.images.count" => "1", "sort.by" => "entity.id,published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268,1309610,1333257") q.Set("title", "innovation,technology,development") q.Set("media.images.count", "1") q.Set("sort.by", "entity.id,published_at") 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1309610,1333257&title=innovation,technology,development&media.images.count=1&sort.by=entity.id,published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268,1309610,1333257&title=innovation,technology,development&media.images.count=1&sort.by=entity.id,published_at 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/reference/event-types.md' description: List every valid value for the event.type and event.category filters --- # Event Types Get the allowed values for [`event.type`](/platform/news-api/filters#event-types) and [`event.category`](/platform/news-api/filters#event-types) from `/v1/news/event-types`. Use them in a filter menu or to check user input. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/news/event-types ``` Fetch the list once and reuse it. This endpoint needs only your API key. ## Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ## Response Format The response lists categories in `categories` and event types in `event_types`: ```json { "status": "ok", "categories": ["string"], "event_types": [ { "code": "string", "category": "string" } ] } ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `status` | string | `ok` on success. | | `categories` | string\[] | Valid values for the `event.category` filter. | | `event_types` | object\[] | Every valid event type. | | `event_types[].code` | string | Valid value for the `event.type` / `ignore.event.type` filter. | | `event_types[].category` | string | The category this event type belongs to. | ## Request Examples ### Using query parameter ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/event-types?api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/news/event-types", params={"api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/news/event-types?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/event-types?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/event-types") q := u.Query() 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) } ``` ```java [Java] 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/event-types?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/event-types 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/everything ``` ::: ### Using header authentication ```shell curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/event-types" ``` ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/news/event-types" ``` ## Response Example Truncated — the live response lists every event type across the three categories. ```json { "status": "ok", "categories": ["business", "society", "environment"], "event_types": [ { "code": "merger-acquisition", "category": "business" }, { "code": "ipo", "category": "business" }, { "code": "layoffs", "category": "business" }, { "code": "election", "category": "society" }, { "code": "protest", "category": "society" }, { "code": "earthquake", "category": "environment" }, { "code": "wildfire", "category": "environment" } ] } ``` ## Using the values ```bash # Filter by a single event type curl "https://api.apitube.io/v1/news/everything?event.type=layoffs&api_key=YOUR_API_KEY" # Filter by a whole category curl "https://api.apitube.io/v1/news/everything?event.category=environment&api_key=YOUR_API_KEY" ``` ## Error Responses ### Missing or Invalid API Key ```json { "errors": [ { "code": "ER0201", "message": "API key is required. Provide it via X-API-Key header or api_key query parameter." } ] } ``` **Status Code:** 401 --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/export-examples.md description: Examples of using export parameters in News API --- # Export Query Examples ## Export as JSON {#export-data-as-json} Export articles as JSON. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=json&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "export": "json", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "export": "json", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "export" => "json", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("export", "json") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&export=json&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=json 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/everything ``` ::: ## Export as XML {#export-data-as-xml} Export articles as XML. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=xml&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "export": "xml", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "export": "xml", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "export" => "xml", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("export", "xml") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&export=xml&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=xml 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/everything ``` ::: ## Export as XLSX {#export-data-as-xlsx} Export articles as an Excel spreadsheet. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=xlsx&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "export": "xlsx", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "export": "xlsx", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "export" => "xlsx", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("export", "xlsx") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&export=xlsx&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=xlsx 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/everything ``` ::: ## Export as CSV {#export-data-as-csv} Export articles as CSV. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=csv&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "export": "csv", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "export": "csv", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "export" => "csv", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("export", "csv") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&export=csv&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=csv 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/everything ``` ::: ## Export as TSV {#export-data-as-tsv} Export articles as TSV. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=tsv&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "export": "tsv", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "export": "tsv", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "export" => "tsv", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("export", "tsv") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&export=tsv&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=tsv 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/everything ``` ::: ## Export financial news {#data-export-for-financial-analysis} Export financial news to Excel. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=finance,market,economy&export=xlsx&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "title": "finance,market,economy", "export": "xlsx", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "title": "finance,market,economy", "export": "xlsx", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "title" => "finance,market,economy", "export" => "xlsx", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("title", "finance,market,economy") q.Set("export", "xlsx") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&title=finance,market,economy&export=xlsx&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=finance,market,economy&export=xlsx 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/everything ``` ::: ## Export sentiment data as CSV {#csv-export-for-sentiment-analysis} Export sentiment fields for technology companies as CSV. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Amazon,Microsoft,Google&sort.by=sentiment.overall.score&sort.order=desc&export=csv&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Amazon,Microsoft,Google", "sort.by": "sentiment.overall.score", "sort.order": "desc", "export": "csv", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Amazon,Microsoft,Google", "sort.by": "sentiment.overall.score", "sort.order": "desc", "export": "csv", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Amazon,Microsoft,Google", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "export" => "csv", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Amazon,Microsoft,Google") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") q.Set("export", "csv") 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) } ``` ```java [Java] 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/everything?organization.name=Amazon,Microsoft,Google&sort.by=sentiment.overall.score&sort.order=desc&export=csv&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Amazon,Microsoft,Google&sort.by=sentiment.overall.score&sort.order=desc&export=csv 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/everything ``` ::: ## Export ESG coverage {#cross-market-esg-reporting-comparative-analysis-export} Export articles to compare environmental, social and governance (ESG) coverage. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=ESG,sustainability,climate,governance&category.id=medtop:04000000&source.country.code=us,gb,de,fr&sort.by=source.country.code,sentiment.overall.score&is_duplicate=0&export=xlsx&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "ESG,sustainability,climate,governance", "category.id": "medtop:04000000", "source.country.code": "us,gb,de,fr", "sort.by": "source.country.code,sentiment.overall.score", "is_duplicate": "0", "export": "xlsx", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "ESG,sustainability,climate,governance", "category.id": "medtop:04000000", "source.country.code": "us,gb,de,fr", "sort.by": "source.country.code,sentiment.overall.score", "is_duplicate": "0", "export": "xlsx", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "ESG,sustainability,climate,governance", "category.id" => "medtop:04000000", "source.country.code" => "us,gb,de,fr", "sort.by" => "source.country.code,sentiment.overall.score", "is_duplicate" => "0", "export" => "xlsx", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "ESG,sustainability,climate,governance") q.Set("category.id", "medtop:04000000") q.Set("source.country.code", "us,gb,de,fr") q.Set("sort.by", "source.country.code,sentiment.overall.score") q.Set("is_duplicate", "0") q.Set("export", "xlsx") 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) } ``` ```java [Java] 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/everything?title=ESG,sustainability,climate,governance&category.id=medtop:04000000&source.country.code=us,gb,de,fr&sort.by=source.country.code,sentiment.overall.score&is_duplicate=0&export=xlsx&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=ESG,sustainability,climate,governance&category.id=medtop:04000000&source.country.code=us,gb,de,fr&sort.by=source.country.code,sentiment.overall.score&is_duplicate=0&export=xlsx 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/everything ``` ::: ## Export pharmaceutical news {#multi-source-pharmaceutical-innovation-tracking-export} Export news about pharmaceutical developments and clinical trials. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=clinical trial,FDA,drug,pharmaceutical&category.id=medtop:07000000&language.code=en&sort.by=published_at&is_duplicate=0&export=csv&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "clinical trial,FDA,drug,pharmaceutical", "category.id": "medtop:07000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "export": "csv", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "clinical trial,FDA,drug,pharmaceutical", "category.id": "medtop:07000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "export": "csv", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "clinical trial,FDA,drug,pharmaceutical", "category.id" => "medtop:07000000", "language.code" => "en", "sort.by" => "published_at", "is_duplicate" => "0", "export" => "csv", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "clinical trial,FDA,drug,pharmaceutical") q.Set("category.id", "medtop:07000000") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("is_duplicate", "0") q.Set("export", "csv") 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) } ``` ```java [Java] 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/everything?title=clinical trial,FDA,drug,pharmaceutical&category.id=medtop:07000000&language.code=en&sort.by=published_at&is_duplicate=0&export=csv&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=clinical trial,FDA,drug,pharmaceutical&category.id=medtop:07000000&language.code=en&sort.by=published_at&is_duplicate=0&export=csv 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/everything ``` ::: ## Export geopolitical coverage {#geopolitical-crisis-media-coverage-analysis-export} Export articles to compare coverage of geopolitical crises. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=conflict,crisis,war,peace,diplomacy&category.id=medtop:11000000&language.code=en&sort.by=published_at&is_duplicate=0&per_page=100&export=xlsx&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "conflict,crisis,war,peace,diplomacy", "category.id": "medtop:11000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "per_page": "100", "export": "xlsx", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "conflict,crisis,war,peace,diplomacy", "category.id": "medtop:11000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "per_page": "100", "export": "xlsx", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "conflict,crisis,war,peace,diplomacy", "category.id" => "medtop:11000000", "language.code" => "en", "sort.by" => "published_at", "is_duplicate" => "0", "per_page" => "100", "export" => "xlsx", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "conflict,crisis,war,peace,diplomacy") q.Set("category.id", "medtop:11000000") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("is_duplicate", "0") q.Set("per_page", "100") q.Set("export", "xlsx") 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) } ``` ```java [Java] 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/everything?title=conflict,crisis,war,peace,diplomacy&category.id=medtop:11000000&language.code=en&sort.by=published_at&is_duplicate=0&per_page=100&export=xlsx&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=conflict,crisis,war,peace,diplomacy&category.id=medtop:11000000&language.code=en&sort.by=published_at&is_duplicate=0&per_page=100&export=xlsx 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/everything ``` ::: ## Export AI regulation news {#ai-regulatory-landscape-comparative-analysis-export} Export news about AI regulation and ethics. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI regulation,AI governance,AI legislation&topic.id=industry.ai_news&category.id=medtop:04000000&language.code=en&sort.by=published_at&is_duplicate=0&export=json&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI regulation,AI governance,AI legislation", "topic.id": "industry.ai_news", "category.id": "medtop:04000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "export": "json", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI regulation,AI governance,AI legislation", "topic.id": "industry.ai_news", "category.id": "medtop:04000000", "language.code": "en", "sort.by": "published_at", "is_duplicate": "0", "export": "json", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI regulation,AI governance,AI legislation", "topic.id" => "industry.ai_news", "category.id" => "medtop:04000000", "language.code" => "en", "sort.by" => "published_at", "is_duplicate" => "0", "export" => "json", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI regulation,AI governance,AI legislation") q.Set("topic.id", "industry.ai_news") q.Set("category.id", "medtop:04000000") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("is_duplicate", "0") q.Set("export", "json") 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) } ``` ```java [Java] 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/everything?title=AI regulation,AI governance,AI legislation&topic.id=industry.ai_news&category.id=medtop:04000000&language.code=en&sort.by=published_at&is_duplicate=0&export=json&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI regulation,AI governance,AI legislation&topic.id=industry.ai_news&category.id=medtop:04000000&language.code=en&sort.by=published_at&is_duplicate=0&export=json 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/fact-check.md' description: >- Verify factual claims against the live news archive and get per-claim verdicts with supporting evidence --- # Fact Check Check a factual claim against recent news with `/v1/fact-check`. Send a statement, an article's text or the `id` of an article in APITube. For each claim, the response includes one of 8 verdicts, a confidence score, a short explanation and articles that support or challenge it. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. > **Fact Check is a paid feature** — it is **not available on the Free plan**. Each request costs **5 points**. ## Endpoint ``` GET /v1/fact-check POST /v1/fact-check ``` GET and POST return the same results. Send parameters in the URL with `GET` or as JSON in the request body with `POST`. Provide **one** of `id`, `text`, or `claim` (priority: `id` > `text` > `claim`). ## Request Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `id` | integer | One of\* | An APITube article id. The article is loaded from the archive, and its claims are extracted and verified. | | `text` | string | One of\* | Raw article text (title + body), 100–10000 characters. Claims are extracted automatically. | | `claim` | string | One of\* | A single factual statement to verify directly (5–500 characters). | | `max_claims` | integer | No | Maximum number of claims to extract and verify. Values below 1 are raised to 1; values above 5 are reduced to 5. Default: 5. | | `evidence_per_claim` | integer | No | Maximum number of evidence articles to retrieve per claim. Values below 1 are raised to 1; values above 20 are reduced to 20. Default: 5. | | `api_key` | string | Yes\*\* | Your API key. Can also be provided via headers. | \* Provide exactly one of `id`, `text`, or `claim`. \*\* Required if not provided in headers. > Each request costs **5 points** and requires a paid plan. This endpoint allows **10 requests per minute**, in addition to your account's overall rate limit. ## How it works 1. **Claims** — for `text`/`id` the claims are extracted automatically; for `claim` your statement is used directly. 2. **Evidence** — for each claim, matching articles are retrieved from the news archive. 3. **Verdict** — each claim is assessed strictly against its evidence and assigned one of the verdicts below. ### Verdict scale `true` · `mostly_true` · `mixed` · `misleading` · `mostly_false` · `false` · `unverified` · `outdated` * `unverified` — not enough evidence in the archive to confirm or refute. * `outdated` — the claim was once true but is contradicted by more recent evidence. ## Response Format ```json { "status": "ok", "request_id": "string", "input": { "type": "claim", "language": "en" }, "summary": { "overall_verdict": "false", "overall_confidence": 0.91, "claims_total": 1, "claims_checked": 1, "verdict_breakdown": { "false": 1 } }, "claims": [ { "claim": "string", "normalized_claim": "string", "checkworthy": true, "verdict": "false", "confidence": 0.91, "as_of": "2026-06-15", "explanation": "string", "evidence": [ { "article_id": 0, "title": "string", "url": "string", "source": "string", "source_authority": 0, "published_at": "string", "snippet": "string", "stance": "refutes", "relevance": 0.88 } ] } ] } ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `status` | string | Always `ok` on success. | | `request_id` | string | Unique identifier for the request. | | `input.type` | string | Which input was used: `id`, `text`, or `claim`. | | `input.language` | string | Detected language of the input. | | `summary.overall_verdict` | string | Aggregated verdict across all checked claims. | | `summary.overall_confidence` | number | Average confidence across checked claims (0..1). | | `summary.claims_total` | integer | Total number of claims returned. | | `summary.claims_checked` | integer | Number of factual, verifiable claims that were checked. | | `summary.verdict_breakdown` | object | Count of claims per verdict. | | `claims[].verdict` | string | One of the 8 verdicts (see scale above). | | `claims[].confidence` | number | Confidence score for the verdict, from 0 to 1. | | `claims[].explanation` | string | Why this verdict was assigned. | | `claims[].as_of` | string | Date the verdict is valid as of (`YYYY-MM-DD`). | | `claims[].checkworthy` | boolean | Whether the claim is an objective, verifiable statement. | | `claims[].evidence[]` | array | Supporting/refuting articles with `stance` (`supports`/`refutes`/`neutral`), `relevance` (0..1) and `source_authority` (higher = more authoritative). | ## Request Examples ### GET — verify a single claim ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/fact-check?claim=OpenAI released GPT-5 in 2024&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/fact-check", params={"claim": "OpenAI released GPT-5 in 2024", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ claim: "OpenAI released GPT-5 in 2024", api_key: "YOUR_API_KEY", }); const resp = await fetch(`https://api.apitube.io/v1/fact-check?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query([ "claim" => "OpenAI released GPT-5 in 2024", "api_key" => "YOUR_API_KEY", ]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/fact-check?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/fact-check") q := u.Query() q.Set("claim", "OpenAI released GPT-5 in 2024") 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) } ``` ```java [Java] 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/fact-check?claim=OpenAI+released+GPT-5+in+2024&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/fact-check?claim=OpenAI released GPT-5 in 2024 Read the API key from an environment variable (do not hardcode it), handle request errors, and print each claim's verdict, confidence and evidence. Docs: https://docs.apitube.io/platform/news-api/fact-check ``` ::: ### POST — fact-check article text or an article by id ::: code-group ```bash [cURL] # Verify an article already in the corpus by its id curl -X POST "https://api.apitube.io/v1/fact-check" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": 123456789, "max_claims": 5 }' # Or fact-check raw article text curl -X POST "https://api.apitube.io/v1/fact-check" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "
" }' ``` ```python [Python] import requests resp = requests.post( "https://api.apitube.io/v1/fact-check", headers={"X-API-Key": "YOUR_API_KEY"}, json={"id": 123456789, "max_claims": 5}, ) print(resp.json()) ``` ```javascript [Node.js] const resp = await fetch("https://api.apitube.io/v1/fact-check", { method: "POST", headers: { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ id: 123456789, max_claims: 5 }), }); console.log(await resp.json()); ``` ```php [PHP] $ch = curl_init("https://api.apitube.io/v1/fact-check"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode([ "id" => 123456789, "max_claims" => 5, ]), ]); $data = json_decode(curl_exec($ch), true); print_r($data); ``` ```go [Go] package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { payload, _ := json.Marshal(map[string]any{ "id": 123456789, "max_claims": 5, }) req, _ := http.NewRequest("POST", "https://api.apitube.io/v1/fact-check", bytes.NewBuffer(payload)) req.Header.Set("X-API-Key", "YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) var data map[string]any json.Unmarshal(body, &data) fmt.Println(data) } ``` ```java [Java] 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 { String payload = "{\"id\": 123456789, \"max_claims\": 5}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.apitube.io/v1/fact-check")) .header("X-API-Key", "YOUR_API_KEY") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: POST https://api.apitube.io/v1/fact-check Body (JSON): { "id": 123456789, "max_claims": 5 } Read the API key from an environment variable (do not hardcode it), handle request errors, and print each claim's verdict, confidence and evidence. Docs: https://docs.apitube.io/platform/news-api/fact-check ``` ::: ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/fact-check?claim=The Eiffel Tower is in Paris" ``` ## Response Example ```json { "status": "ok", "request_id": "req_abc123def456", "input": { "type": "claim", "language": "en" }, "summary": { "overall_verdict": "false", "overall_confidence": 0.91, "claims_total": 1, "claims_checked": 1, "verdict_breakdown": { "false": 1 } }, "claims": [ { "claim": "OpenAI released GPT-5 in 2024", "normalized_claim": "openai released gpt-5 in 2024", "checkworthy": true, "verdict": "false", "confidence": 0.91, "as_of": "2026-06-15", "explanation": "Sources report the release of GPT-4o in 2024; a model named GPT-5 was not released that year.", "evidence": [ { "article_id": 884412201, "title": "OpenAI unveils GPT-4o, its new flagship model", "url": "https://example-news.com/openai-gpt4o", "source": "example-news.com", "source_authority": 92, "published_at": "2024-05-13T17:00:00Z", "snippet": "OpenAI on Monday announced GPT-4o...", "stance": "refutes", "relevance": 0.88 } ] } ] } ``` ## Error Responses ### Free plan not allowed ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 403, "code": "ER0706", "message": "Fact-check is not available on the free plan. Please upgrade your subscription.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 403 ### Missing input ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 400, "code": "ER0700", "message": "Provide one of the parameters: id, text, or claim.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 400 ### Article not found (id) ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 404, "code": "ER0702", "message": "Article with the provided id was not found.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 404 ### Invalid id ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 400, "code": "ER0704", "message": "id must be a valid integer.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 400 ### Invalid text length ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 400, "code": "ER0701", "message": "text must be between 100 and 10000 characters.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 400 ### Invalid claim length ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 400, "code": "ER0705", "message": "claim must be between 5 and 500 characters.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 400 ### No Points on Account ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 402, "code": "ER0176", "message": "You have no points on your account.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 402 ### Rate Limit Exceeded Fact Check allows **10 requests per minute**. ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 429, "code": "ER0203", "message": "Rate limit exceeded. You can make 10 requests per minute. Try again in 60 seconds.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 429 ### Service Unavailable The fact-check service did not respond. Wait a moment and retry. ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 502, "code": "ER0703", "message": "Fact-check service is temporarily unavailable. Please try again later.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-06-15T14:30:00Z" } ] } ``` **Status Code:** 502 --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/javascript/fetch-client.md description: Call the APITube News API from JavaScript using the native Fetch API --- # Fetch integration ```javascript const options = { method: 'GET' }; fetch('https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/node-js/fetch-client.md' description: Call the APITube News API from Node.js using the Fetch API --- # Fetch integration ```javascript const fetch = require('node-fetch'); const url = 'https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY'; const options = { method: 'GET' }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error('error:' + err)); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/typescript/fetch-client.md description: >- Call the APITube News API from TypeScript using the built-in Fetch API with typed responses --- # Fetch integration ```typescript interface NewsResponse { status: string; data: Article[]; } interface Article { title: string; description: string; url: string; published_at: string; } async function fetchNews(): Promise { const params = new URLSearchParams({ per_page: '50', api_key: 'YOUR_API_KEY' }); try { const response = await fetch( `https://api.apitube.io/v1/news/everything?${params}` ); if (!response.ok) { throw new Error(`HTTP Request Error: ${response.status}`); } const data: NewsResponse = await response.json(); console.log(JSON.stringify(data, null, 2)); } catch (error) { console.error(error); } } fetchNews(); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/reading-level-feed.md description: >- Serve news matched to your readers — pick a difficulty band, tune it with Flesch-Kincaid grade or reading age, then cap the reading time --- # Filter News by Reading Level Use readability filters to choose articles for language learners, children, general readers or specialists. See [Readability Filters](/platform/news-api/filters#readability) for all parameters. ## Step 1: Pick a difficulty band Choose a `readability.difficulty`: `beginner` (below grade 6), `intermediate` (6–10), `advanced` (10–14) or `expert` (14+). Or select an audience with `readability.audience`: `children`, `general`, `professional` or `academic`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&language.code=en&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.difficulty": "beginner", "language.code": "en", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "beginner", "language.code": "en", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "beginner", "language.code" => "en", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.difficulty", "beginner") q.Set("language.code", "en") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?readability.difficulty=beginner&language.code=en&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&language.code=en&per_page=20 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/everything ``` ::: Each article carries the scores it was matched on, so you can show them in the UI: ```json { "readability": { "flesch_kincaid_grade": 8, "flesch_reading_ease": 100, "automated_readability_index": 8.8, "difficulty_level": "intermediate", "target_audience": "general", "reading_age": 13, "avg_words_per_sentence": 60.5 } } ``` * **Grade level** — `readability.flesch_kincaid_grade`, the US school grade needed to follow the text. * **Ease score** — `readability.flesch_reading_ease`, 0–100, where higher is easier. * **Reading age** — `readability.reading_age`, in years. * **Difficulty and audience** — `readability.difficulty_level` and `readability.target_audience` use the same values as the filters. ## Step 2: Set a precise range for reading level {#step-2-tune-the-band-to-an-exact-range} To set a more precise reading level, use numeric filters with `.min` and `.max`: `readability.fk_grade` (0–30), `readability.ease` (0–100), `readability.ari` (0–30) or `readability.age` (6–22). ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.fk_grade.min=6&readability.fk_grade.max=10&readability.ease.min=60&language.code=en&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.fk_grade.min": "6", "readability.fk_grade.max": "10", "readability.ease.min": "60", "language.code": "en", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.fk_grade.min": "6", "readability.fk_grade.max": "10", "readability.ease.min": "60", "language.code": "en", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.fk_grade.min" => "6", "readability.fk_grade.max" => "10", "readability.ease.min" => "60", "language.code" => "en", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.fk_grade.min", "6") q.Set("readability.fk_grade.max", "10") q.Set("readability.ease.min", "60") q.Set("language.code", "en") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?readability.fk_grade.min=6&readability.fk_grade.max=10&readability.ease.min=60&language.code=en&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.fk_grade.min=6&readability.fk_grade.max=10&readability.ease.min=60&language.code=en&per_page=20 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/everything ``` ::: Two shortcuts cover the common cases without any numbers: `is_easy_read=1` keeps articles with a Flesch Reading Ease of 60 or above, and `is_difficult_read=1` keeps everything below 40. ## Step 3: Set a reading-time limit and add other filters {#step-3-cap-the-reading-time-and-stack-the-rest-of-your-filters} Combine readability and `read_time` to choose articles your readers can understand and finish in the time available. Then add topic or other filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&read_time.max=3&language.code=en&category.id=medtop:15000000&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.difficulty": "beginner", "read_time.max": "3", "language.code": "en", "category.id": "medtop:15000000", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "beginner", "read_time.max": "3", "language.code": "en", "category.id": "medtop:15000000", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "beginner", "read_time.max" => "3", "language.code" => "en", "category.id" => "medtop:15000000", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.difficulty", "beginner") q.Set("read_time.max", "3") q.Set("language.code", "en") q.Set("category.id", "medtop:15000000") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?readability.difficulty=beginner&read_time.max=3&language.code=en&category.id=medtop:15000000&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&read_time.max=3&language.code=en&category.id=medtop:15000000&per_page=20 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/everything ``` ::: For a learning app, offer several difficulty levels so users can move up as they improve: ```python import requests LEVELS = { "A2": {"readability.fk_grade.max": 5}, "B1": {"readability.fk_grade.min": 5, "readability.fk_grade.max": 8}, "B2": {"readability.fk_grade.min": 8, "readability.fk_grade.max": 11}, "C1": {"readability.fk_grade.min": 11}, } def feed(level, api_key, language="en", limit=20): params = {"language.code": language, "per_page": limit, "api_key": api_key, **LEVELS[level]} return requests.get("https://api.apitube.io/v1/news/everything", params=params).json()["results"] ``` > Tip: readability scores apply to each article. Filter by the score to find a reading level across different publishers. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/journalists-by-beat.md description: >- Find journalists, see where they publish and learn which subjects and people they cover. --- # Find journalists by topic {#find-journalists-on-a-beat} Use [Journalists](/platform/news-api/reference/journalists) to find who writes about a subject and where they publish. These profiles can help with media research and outreach. ## Step 1: Search journalists by name ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/journalists?name=Alex&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/journalists", params={ "name": "Alex", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "name": "Alex", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/journalists?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["name" => "Alex", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/journalists?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/journalists") q := u.Query() q.Set("name", "Alex") 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) } ``` ```java [Java] 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/journalists?name=Alex&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/journalists?name=Alex 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/everything ``` ::: Each result groups matching bylines by name and lists the journalist's `outlets` and `outlet_count`. ## Step 2: Check what the journalist covers {#step-2-inspect-the-journalist-s-beat} Fetch the profile and read `coverage`: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/journalists/15898?api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/journalists/15898", params={ "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/journalists/15898?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/journalists/15898?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/journalists/15898") q := u.Query() 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) } ``` ```java [Java] 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/journalists/15898?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/journalists/15898 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/everything ``` ::: * **Where they publish** — `outlets`. * **What they write about** — `coverage.top_topics`. * **Who they cover** — `coverage.top_entities` (people, companies, places). * **How active they are** — `coverage.article_count`, `coverage.timeline`, `coverage.momentum`. * **Latest pieces** — `recent_articles`. ## Step 3: Make a list of journalists {#step-3-build-a-beat-list} Browse the directory, fetch profiles and keep journalists whose `coverage.top_topics` or `coverage.top_entities` match your subject. ```python import requests def covers_topic(journalist_id, topic_name, api_key): r = requests.get( f"https://api.apitube.io/v1/journalists/{journalist_id}", params={"api_key": api_key}, ).json() topics = [t["name"].lower() for t in r["coverage"]["top_topics"]] return topic_name.lower() in topics ``` ::: warning Profiles group exact name matches. Check each profile before outreach: different people with the same name or generic bylines such as `admin` may be grouped together. --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/python/flask-framework.md description: >- Call the APITube News API from Flask Python using the requests library in route handlers --- # Flask integration ```python from flask import Flask import requests app = Flask(__name__) @app.route('/') def make_request(): url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" response = requests.get(url) if response.status_code == 200: return response.text else: return f"HTTP Request Error: {response.status_code}" if __name__ == '__main__': app.run() ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/fsharp/fsharp-data-client.md description: Call the APITube News API from F# using the FSharp.Data library --- # FSharp.Data integration ```fsharp #r "nuget: FSharp.Data" open FSharp.Data let response = Http.RequestString( "https://api.apitube.io/v1/news/everything", query = [ "per_page", "50"; "api_key", "YOUR_API_KEY" ] ) printfn "%s" response ``` --- --- url: 'https://docs.apitube.io/guides/user-guide/general-faqs.md' description: >- Frequently asked questions about APITube News API — pricing, credits, supported websites, filters, integrations, and usage. --- Answers to common questions about **APITube**. # General FAQs ## How many websites do you aggregate news from? The API covers more than 300,000 websites. ## Can I use content from your API on my platform/website? The API provides publicly available content. APITube does not own the copyright to that content. ## Can you add a news website if I ask? {#can-you-add-a-news-website-per-request} Yes. ## What are API Points? Your plan includes points to spend on API requests. The number of points used depends on the request. ## Do unused credits carry over to the next month? {#can-unused-credits-be-carried-forward-to-the-following-month} Yes. ## Can I change my plan? {#can-i-change-the-subscribed-plan} You can change your plan at any time. ## How can I unsubscribe? Open your settings and click **Unsubscribe**. Your account stays active, and you keep your remaining credits. ## What are the different ways to use the API? Send HTTP requests from Python, Java, JavaScript, PHP, Kotlin, Swift and many more languages. The integration guides show how to make a request in each language. ## What happens when I use all the credits in a paid plan? You can upgrade your plan or wait until the next month to get more credits. ## What happens when I run out of credits on the Free plan? {#what-if-i-use-free-plan-and-my-credits-are-over} Free plan points reset daily at 00:00 UTC. Upgrade to a paid plan if you need more. ## What filters does the API support? You can search by keywords and narrow the results by date, topic, language, source, country and other filters. --- --- url: 'https://docs.apitube.io/platform/news-api/story.md' description: >- Get related coverage with /v1/news/story/{article_id}. Find the article ID parameter, shared filter restrictions, request examples and errors. --- # Get a story with `/v1/news/story/{article_id}` Pass an article ID to `/v1/news/story/{article_id}` to find other articles about the same event. Use it to compare coverage across publishers. Each request costs **1 point**. ## Endpoint ``` GET /v1/news/story/{article_id} POST /v1/news/story/{article_id} ``` Base URL: `https://api.apitube.io`. The article ID goes in the path. Shared filters narrow the cluster it returns. ## What counts as a story A story is a group of articles about one event. It has no separate ID. Results depend on the starting article and its title: * A short or vague starting title may return few matches or unrelated results. If the title cannot be used for matching, the API returns `404 ER0240`. * Two starting articles about the same event may return different groups of related articles. Use these results to measure coverage, compare reporting or keep one article per event in your feed. ## Parameters Filters apply **within** the cluster — for example `language.code=en` returns only the English coverage of that story. ### Path parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `article_id` | string | Yes | Source article ID to find related stories for. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ::: tip This endpoint does not accept `prompt`. Choose the starting article by ID. ::: ## Response format Uses the shared [Response format](/platform/news-api/response-structure): related articles under `results`, each with the full article object described in [API Response Structure](/platform/news-api/response-structure#article-object-fields). ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/story/3036291250?per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests article_id = "3036291250" response = requests.get( f"https://api.apitube.io/v1/news/story/{article_id}", params={"per_page": 20}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["source"]["domain"], "—", article["title"]) ``` ```javascript [Node.js] const articleId = '3036291250'; const response = await fetch( `https://api.apitube.io/v1/news/story/${articleId}?per_page=20`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); const data = await response.json(); console.log(`${data.results.length} outlets covered this story`); ``` ```php [PHP] $articleId = '3036291250'; $query = http_build_query(['per_page' => 20, 'api_key' => 'YOUR_API_KEY']); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/story/$articleId?$query"), true); echo count($data['results']), ' related articles', PHP_EOL; ``` ::: ### How did coverage differ by sentiment? ```bash curl "https://api.apitube.io/v1/news/story/3036291250?facet=1&facet.field=sentiment.overall.polarity&api_key=YOUR_API_KEY" ``` ### Only high-authority coverage ```bash curl "https://api.apitube.io/v1/news/story/3036291250?source.rank.opr.min=6&api_key=YOUR_API_KEY" ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0231` | 400 | Article ID missing from the path | | `ER0235` | 404 | No article with that ID | | `ER0240` | 404 | The starting article's title contains no keywords that can be used to find related articles. | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Get an article by ID](/platform/news-api/article) — the seed article itself. * [Search articles](/platform/news-api/everything) — find a seed article to start from. * [Filters](/platform/news-api/filters) — syntax and examples for the shared filters. --- --- url: 'https://docs.apitube.io/platform/news-api/article.md' description: >- Fetch one or up to 100 articles by ID with /v1/news/article. Find the ID parameter, batch lookup examples, response format and errors. --- # Get an article by ID with `/v1/news/article` Use `/v1/news/article` to get articles by their APITube IDs. Pass one `id` or up to 100 IDs separated by commas to fetch articles you saved earlier. Each request costs **1 point**, whether it fetches one article or a hundred. ## Endpoint ``` GET /v1/news/article POST /v1/news/article ``` Base URL: `https://api.apitube.io`. ## Where article IDs come from You can find an article's `id` in: * the `id` field of any article returned by [`/v1/news/everything`](/platform/news-api/everything) or [`/v1/news/top-headlines`](/platform/news-api/top-headlines); * the `article_id` you stored when you first received an article; * the SSE and WebSocket streams, which deliver the same `id` in real time. Save the `id` if you want to fetch the article again. This endpoint only accepts article IDs. ## Batch lookup ``` GET /v1/news/article?id=3036291250,3036291251,3036291252 ``` Send up to **100** IDs per request. The API ignores extra IDs without an error. Split larger lists into separate requests. Unknown IDs do not appear in `results`. The request still succeeds and does not return `404`. Compare the returned IDs with your list to find any missing articles. ::: tip This endpoint and `/v1/news/story` ignore `prompt`. Use article IDs to choose which articles to return. ::: ## Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `id` | string | Yes | Comma-separated article IDs (max 100). Required. Example: `12345`. | See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. This endpoint ignores `prompt`. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). Articles are in `results`, and `href` links to each original article. See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all fields. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/article?id=3036291250&api_key=YOUR_API_KEY" ``` ```python [Python] import requests ids = ["3036291250", "3036291251", "3036291252"] response = requests.get( "https://api.apitube.io/v1/news/article", params={"id": ",".join(ids)}, headers={"X-API-Key": "YOUR_API_KEY"}, ) found = {article["id"] for article in response.json()["results"]} print("missing:", set(map(int, ids)) - found) ``` ```javascript [Node.js] const ids = ['3036291250', '3036291251']; const response = await fetch( `https://api.apitube.io/v1/news/article?id=${ids.join(',')}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); const data = await response.json(); console.log(data.results.map(a => a.title)); ``` ```php [PHP] $query = http_build_query(['id' => '3036291250', 'api_key' => 'YOUR_API_KEY']); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/article?$query"), true); print_r($data['results'][0]['title']); ``` ::: ### Fetching only the fields you need Use `fl` to return only the fields you need, especially when fetching many articles: ```bash curl "https://api.apitube.io/v1/news/article?id=3036291250,3036291251&fl=id,title,published_at,href&api_key=YOUR_API_KEY" ``` ### Exporting a single article ```bash curl "https://api.apitube.io/v1/news/article?id=3036291250&export=json&api_key=YOUR_API_KEY" -o article.json curl "https://api.apitube.io/v1/news/article?id=3036291250&export=xml&api_key=YOUR_API_KEY" -o article.xml ``` ## Errors | Code | Status | Meaning | |------|--------|---------| | `ER0232` | 400 | `id` is missing | | `ER0179` | 400 | `id` passed more than once — send one comma-separated value instead | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Get a story](/platform/news-api/story) — the cluster of articles related to one article ID. * [Search articles](/platform/news-api/everything) — find the IDs in the first place. * [API Response Structure](/platform/news-api/response-structure) — every field of the article object. --- --- url: 'https://docs.apitube.io/platform/news-api/common-workflows/getting-started.md' description: The basics of using the News API examples library --- # Getting Started with News API Examples Find a request example for the filter you need. Each example includes code you can copy and a short explanation of the results. Open the [examples library](./examples/) to choose a filter. The examples cover: * Filtering by headlines * Working with different languages * Filtering by categories and topics * Sentiment analysis * Working with news sources * Filtering by dates Replace the example API key with your own before running a request. --- --- url: 'https://docs.apitube.io/platform/news-api/glossary.md' description: >- Plain definitions of the core APITube News API concepts — articles, stories, entities, sentiment, categories, topics, industries, sources, source rank, trends, pagination, credits, and rate limits. --- # Glossary Definitions of the terms used in the News API documentation. ## News API The APITube News API gives you access to articles from more than 300,000 verified sources worldwide. Each article includes fields such as language, category, topic, industry, entities, sentiment and publisher details. Use these fields to search and analyse news. ## API key Your API key gives you access to the News API. Get it from your APITube account and include it in every request, either in the `X-API-Key` header or the `api_key` URL parameter. ## Bearer token You can send your API key in the `Authorization: Bearer YOUR_API_KEY` header. This works as an alternative to the `X-API-Key` header or a URL parameter. ## Endpoint An endpoint is a URL path for a specific API operation. For example, `/v1/news/everything` searches articles, `/v1/news/top-headlines` returns headlines, `/v1/news/story` finds related articles, and `/v1/news/article` looks up articles by ID. Other endpoints include `/v1/news/trends`, `/v1/news/stream`, `/v1/suggest/*` and `/v1/balance`. ## Article An article is one news item in the API response. It includes a title, body, URL, publication date, author, language and source details. Use its unique article ID to fetch it again or find related articles. ## Story A story is a group of articles about the same event. Pass an article ID to `/v1/news/story` to find related coverage from other publishers or keep one article per event in your feed. ## Entity An entity is a person, place, organization, brand, product, disaster, disease, event or sport mentioned in an article. Each has an `entity.id`, an `entity.type` and a Wikidata ID. Use entity filters to search for a specific subject. ## Sentiment Sentiment describes the tone of an article. `sentiment.overall.polarity` is positive, negative or neutral. `sentiment.overall.score` gives a numeric score. You can filter and sort articles by these values. ## Category A category groups articles by subject using IPTC Media Topics. Use `category.id` with a `medtop:` code, such as `medtop:04000000` for finance. ## Topic A topic is a specific subject, such as cryptocurrency, green energy or artificial intelligence. Use `topic.id`, for example `industry.crypto_news`, to search for it. ## Industry An industry is the business sector an article relates to, such as technology, healthcare or energy. Use `industry.id` to follow news about that sector. ## Source A source is the publisher or website behind an article. Use `source.id`, `source.domain` or `source.country.code` to include or exclude publishers. ## Source rank Source rank measures a publisher's domain authority using Open Page Rank. The response field is `source.rankings.opr`; the filter is `source.rank.opr.min`. A higher value means a higher-ranked source. ## Trends The `/v1/news/trends` endpoint counts how often entities, categories, topics, industries or sources appear in matching articles. Use it to rank common subjects, see growth or compare periods. ## Pagination Pagination splits results into pages. `per_page` sets the number of items in a response, and `offset` sets how many to skip. Request pages in sequence to work through larger result sets. ## Sort order Use `sort.by` to choose a field, such as `published_at` or `sentiment.overall.score`. Set `sort.order` to `asc` for ascending order or `desc` for descending order. ## Language code Use a two-letter `language.code`, such as `en` for English. Codes follow ISO 639-1, with Belarusian using `by` instead of `be`. The directory also includes `un` for undetermined language. Send up to three codes separated by commas to match any of them. See the [list of languages](/platform/news-api/list-of-languages). ## Credit and balance Credits pay for API requests. Check `/v1/balance` to see the remaining credits for your API key. ## Rate limit Your rate limit sets how many requests you can send in a time window. Check `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` in responses to stay within the limit. ## SSE stream Server-Sent Events (SSE) deliver new matching articles over one open HTTP connection at `/v1/news/stream`. You receive articles as they become available without repeatedly checking the API. ## Reference endpoints Search profiles of people, companies and journalists with `/v1/people`, `/v1/companies` and `/v1/journalists`. Each profile includes background details, a `coverage` summary and recent articles. ## Coverage The `coverage` object summarises news about a person or company. It includes article counts, first and last mention dates, sentiment, a monthly timeline, momentum, and top sources, topics, countries, languages and related entities. ## Momentum Momentum compares mentions in the last 30 days with the previous 30 days. `change_pct` shows the percentage increase or decrease. ## Related entities The `related_entities` field lists people, companies and other subjects often mentioned alongside the profile's subject. For example, it can show a company's partners or competitors. ## Open PageRank (OPR) Open PageRank is a domain authority score from 0 to 10. Read it from `source.rankings.opr` in article responses, and filter with `source.rank.opr.min`. It is the score used for [source rank](#source-rank). ## Journalist name matching {#journalist-normalization} A journalist record groups bylines with the same name and lists their `outlets`. Different people with the same name, or generic bylines such as `admin`, may appear in one record. --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/typescript/got-client.md description: Call the APITube News API from TypeScript using the Got HTTP client --- # Got integration ```typescript import got from 'got'; interface NewsResponse { status: string; data: Article[]; } interface Article { title: string; description: string; url: string; published_at: string; } async function fetchNews(): Promise { try { const response = await got( 'https://api.apitube.io/v1/news/everything', { searchParams: { per_page: 50, api_key: 'YOUR_API_KEY' }, responseType: 'json' } ); console.log(JSON.stringify(response.body, null, 2)); } catch (error) { console.error('HTTP Request Error:', error); } } fetchNews(); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/php/guzzle-client.md' description: Call the APITube News API from PHP using the Guzzle HTTP client library --- # Guzzle integration ```php // Install: composer require guzzlehttp/guzzle require 'vendor/autoload.php'; use GuzzleHttp\Client; $client = new Client(); $response = $client->request('GET', 'https://api.apitube.io/v1/news/everything', [ 'query' => [ 'per_page' => 10, 'api_key' => 'YOUR_API_KEY' ], ]); echo $response->getBody(); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/help.md' description: >- Where to look when an APITube request does not behave — the glossary, technical FAQ, debugging guide, error codes and the live API status page. --- # Help Find the guide that matches your problem. | Symptom | Go to | |:--------|:------| | No articles, a rejected API key or HTTP `429` | [Troubleshoot a request](/platform/news-api/troubleshooting) — check a request step by step | | A term in the docs means nothing to you | [Glossary](/platform/news-api/glossary) | | A general "how does X work" question | [Technical FAQ](/platform/news-api/technical-faq) | | The request returns `200` but the results look wrong | [Debugging API requests](/platform/news-api/debugging) | | The request returns an error code | [HTTP response codes](/platform/news-api/http-response-codes) | | `429`, or requests being throttled | [Rate limits and quotas](/platform/news-api/rate-limits) | | `402`, or points running out faster than expected | [Balance and usage](/platform/news-api/balance) | | Everything fails at once | [API Status](https://status.apitube.io/) | ## Filters that do not apply {#the-one-that-catches-everyone} An unrecognised parameter does not cause an error: the API returns `200 ok` and ignores that filter. Check parameter names and values when results are broader than expected. Wildcards are not supported. Check `user_input` in the response to see which parameters the API accepted. Follow [Debugging API requests](/platform/news-api/debugging) for a step-by-step check. ## More material * **[Cookbook](https://apitube.io/cookbook)** — worked solutions to concrete tasks. * **[Usage examples](/platform/news-api/common-workflows/examples/)** — requests grouped by filter and result options. * **[Recipes](/platform/news-api/common-workflows/recipes/)** — end-to-end guides for a specific task. * **[Migrations](/platform/migrations/)** — coming from another news API, including the behaviour differences that surprise people. ## Still stuck Use the chat widget on any documentation page or contact support at [apitube.io](https://apitube.io). Include the response's `request_id` so support can find your request. --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/elixir/http-client.md' description: Call the APITube News API from Elixir using the HTTPoison library --- # HTTP integration ```elixir defmodule MyController do def make_request do url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" case HTTPoison.get(url) do {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> IO.puts("Response: #{body}") {:ok, %HTTPoison.Response{status_code: status}} when status >= 400 and status < 500 -> IO.puts("Client Error: #{status}") {:ok, %HTTPoison.Response{status_code: status}} when status >= 500 -> IO.puts("Server Error: #{status}") {:error, %HTTPoison.Error{reason: reason}} -> IO.puts("HTTP Request Error: #{reason}") _ -> IO.puts("An unknown error occurred") end end end void main() async { var controller = MyController(); await controller.makeRequest(); } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/go/new-request-client.md description: Call the APITube News API from Go using the standard net/http package --- # NewRequest integration ```go package main import ( "fmt" "io/ioutil" "log" "net/http" ) func main() { resp, err := http.Get("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") if err != nil { log.Fatalf("Error: %v", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatalf("Error: %v", err) } fmt.Println(string(body)) } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/lua/http-client.md' description: Call the APITube News API from Lua using the socket.http module --- # HTTP integration ```lua -- Install: luarocks install luasocket local http = require("socket.http") local ltn12 = require("ltn12") function makeRequest() local url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" local response_body = {} local res, status, response_header = http.request{ url = url, method = "GET", sink = ltn12.sink.table(response_body) } if res and status == 200 then print("Response: " .. table.concat(response_body)) elseif status >= 400 and status < 500 then print("Client Error: " .. status) elseif status >= 500 then print("Server Error: " .. status) else print("HTTP Request Error") end end -- Make the HTTP request makeRequest() ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/python/http-client.md' description: >- Call the APITube News API from Python using the built-in http.client module for low-level HTTP operations --- # HTTP Client integration ```python import http.client conn = http.client.HTTPSConnection("apitube.io") conn.request("GET", "/v1/news?per_page=10&api_key=YOUR_API_KEY") res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/node-js/http-client.md' description: >- Call the APITube News API from Node.js using the built-in HTTP module for network communication --- # HTTP integration ```javascript const http = require("http"); const options = { "method": "GET", "hostname": "apitube.io", "port": null, "path": "/v1/news?per_page=10&api_key=YOUR_API_KEY" }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/dart/http-client.md' description: >- Call the APITube News API from Dart using the HTTP package for making network requests --- # HTTP integration ```dart // Install: dart pub add http import 'package:http/http.dart' as http; void main() async { final response = await http.get( Uri.parse('https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY'), ); if (response.statusCode == 200) { print(response.body); } else { print('Error: ${response.statusCode}'); } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/http-response-codes.md' description: Learn about the HTTP response codes returned by the APITube News API. --- # HTTP Response Codes Check the HTTP status first: `2xx` means success, `4xx` usually means a problem with the request or account, and `5xx` means a server error. | HTTP Response Code | Status | Description | |--------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `200` | ok | Everything worked as expected. | | `400` | not\_ok | API request is malformed or contains invalid parameters. | | `401` | not\_ok | API key is invalid or missing. | | `402` | not\_ok | You have no points on your account. | | `403` | not\_ok | Access denied: IP address is not in the allowed list. | | `404` | not\_ok | Entry not found. | | `429` | not\_ok | You have exceeded your plan's request limit. Wait for it to reset before sending more requests. | | `500` | not\_ok | The server encountered an unexpected error. This is usually temporary; try again shortly. | | `502` | not\_ok | A service needed to complete the request is temporarily unavailable. Try again shortly. | *** # API Error Codes Use the tables below to look up an API error code (ER####), its HTTP status and what it means. ## Authentication & Authorization Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0175` | 401 | Invalid or missing API key. Current requests return `401 ER0201` for a missing key or `401 ER0202` for an invalid one instead. | | `ER0176` | 402 | You have no points on your account. Also returned when the balance is funded but the pay-as-you-go [balance switch](/platform/news-api/rate-limits#spending-your-pay-as-you-go-balance) is off. | | `ER0177` | 402 | Monthly pay-as-you-go spending limit reached. | | `ER0200` | 400 | API key required. Current requests return `401 ER0201` instead. | | `ER0201` | 401 | API key is required. Provide it via X-API-Key header or api\_key query parameter. | | `ER0202` | 401 | API key is invalid. | | `ER0230` | 401 | API key has expired. | The same `ER0176` code (always `402`) is reused by the [SSE stream](/platform/news-api/sse-stream) with a different message — "You have no SSE points on your account." REST requests and streaming draw from **separate credit pools**, so the message tells you which balance is empty (regular points vs SSE points). ## API Key Restriction Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0601` | 403 | Access denied: your IP address is not allowed for this API key. | | `ER0602` | 403 | Access denied: your domain is not allowed for this API key. | | `ER0603` | 403 | Access denied: this API key is not authorized for this endpoint. Required scope: {scope}. | ## Rate Limiting Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0203` | 429 | Rate limit exceeded. You can make X requests per minute. Try again in Y. | | `ER0204` | 429 | You have been temporarily banned for exceeding rate limits. Try again in Y. | | `ER0184` | 429 | Too many concurrent requests for your account. Please retry shortly. | `ER0184` limits simultaneous requests per account: Free 1, Starter 2, Basic 2, Professional 3 and Corporate 4. This is separate from the per-minute limit (`ER0203`). Extra requests wait briefly; `ER0184` means the queue is full or the wait timed out. Follow the `Retry-After` header and reduce parallel requests. This limit does not apply to `/v1/news/stream` or `/v1/news/ws`. After 30 rate-limit violations, the API may temporarily block your key with `429 ER0204`. The author filter also uses `ER0204`, but with HTTP `400` for an unknown author name. Check both the HTTP status and the error code. ## General Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0179` | 400 | Parameter must be sent once, not repeated. | | `ER0182` | 404 | Requested endpoint not found. Please check the URL and try again. | | `ER0183` | 500 | Something went wrong. | | `ER0180` | 504 | Query timed out. Narrow the filters or the published\_at range and try again. | `ER0179` is returned when the same query parameter appears more than once in the URL, for example `?title=bitcoin&title=tesla`. Send each parameter a single time. To match several values, use the boolean `query` parameter — `?query=title:(bitcoin OR tesla)`. ## Article Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0001` | 400 | Invalid article.id value. | | `ER0002` | 400 | article.id must be between 1 and 20 characters. | | `ER0231` | 400 | Article ID is required. (story endpoint) | | `ER0232` | 400 | Article ID is required. (article endpoint) | | `ER0234` | 400 | Invalid article id — article ids are integers. (`/v1/news/article`, `/v1/news/story/{id}`) | | `ER0235` | 404 | Article not found. | | `ER0240` | 404 | No keywords found in article title. | ## Duplicate Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0003` | 400 | Invalid is\_duplicate value. | | `ER0004` | 400 | is\_duplicate must be 0 or 1. | ## Paywall Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0005` | 400 | Invalid is\_paywall value. | | `ER0006` | 400 | is\_paywall must be 0 or 1. | ## Title Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0007` | 400 | title must be between 2 and 100 characters. | | `ER0008` | 400 | ignore.title must be between 2 and 100 characters. | | `ER0009` | 400 | title\_starts\_with must be between 2 and 100 characters. | | `ER0010` | 400 | title\_ends\_with must be between 2 and 100 characters. | | `ER0011` | 400 | title\_pattern must be between 2 and 200 characters. | | `ER0340` | 400 | Phrase in quotes must be between 3 and 200 characters (2 for CJK). | | `ER0341` | 400 | The allowed gap between words in a proximity search must be from 0 to 10. | | `ER0349` | 400 | Too many title terms require matching inside words. At most 8 such terms are allowed; see the explanation below. | | `ER0351` | 400 | Unclosed quote in title. Every opening quote needs a closing one. | Most title searches match whole words. Terms with separators (`eur/usd`, `AT&T`, `S&P`), single characters and Chinese, Japanese or Korean text can also match inside longer words. You can send at most **8** such terms per request; more returns `ER0349`. When a request does use substring matching, the response carries an `ER0367` warning in `meta.warnings` listing the affected terms. ## Media Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0012` | 400 | Invalid media.images.count value. | | `ER0013` | 400 | media.images.count must be greater than or equal to 0. | | `ER0014` | 400 | media.images.count must be between 1 and 10 characters. | | `ER0015` | 400 | Invalid media.images.count.min value. | | `ER0016` | 400 | media.images.count.min must be greater than or equal to 0. | | `ER0017` | 400 | media.images.count.min must be between 1 and 10 characters. | | `ER0018` | 400 | Invalid media.images.count.max value. | | `ER0019` | 400 | media.images.count.max must be greater than or equal to 0. | | `ER0020` | 400 | media.images.count.max must be between 1 and 10 characters. | | `ER0021` | 400 | Invalid media.images.width.min value. | | `ER0022` | 400 | media.images.width.min must be greater than or equal to 0. | | `ER0023` | 400 | media.images.width.min must be between 1 and 10 characters. | | `ER0024` | 400 | Invalid media.images.width.max value. | | `ER0025` | 400 | media.images.width.max must be greater than or equal to 0. | | `ER0026` | 400 | media.images.width.max must be between 1 and 10 characters. | | `ER0027` | 400 | Invalid media.images.height.min value. | | `ER0028` | 400 | media.images.height.min must be greater than or equal to 0. | | `ER0029` | 400 | media.images.height.min must be between 1 and 10 characters. | | `ER0030` | 400 | Invalid media.images.height.max value. | | `ER0031` | 400 | media.images.height.max must be greater than or equal to 0. | | `ER0032` | 400 | media.images.height.max must be between 1 and 10 characters. | | `ER0033` | 400 | Invalid media.videos.count value. | | `ER0034` | 400 | media.videos.count must be greater than or equal to 0. | | `ER0035` | 400 | media.videos.count must be between 1 and 10 characters. | | `ER0036` | 400 | Invalid media.videos.count.min value. | | `ER0037` | 400 | media.videos.count.min must be between 1 and 10 characters. | | `ER0038` | 400 | Invalid media.videos.count.max value. | | `ER0039` | 400 | media.videos.count.max must be greater than or equal to 0. | | `ER0040` | 400 | media.videos.count.max must be between 1 and 10 characters. | | `ER0041` | 400 | has\_image must be 0 or 1. | | `ER0042` | 400 | has\_video must be 0 or 1. | | `ER0043` | 400 | has\_hq\_images must be 0 or 1. | | `ER0233` | 400 | is\_media\_rich must be 0 or 1. | | `ER0245` | 400 | media.videos.count.min must be greater than or equal to 0. | | `ER0250` | 400 | is\_landscape\_media must be 0 or 1. | | `ER0251` | 400 | is\_portrait\_media must be 0 or 1. | | `ER0252` | 400 | has\_multiple\_images must be 0 or 1. | | `ER0253` | 400 | has\_fullhd\_images must be 0 or 1. | | `ER0254` | 400 | has\_4k\_images must be 0 or 1. | | `ER0255` | 400 | has\_mobile\_optimized\_images must be 0 or 1. | | `ER0256` | 400 | is\_instagram\_ready must be 0 or 1. | | `ER0257` | 400 | is\_twitter\_card\_ready must be 0 or 1. | | `ER0258` | 400 | has\_consistent\_image\_sizes must be 0 or 1. | | `ER0259` | 400 | has\_thumbnail must be 0 or 1. | | `ER0260` | 400 | has\_social\_share\_image must be 0 or 1. | | `ER0261` | 400 | has\_mixed\_media must be 0 or 1. | ## Source Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0044` | 400 | Invalid source.rank.opr.min value. | | `ER0045` | 400 | source.rank.opr.min must be greater than or equal to 0. | | `ER0046` | 400 | source.rank.opr.min must be between 1 and 10 characters. | | `ER0047` | 400 | Invalid source.rank.opr.max value. | | `ER0048` | 400 | source.rank.opr.max must be greater than or equal to 0. | | `ER0049` | 400 | source.rank.opr.max must be between 1 and 10 characters. | | `ER0050` | 400 | Invalid source.id value. | | `ER0051` | 400 | source.id must be greater than or equal to 0. | | `ER0052` | 400 | source.id must be between 1 and 20 characters. | | `ER0053` | 400 | Invalid ignore.source.id value. | | `ER0054` | 400 | ignore.source.id must be greater than or equal to 0. | | `ER0055` | 400 | ignore.source.id must be between 1 and 20 characters. | | `ER0057` | 400 | source.domain must be between 1 and 255 characters. | | `ER0059` | 400 | ignore.source.domain must be between 1 and 255 characters. | | `ER0195` | 400 | is\_premium\_source must be 0 or 1. | | `ER0196` | 400 | is\_verified\_source must be 0 or 1. | | `ER0212` | 400 | Source country code not found. | | `ER0213` | 400 | Source country code not found. (ignore filter) | | `ER0214` | 400 | Source domain name not found. | | `ER0215` | 400 | Source domain name not found. (ignore filter) | | `ER0246` | 400 | source.country.code must be 2 characters. | | `ER0247` | 400 | ignore.source.country.code must be 2 characters. | ## Language Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0061` | 400 | language.code must be between 1 and 2 characters. | | `ER0063` | 400 | ignore.language.code must be between 1 and 2 characters. | | `ER0237` | 400 | No language matches the supplied code. | | `ER0239` | 400 | No language matches the supplied code. (ignore filter) | ## Author Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0064` | 400 | Invalid author.id value. | | `ER0066` | 400 | author.id must be between 1 and 20 characters. | | `ER0067` | 400 | Invalid ignore.author.id value. | | `ER0069` | 400 | ignore.author.id must be between 1 and 20 characters. | | `ER0070` | 400 | has\_author must be 0 or 1. | | `ER0071` | 400 | author.name must be between 1 and 100 characters. | | `ER0073` | 400 | ignore.author.name must be between 1 and 100 characters. | | `ER0204` | 400 | No author matches the supplied name. | | `ER0205` | 400 | No author matches the supplied name. (ignore filter) | ## Sentiment Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0074` | 400 | Invalid sentiment.title.score.min value. | | `ER0075` | 400 | sentiment.title.score.min must be between -1 and 1. | | `ER0076` | 400 | sentiment.title.score.min must be between 1 and 10 characters. | | `ER0077` | 400 | Invalid sentiment.title.score.max value. | | `ER0078` | 400 | sentiment.title.score.max must be between -1 and 1. | | `ER0079` | 400 | sentiment.title.score.max must be between 1 and 10 characters. | | `ER0080` | 400 | Invalid sentiment.title.score value. | | `ER0081` | 400 | sentiment.title.score must be between -1 and 1. | | `ER0082` | 400 | sentiment.title.score must be between 1 and 10 characters. | | `ER0083` | 400 | sentiment.title.polarity must be between 1 and 10 characters. | | `ER0084` | 400 | Invalid sentiment.body.score.min value. | | `ER0085` | 400 | sentiment.body.score.min must be between -1 and 1. | | `ER0086` | 400 | sentiment.body.score.min must be between 1 and 10 characters. | | `ER0087` | 400 | Invalid sentiment.body.score.max value. | | `ER0088` | 400 | sentiment.body.score.max must be between -1 and 1. | | `ER0089` | 400 | sentiment.body.score.max must be between 1 and 10 characters. | | `ER0090` | 400 | Invalid sentiment.body.score value. | | `ER0091` | 400 | sentiment.body.score must be between -1 and 1. | | `ER0092` | 400 | sentiment.body.score must be between 1 and 10 characters. | | `ER0093` | 400 | sentiment.body.polarity must be between 1 and 10 characters. | | `ER0094` | 400 | Invalid sentiment.overall.score.min value. | | `ER0095` | 400 | sentiment.overall.score.min must be between -1 and 1. | | `ER0096` | 400 | sentiment.overall.score.min must be between 1 and 10 characters. | | `ER0097` | 400 | Invalid sentiment.overall.score.max value. | | `ER0098` | 400 | sentiment.overall.score.max must be between -1 and 1. | | `ER0099` | 400 | sentiment.overall.score.max must be between 1 and 10 characters. | | `ER0100` | 400 | Invalid sentiment.overall.score value. | | `ER0101` | 400 | sentiment.overall.score must be between -1 and 1. | | `ER0102` | 400 | sentiment.overall.score must be between 1 and 10 characters. | | `ER0103` | 400 | sentiment.overall.polarity must be between 1 and 10 characters. | | `ER0243` | 400 | sentiment.mixed must be 0 or 1. | | `ER0244` | 400 | sentiment.consistent must be 0 or 1. | | `ER0249` | 400 | sentiment\_gap.max must be between 0 and 2. | | `ER0342` | 400 | is\_clickbait must be 0 or 1. | | `ER0343` | 400 | Invalid sentiment\_gap.min value. | | `ER0344` | 400 | sentiment\_gap.min must be between 0 and 2. | | `ER0345` | 400 | Invalid sentiment\_gap.max value. | ## Published Date Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0104` | 400 | Invalid published\_at.start value. | | `ER0105` | 400 | published\_at.start must be between 1 and 30 characters. | | `ER0106` | 400 | Invalid published\_at.end value. | | `ER0107` | 400 | published\_at.end must be between 1 and 30 characters. | | `ER0108` | 400 | published\_at must be between 1 and 30 characters. | | `ER0109` | 400 | Invalid published\_at value. | | `ER0110` | 400 | Date range exceeds the maximum of 31 days for title search. | | `ER0371` | 400 | `published_at.start` must be before `published_at.end`. The endpoint that used this code, `/v1/sources/{id}/stats`, is currently unavailable. | `ER0110` only applies when the request also searches article titles — that is, when it uses `title`, `title_starts_with`, `title_ends_with`, `title_pattern` or `query`. A title search may not span more than **31 days** of `published_at`. Split a longer period into month-sized windows and page through each one. `ER0366` means a title search used the default range of the last 31 days because no start or end date was sent. The request succeeds with HTTP `200`. Read the warning in `meta.warnings` or, for exports, the `x-query-window-clamped` header: ```json { "status": "ok", "results": [], "meta": { "warnings": [ { "code": "ER0366", "message": "published_at window defaulted to the last 31 days for title search. Pass published_at.start / published_at.end to pick a different 31-day window.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" } } ] } } ``` `ER0367` is also a **warning**, returned in the same `meta.warnings` array with HTTP `200`. It appears when one or more title terms are matched inside words rather than as whole words — see [`ER0349`](#title-filter-errors) for which terms those are. Substring matching also matches inside longer words, so `title=C++` will match a headline containing `C++17`. Quote the term (`title="C++"`) if you want it treated as an exact phrase. `ER0368` lists ignored parameter names in `meta.warnings`. The request still returns `200`, but those filters were not applied. Check for typos such as `langauge.code=en` and unsupported names such as `entity.name` or `product.name`: ```json { "meta": { "warnings": [ { "code": "ER0368", "message": "Unknown parameter(s) ignored: entity.name, langauge.code. They did not affect the result — check the spelling against the endpoint reference." } ] } } ``` The check runs against the endpoint's own parameter list, so a parameter that is valid elsewhere but not here (`sort.by` on `/v1/news/count`, `hl` on `/v1/news/raw`) is reported as well. `/v1/news/stream` and `/v1/news/ws` are not covered. ## Category Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0112` | 400 | category.id must be between 1 and 40 characters. | | `ER0115` | 400 | ignore.category.id must be between 1 and 40 characters. | | `ER0206` | 400 | No category matches the supplied ID. | | `ER0207` | 400 | No category matches the supplied ID. (ignore filter) | | `ER0241` | 404 | Category not found. | | `ER0242` | 404 | Category not found. | ## Topic Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0117` | 400 | topic.id must be between 1 and 80 characters. | | `ER0120` | 400 | ignore.topic.id must be between 1 and 80 characters. | | `ER0149` | 404 | Topic not found. | | `ER0208` | 400 | No topic matches the supplied ID. | | `ER0209` | 400 | No topic matches the supplied ID. (ignore filter) | ## Industry Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0121` | 400 | Invalid industry.id value. | | `ER0123` | 400 | industry.id must be between 1 and 20 characters. | | `ER0124` | 400 | Invalid ignore.industry.id value. | | `ER0126` | 400 | ignore.industry.id must be between 1 and 20 characters. | | `ER0150` | 404 | Industry not found. | | `ER0210` | 400 | No industry matches the supplied ID. | | `ER0211` | 400 | No industry matches the supplied ID. (ignore filter) | ## Entity Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0127` | 400 | Invalid entity.id value. | | `ER0128` | 400 | entity.id must be between 1 and 30 characters. | | `ER0129` | 400 | Invalid ignore.entity.id value. | | `ER0130` | 400 | ignore.entity.id must be between 1 and 120 characters. | | `ER0132` | 400 | person.name must be between 1 and 120 characters. | | `ER0134` | 400 | ignore.person.name must be between 1 and 120 characters. | | `ER0136` | 400 | location.name must be between 1 and 120 characters. | | `ER0138` | 400 | ignore.location.name must be between 1 and 120 characters. | | `ER0140` | 400 | organization.name must be between 1 and 120 characters. | | `ER0142` | 400 | ignore.organization.name must be between 1 and 120 characters. | | `ER0144` | 400 | brand.name must be between 1 and 120 characters. | | `ER0146` | 400 | ignore.brand.name must be between 1 and 120 characters. | | `ER0148` | 400 | disaster.name must be between 1 and 120 characters. | | `ER0151` | 404 | Entity not found. | | `ER0152` | 400 | disease.name must be between 1 and 120 characters. | | `ER0154` | 400 | ignore.disease.name must be between 1 and 120 characters. | | `ER0156` | 400 | event.name must be between 1 and 120 characters. | | `ER0158` | 400 | ignore.event.name must be between 1 and 120 characters. | | `ER0160` | 400 | sport.name must be between 1 and 120 characters. | | `ER0162` | 400 | ignore.sport.name must be between 1 and 120 characters. | | `ER0216` | 400 | No person matches the supplied name. | | `ER0217` | 400 | No person matches the supplied name. (ignore filter) | | `ER0218` | 400 | No location matches the supplied name. | | `ER0219` | 400 | No location matches the supplied name. (ignore filter) | | `ER0220` | 400 | No organization matches the supplied name. | | `ER0221` | 400 | No organization matches the supplied name. (ignore filter) | | `ER0222` | 400 | No brand matches the supplied name. | | `ER0223` | 400 | No brand matches the supplied name. (ignore filter) | | `ER0224` | 400 | No disaster matches the supplied name. | | `ER0225` | 400 | No disaster matches the supplied name. (ignore filter) | | `ER0226` | 400 | No disease matches the supplied name. | | `ER0227` | 400 | No disease matches the supplied name. (ignore filter) | | `ER0228` | 400 | No event matches the supplied name. | | `ER0229` | 400 | No event matches the supplied name. (ignore filter) | | `ER0248` | 400 | ignore.disaster.name must be between 1 and 120 characters. | | `ER0290` | 400 | entity.sentiment.polarity must be positive, negative or neutral. | | `ER0291` | 400 | entity.sentiment.score.min must be a number between -1 and 1. | | `ER0292` | 400 | entity.sentiment.score.max must be a number between -1 and 1. | | `ER0293` | 400 | entity.sentiment.\* requires an entity selector: entity.id, person.name, organization.name, location.name, brand.name, event.name, disease.name, disaster.name or sport.name. | | `ER0294` | 400 | source.bias must be one of: left, center, right. | | `ER0295` | 400 | ignore.source.bias must be one of: left, center, right. | | `ER0296` | 400 | sentiment.title.polarity must be positive, negative or neutral. | | `ER0297` | 400 | sentiment.body.polarity must be positive, negative or neutral. | | `ER0298` | 400 | sentiment.overall.polarity must be positive, negative or neutral. | | `ER0299` | 400 | per\_page must be at least 1. | | `ER0307` | 400 | percentile must be an integer between 1 and 100. | | `ER0308` | 400 | time\_bucket must be one of: hour, day, week, month. | | `ER0309` | 400 | sort.by must be one of the documented sort fields. | | `ER0314` | 400 | sort.order must be asc or desc. | Entity sentiment filters describe the tone of coverage about a particular subject. Also send a selector such as `entity.id` or `organization.name` to identify that subject. Without one, the API returns `ER0293`. ## Breaking News Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0185` | 400 | Invalid is\_breaking value. | | `ER0186` | 400 | is\_breaking must be 0 or 1. | ## Read Time Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0187` | 400 | Invalid read\_time value. | | `ER0188` | 400 | read\_time must be between 0 and 1000 minutes. | | `ER0189` | 400 | Invalid read\_time.min value. | | `ER0190` | 400 | read\_time.min must be between 0 and 1000 minutes. | | `ER0191` | 400 | Invalid read\_time.max value. | | `ER0192` | 400 | read\_time.max must be between 0 and 1000 minutes. | | `ER0193` | 400 | is\_long\_read must be 0 or 1. | | `ER0194` | 400 | is\_short\_read must be 0 or 1. | | `ER0302` | 400 | is\_deep\_dive must be 0 or 1. | | `ER0347` | 400 | is\_quick\_read must be 0 or 1. | | `ER0348` | 400 | is\_medium\_read must be 0 or 1. | The same `ER0302` code (also `400`) is reused by the [webhooks](/platform/news-api/webhooks) endpoints with a different message — "Invalid or disallowed webhook URL." Both are `400`; distinguish them by which endpoint you called and by the message text. ## Pagination Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0170` | 400 | 'Per page' is not a number. | | `ER0171` | 400 | Limit is out of range. Your plan allows up to N results per page. (`per_page` must be 250 or less; 50 on Starter, 10 on Free) | | `ER0172` | 400 | Page is not a number. | | `ER0173` | 400 | Free plan is limited to the first 5 pages. Upgrade your subscription plan to paginate further. | ## Readability Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0262` | 400 | Invalid readability.fk\_grade value. | | `ER0263` | 400 | readability.fk\_grade must be between 0 and 30. | | `ER0264` | 400 | Invalid readability.fk\_grade.min value. | | `ER0265` | 400 | readability.fk\_grade.min must be between 0 and 30. | | `ER0266` | 400 | Invalid readability.fk\_grade.max value. | | `ER0267` | 400 | readability.fk\_grade.max must be between 0 and 30. | | `ER0268` | 400 | Invalid readability.ease value. | | `ER0269` | 400 | readability.ease must be between 0 and 100. | | `ER0270` | 400 | Invalid readability.ease.min value. | | `ER0271` | 400 | readability.ease.min must be between 0 and 100. | | `ER0272` | 400 | Invalid readability.ease.max value. | | `ER0273` | 400 | readability.ease.max must be between 0 and 100. | | `ER0274` | 400 | Invalid readability.ari value. | | `ER0275` | 400 | readability.ari must be between 0 and 30. | | `ER0276` | 400 | Invalid readability.ari.min value. | | `ER0277` | 400 | readability.ari.min must be between 0 and 30. | | `ER0278` | 400 | Invalid readability.ari.max value. | | `ER0279` | 400 | readability.ari.max must be between 0 and 30. | | `ER0280` | 400 | readability.difficulty must be one of: beginner, intermediate, advanced, expert. | | `ER0281` | 400 | readability.audience must be one of: children, general, professional, academic. | | `ER0282` | 400 | Invalid readability.age value. | | `ER0283` | 400 | readability.age must be between 6 and 22. | | `ER0284` | 400 | Invalid readability.age.min value. | | `ER0285` | 400 | readability.age.min must be between 6 and 22. | | `ER0286` | 400 | Invalid readability.age.max value. | | `ER0287` | 400 | readability.age.max must be between 6 and 22. | | `ER0288` | 400 | is\_easy\_read must be 0 or 1. | | `ER0289` | 400 | is\_difficult\_read must be 0 or 1. | ## Quality Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0303` | 400 | is\_high\_quality must be 0 or 1. | The same `ER0303` code (also `400`) is reused by the [webhooks](/platform/news-api/webhooks) `GET`, `PATCH` and `DELETE` `/{id}` endpoints with a different message — "Invalid webhook ID." Both are `400`; distinguish them by which endpoint you called and by the message text. ## Field Selection Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0300` | 400 | `fl` must be a string. | | `ER0301` | 400 | `fl` cannot be empty. | ## Facet Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0310` | 400 | `facet.field` is required when facet=true. | | `ER0311` | 400 | `facet.field` cannot be empty. | | `ER0312` | 400 | `facet.field` cannot contain more than 5 fields. | | `ER0313` | 400 | Invalid field in `facet.field`. | | `ER0330` | 400 | `facet.range.field` is required when facet.range=true. | | `ER0331` | 400 | Invalid field in `facet.range.field`. | | `ER0332` | 400 | `facet.range.start` and `facet.range.end` are required for range faceting. | | `ER0333` | 400 | `facet.range.start` / `facet.range.end` must be a date like 2026-08-01 (or a number for numeric fields). | | `ER0334` | 400 | `facet.range.gap` must look like 1DAY, 2WEEKS, 1MONTH (or a positive number for numeric fields). | ## Highlight Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0320` | 400 | `hl.fl` cannot be empty when hl=true. | | `ER0321` | 400 | `hl.fl` cannot contain more than 5 fields. | | `ER0322` | 400 | Invalid field in `hl.fl`. | ## Location Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0400` | 400 | location.bbox must be 4 comma-separated values: minLat,maxLat,minLng,maxLng. | | `ER0401` | 400 | location.bbox latitudes must be between -90 and 90. | | `ER0402` | 400 | location.bbox longitudes must be between -180 and 180. | | `ER0403` | 400 | location.bbox minLat must be less than or equal to maxLat. | | `ER0404` | 400 | location.bbox minLng must be less than or equal to maxLng. | | `ER0405` | 400 | has\_location\_geo must be 0 or 1. | | `ER0406` | 400 | location.lat and location.lng are required when using radius filters. | | `ER0407` | 400 | location.lat must be a valid latitude between -90 and 90. | | `ER0408` | 400 | location.lng must be a valid longitude between -180 and 180. | | `ER0409` | 400 | location.radius must be a positive number up to 20000 km. | | `ER0410` | 400 | location.radius.min must be a non-negative number up to 20000 km. | | `ER0411` | 400 | location.radius.min must be less than location.radius. | | `ER0412` | 400 | At least one of location.radius or location.radius.min must be provided. | ## Trends Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0350` | 400 | `field` is required. | | `ER0352` | 400 | `compare_window` is required when compare=true or has invalid format. | | `ER0353` | 400 | Invalid date range. Maximum allowed range is 30 days for trends endpoint. | | `ER0354` | 400 | `sort` must be one of the allowed trends sort fields (`change` and `trending_score` need period comparison). | | `ER0355` | 400 | `order` must be asc or desc. | ## Event Type Filter Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0501` | 400 | Invalid event.type value. | | `ER0502` | 400 | Invalid event type(s). See /v1/news/event-types for valid types. | | `ER0503` | 400 | Invalid event.category. Valid categories: business, society, environment. | | `ER0504` | 400 | Invalid ignore.event.type(s). | ## Suggest Errors | Error Code | HTTP Status | Description | |------------|-------------|-----------------------------| | `ER0346` | 400 | The `prefix` query parameter is required. | ## SSE Stream Errors `ER0360` and `ER0363` are HTTP errors returned before the stream opens. Other codes arrive as SSE `error` events (`event: error`) after a successful `200` connection. The stream then closes. Reconnect with `Last-Event-ID` to continue from the last article received. | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0360` | 429 | Maximum SSE connections reached for your plan. | | `ER0361` | 200 (stream event) | API key revoked — the stream was closed because the key was revoked. | | `ER0362` | 200 (stream event) | Stream lifetime exceeded (6h max session) — reconnect to continue. | | `ER0363` | 400 | Invalid `stream.max_age` — must be a positive integer number of minutes. | | `ER0364` | 200 (stream event) | SSE session terminated by API — closed via `DELETE /v1/news/stream/sessions` or key rotation. | ## WebSocket Stream Errors Delivered over the [WebSocket stream](/platform/news-api/websocket-stream) as a JSON message with `type: "error"` on the already-open connection, after which the socket closes. | Error Code | Description | |------------|-------------| | `ER0365` | Connection replaced by a newer connection (takeover) — a second WebSocket opened with the same API key took over, closing this one. | ## Local News Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0420` | 400 | Invalid insights value. | | `ER0421` | 400 | Could not geocode place. Try a more specific name, add `country`, or pass `lat`/`lng`. | | `ER0422` | 400 | `sort` must be one of: distance, published\_at, relevance. | | `ER0423` | 400 | `ranking` must be one of: balanced, proximity, authority, fresh. | | `ER0424` | 400 | A `w.*` ranking weight must be a non-negative number. | ## Source Stats Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0370` | 404 | Source not found. **Not reachable** — `/v1/sources/{id}/stats` is currently disabled and returns `404 ER0182`. | ## Webhook Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0302` | 400 | Invalid or disallowed webhook URL. (Same code is used by the read-time `is_deep_dive` filter.) | | `ER0303` | 400 | Invalid webhook ID. (Same code is used by the `is_high_quality` quality filter.) | | `ER0304` | 404 | Webhook not found. | | `ER0305` | 400 | Invalid status. Allowed values listed in the error message. | | `ER0306` | 400 | `filters` must be an object (or contains invalid filters). | ## Fact-Check Errors | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0700` | 400 | Provide one of the parameters: id, text, or claim. | | `ER0701` | 400 | text must be between 100 and 10000 characters. | | `ER0702` | 404 | Article with the provided id was not found. | | `ER0703` | 502 | Fact-check service is temporarily unavailable. Please try again later. | | `ER0704` | 400 | id must be a valid integer. | | `ER0705` | 400 | claim must be between 5 and 500 characters. | | `ER0706` | 403 | Fact-check is not available on the free plan. Please upgrade your subscription. | ## Query Parameter Errors The `query` parameter uses `ER0701`–`ER0706` with HTTP `400` for invalid queries. Fact Check uses some of the same codes with `404`, `502` or `403`. Check the HTTP status and message along with the code. | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0701` | 400 | Query could not be parsed, is empty, is not a string, or produced no condition. | | `ER0702` | 400 | Unknown field, or a {{ }} block was used on a field other than `entity`. | | `ER0703` | 400 | The query is too long, contains too many conditions, or has too many nested groups. | | `ER0704` | 400 | Unsupported syntax — regex, fuzzy (`~`), boost (`^`) and wildcard are not supported. | | `ER0705` | 400 | A field value failed validation (invalid number, enum, date, range, coordinates, etc.). | | `ER0706` | 400 | Range syntax is not supported for this field. | | `ER0710` | 400 | Invalid condition inside an entity {{ }} block (bad id, field, or sentiment value). | | `ER0711` | 400 | Empty entity block {{}}. | | `ER0712` | 400 | Malformed entity block — check {{ }} pairing. | ## Features that require a paid plan {#plan-gates} A feature unavailable on Free returns `403 ER0706`. These requests are not billed: | Feature | Refused for | Message | |---------|-------------|---------| | Export formats (`export=csv\|tsv\|xml\|rss\|xlsx\|parquet\|jsonl`) | Free | Export formats are not available on the free plan. Please upgrade your subscription. | | [Trends](/platform/news-api/trends) (`/v1/news/trends`) | Free | Trends API is not available on the free plan. Please upgrade your subscription. | | [Fact Check](/platform/news-api/fact-check) (`/v1/fact-check`) | Free | Fact-check is not available on the free plan. Please upgrade your subscription. | | [MCP server](/platform/news-api/tools) | Free | MCP server is not available on the free plan. Please upgrade your subscription. | | [`prompt`](/platform/news-api/filters#prompt) parameter | Free, Starter | Prompt search is not available on your plan. Please upgrade your subscription. | `export=json` and requests without `export` work on every plan — only the alternative formats are gated. ## Prompt Errors Returned by the [`prompt`](/platform/news-api/filters#prompt) parameter while it is being translated into filters — before the search itself runs. `ER0706` carries several meanings on this page: the plan gates above (`403`), a `query` range error (`400`) and the `prompt` plan gate (`403`). Branch on the HTTP status **and** the message, never on the code alone — a `403 ER0706` on a request that sent `prompt` means the plan does not include natural-language search. | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0706` | 403 | Prompt search is not available on your plan. Please upgrade your subscription. | | `ER0800` | 400 | prompt must be a string between 3 and 500 characters. | | `ER0801` | 502 | Prompt understanding service is temporarily unavailable. Please try again later. | | `ER0802` | 400 | prompt could not be translated into any filter. Please be more specific. | `ER0802` also appears when every parameter the prompt produced was discarded — because you passed those parameters explicitly, or because the endpoint does not support them. The `meta.prompt.ignored` array of a successful request shows the same reasons; see [Reading the prompt interpretation](/platform/news-api/ai/natural-language-search). An invalid key, exhausted points or a spending limit returns the usual `ER0201`/`ER0202`, `ER0176` or `ER0177` without a translation charge. A plan restriction (`ER0706`) or failed translation (`ER0801`) is also free. On the WebSocket stream (`/v1/news/ws`) these codes do not arrive as an HTTP status. The server sends an error message and then closes the socket with code `4001`: ```json { "type": "error", "code": "ER0800", "message": "prompt must be a string between 3 and 500 characters." } ``` ## MCP Server Errors The [MCP server](/platform/news-api/ai/mcp-server) (`https://mcp.apitube.io/`) uses the same API keys as the REST API and returns the same authentication errors: * `ER0201`/`ER0202`: missing or invalid key. * `ER0230`: expired key. * `ER0601`/`ER0602`: IP or referrer restrictions. * `ER0603`: key without the required permissions. * `ER0706`: access blocked on the Free plan. It also returns one error of its own: | Error Code | HTTP Status | Description | |------------|-------------|-------------| | `ER0900` | 503 | The service could not check your API key. Retry in a few seconds. | `ER0900` means the server could not check your key. Wait a moment and retry; you do not need to replace it. The MCP health endpoint (`GET /ping`) can return the same code when the service is unavailable. --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/haskell/http-conduit-client.md description: Call the APITube News API from Haskell using HTTP-conduit --- # HTTP-conduit integration ```haskell {-# LANGUAGE OverloadedStrings #-} -- Install: cabal install http-conduit import Network.HTTP.Conduit import qualified Data.ByteString.Lazy.Char8 as LBS makeRequest :: IO () makeRequest = do let url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" manager <- newManager tlsManagerSettings request <- parseRequest url response <- httpLbs request manager case responseStatus response of status | statusIsSuccessful status -> LBS.putStrLn $ responseBody response | statusIsClientError status -> putStrLn $ "Client Error: " ++ show (statusCode status) | statusIsServerError status -> putStrLn $ "Server Error: " ++ show (statusCode status) | otherwise -> putStrLn $ "HTTP Request Error: Unexpected status code " ++ show (statusCode status) main :: IO () main = makeRequest ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/crystal/http-client.md' description: 'Call the APITube News API from Crystal using the built-in HTTP::Client' --- # HTTP::Client integration ```crystal require "http/client" require "uri" params = URI::Params.encode({"per_page" => "50", "api_key" => "YOUR_API_KEY"}) response = HTTP::Client.get("https://api.apitube.io/v1/news/everything?#{params}") if response.status_code == 200 puts response.body else puts "Error: #{response.status_code}" end ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/perl/http-tiny-client.md description: 'Call the APITube News API from Perl using the core HTTP::Tiny module' --- # HTTP::Tiny integration ```perl #!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; use JSON; my $http = HTTP::Tiny->new(timeout => 30); my $url = 'https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY'; my $response = $http->get($url); if ($response->{success}) { my $data = decode_json($response->{content}); print JSON->new->pretty->encode($data); } else { print "HTTP Request Error: $response->{status} $response->{reason}\n"; } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/julia/http-client.md' description: Call the APITube News API from Julia using the HTTP.jl package --- # HTTP.jl integration ```julia using HTTP using JSON response = HTTP.get("https://api.apitube.io/v1/news/everything", query = [ "per_page" => "50", "api_key" => "YOUR_API_KEY" ]) println(String(response.body)) ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/ruby/httparty-client.md' description: Call the APITube News API from Ruby using HTTParty --- # HTTParty integration ```ruby # Install: gem install httparty require 'httparty' response = HTTParty.get('https://api.apitube.io/v1/news/everything', query: { per_page: 10, api_key: 'YOUR_API_KEY' }) if response.success? puts response.body else puts "Error: #{response.code}" end ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/erlang/httpc-client.md' description: >- Call the APITube News API from Erlang using the built-in HTTPC module for HTTP requests --- # HTTPC integration ```erlang -module(my_controller). -export([make_request/0]). make_request() -> Url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY", Options = [], {ok, {_, _, Response}} = httpc:request(get, {Url, Options}, [], []), handle_response(Response). handle_response({_, _, Body}) -> % Print the response body io:format("Response: ~s~n", [Body]); handle_response({_, StatusCode, _}) when StatusCode >= 400, StatusCode < 500 -> % Client error io:format("Client Error: ~p~n", [StatusCode]); handle_response({_, StatusCode, _}) when StatusCode >= 500 -> % Server error io:format("Server Error: ~p~n", [StatusCode]); handle_response(_) -> % Other errors io:format("HTTP Request Error~n"). ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/csharp/http-client.md' description: >- Call the APITube News API from C# using the HttpClient class from the .NET framework --- # HttpClient integration ```cs using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { HttpClient client = new HttpClient(); var response = await client.GetAsync("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"); if (response.IsSuccessStatusCode) { string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } else { Console.WriteLine($"Error: {response.StatusCode}"); } } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/fsharp/http-client.md' description: Call the APITube News API from F# using the .NET HttpClient --- # HttpClient integration ```fsharp open System open System.Net.Http let fetchNews () = async { use client = new HttpClient() let url = "https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY" let! response = client.GetStringAsync(url) |> Async.AwaitTask printfn "%s" response } fetchNews () |> Async.RunSynchronously ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/java/http-client.md' description: Call the APITube News API from Java 11 or later using HttpClient --- # HttpClient integration ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class Main { public static void main(String[] args) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY")) .build(); client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body) .thenAccept(System.out::println) .join(); } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/nim/http-client.md' description: Call the APITube News API from Nim using the std/httpclient module --- # HttpClient integration ```nim import std/[httpclient, uri] let client = newHttpClient() let url = "https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY" let response = client.getContent(url) echo response ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/shell/httpie-client.md' description: Call the APITube News API from your terminal with HTTPie. --- # HTTPie integration ```shell # Install: pip install httpie (or: brew install httpie) http GET 'https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY' ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/elixir/http-poison-client.md description: Call the APITube News API from Elixir using HTTPoison --- # HTTPoison integration ```elixir # Install: add {:httpoison, "~> 2.0"} to mix.exs deps defmodule Example do def fetch_data do url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" case HTTPoison.get(url) do {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> IO.puts(body) {:ok, %HTTPoison.Response{status_code: status_code}} -> IO.puts("Error: #{status_code}") {:error, %HTTPoison.Error{reason: reason}} -> IO.puts("Error: #{reason}") end end end Example.fetch_data() ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/java/http-request-client.md description: >- Call the APITube News API from Java using the HttpRequest class for building HTTP requests --- # HttpRequest integration ```java HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY")) .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/groovy/http-url-connection-client.md description: Call the APITube News API from Groovy using the standard HttpURLConnection --- # HttpURLConnection integration ```groovy def url = new URL("https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY") def connection = url.openConnection() as HttpURLConnection connection.requestMethod = "GET" if (connection.responseCode == 200) { println connection.inputStream.text } else { println "Error: ${connection.responseCode}" } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/r/httr-client.md' description: >- Call the APITube News API from R using the httr package for HTTP requests and responses --- # HTTR integration ```r # Install: install.packages("httr") library(httr) url <- "https://api.apitube.io/v1/news/everything" response <- GET(url, query = list(per_page=10, api_key = "YOUR_API_KEY")) if (status_code(response) == 200) { content <- content(response, "text") print(content) } else { print(paste("Error:", status_code(response))) } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/industry-examples.md description: Examples of using industry parameters in News API --- # Industry Query Examples ## Find news about one industry {#search-for-news-in-a-specific-industry} Find articles about Financial Services (ID 400). ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400") 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) } ``` ```java [Java] 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/everything?industry.id=400&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400 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/everything ``` ::: ## Find news about several industries {#search-for-news-across-multiple-industries} Find articles from several related industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400,438&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400,438", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400,438") 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) } ``` ```java [Java] 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/everything?industry.id=400,438&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400,438 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/everything ``` ::: ## Follow industry coverage {#industry-sector-performance-tracking} Follow coverage of several industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400,438") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400,438&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Find innovation across industries {#cross-industry-innovation-analysis} Find positive innovation news across industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=1041,1137&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "1041,1137", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "1041,1137", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "1041,1137", "title" => "innovation", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "1041,1137") q.Set("title", "innovation") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?industry.id=1041,1137&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=1041,1137&title=innovation&sentiment.overall.polarity=positive 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/everything ``` ::: ## Filter industry news by sentiment {#industry-specific-sentiment-analysis} Follow sentiment in military and defence news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=25&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "25", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "25", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "25", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "25") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?industry.id=25&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=25&sort.by=sentiment.overall.score 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/everything ``` ::: ## Follow changes in an industry {#industry-disruption-monitoring} Follow news about changes in energy industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=334,326&title=disruption,revolution,transform&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "334,326", "title": "disruption,revolution,transform", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "334,326", "title": "disruption,revolution,transform", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "334,326", "title" => "disruption,revolution,transform", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "334,326") q.Set("title", "disruption,revolution,transform") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?industry.id=334,326&title=disruption,revolution,transform&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=334,326&title=disruption,revolution,transform&sort.by=published_at 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/everything ``` ::: ## Find industry regulation news {#industry-regulation-impact-analysis} Find news about regulation affecting selected industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400,1041&title=regulation,compliance,law&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400,1041", "title": "regulation,compliance,law", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,1041", "title": "regulation,compliance,law", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,1041", "title" => "regulation,compliance,law", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400,1041") q.Set("title", "regulation,compliance,law") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?industry.id=400,1041&title=regulation,compliance,law&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400,1041&title=regulation,compliance,law&sort.by=published_at&sort.order=desc 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/insights.md' description: >- Find news trends, count matching articles and check claims against recent news. --- # Insights endpoints Use insights endpoints to get trends, article counts or fact-check results from the same news archive as the [article endpoints](/platform/news-api/articles). They are useful for dashboards, monitoring and research when you do not need the full articles. ## Which one do I need? | You want | Endpoint | Cost | Guide | |:---------|:---------|:-----|:------| | A ranking of who or what is being talked about | `GET`/`POST /v1/news/trends` | 1 point | [Trends](/platform/news-api/trends) | | Only the number of matching articles | `GET /v1/news/count` | 1 point | [Count articles](/platform/news-api/count) | | A verdict on a factual claim, with evidence | `POST /v1/fact-check` | 5 points | [Fact check](/platform/news-api/fact-check) | ## Trends — count articles by subject {#trends-—-aggregate-instead-of-list} Choose a field for [`/v1/news/trends`](/platform/news-api/trends) to see its most common values and their article counts and percentages. You can also request growth rates, trending scores and comparisons with a previous period. For example, find out which entities appear most often in English-language news: ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/trends?field=entity.id&language.code=en" ``` Use any filter from [`/v1/news/everything`](/platform/news-api/filters#parameters) to limit the analysis to a specific industry, country or date range. ## Count — get the total without downloading articles {#count-—-the-total-without-the-payload} Use [`/v1/news/count`](/platform/news-api/count) to get the number of matching articles without downloading them. It supports the same search filters. Result options such as `page`, `per_page`, `sort.*`, `export` and `fl` have no effect. Check the count before a large export, when choosing a sample, or when displaying a total on a dashboard. ## Fact check — check claims against news {#fact-check-—-a-verdict-grounded-in-articles} Use [`/v1/fact-check`](/platform/news-api/fact-check) to check a claim against recent news. Each result includes a verdict on an 8-level scale, a confidence score, a short explanation and articles that support or challenge the claim. Submit a statement, full article text or the `id` of an article in the archive. ::: warning Paid feature Fact Check requires a paid plan. Each request costs **5 points**. You can send up to **10 requests per minute**, subject to your account's overall rate limit. ::: ## Next steps * Chart article counts: [Build a news dashboard with article counts](/platform/news-api/common-workflows/recipes/faceted-dashboard) * Watch one company's coverage over time: [Monitor a company](/platform/news-api/common-workflows/recipes/company-monitoring) * Check what a request costs you: [Balance and usage](/platform/news-api/balance) --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/getting-started.md' description: >- Learn how to integrate APITube News API into your application using 30+ programming languages and frameworks --- # Getting Started with Integrations Call the News API from any application that can send HTTP requests. These guides include examples for 30+ languages and frameworks. ## Prerequisites 1. [Sign up](https://apitube.io/#sign-up) and get your API key 2. Review the [Authentication](/platform/news-api/authentication) page to learn how to pass your API key 3. Check the [Endpoints](/platform/news-api/endpoints) and [Parameters](/platform/news-api/filters#parameters) pages for available options ## Quick Example ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/everything?per_page=10" ``` ## Available Integrations ### Streaming, AI & Automation * [Server-Sent Events (SSE Stream)](/platform/news-api/sse-stream) — real-time news streaming * [MCP Server](/platform/news-api/ai/mcp-server) — AI assistant integration * [n8n](/platform/news-api/integrations/n8n) — workflow automation (no-code) * [Zapier](/platform/news-api/integrations/zapier) — workflow automation (8,000+ integrations) * [Make](/platform/news-api/integrations/make) — visual automation scenarios ## All languages [Code examples](/platform/news-api/integrations/code-examples) lists 32 languages with their HTTP clients and frameworks — cURL, Python, Node.js, PHP, Java, Go, Ruby, C#, Rust, Swift and more. Each page shows the same request so you can compare clients. Choose a language once, and code samples on other pages will open on that language's tab. --- --- url: 'https://docs.apitube.io/platform/news-api/query-builder.md' description: >- Build a News API request in the browser — pick an endpoint, set filters, then copy the generated URL or cURL command. --- # Interactive Query Builder Choose an endpoint and filters to build a request URL and cURL command. Copy the result, or add your API key to run the request from this page. ## How to use the query builder 1. **Pick an endpoint.** For Story, Category, Topic, Industry and Entity, fill in the extra path field. **Run** stays disabled until you replace the `{placeholder}`. 2. **Set parameters.** Browse the groups or search by label or API name, such as `sentiment` or `source.rank`. 3. **Review your filters.** The row below the header shows each active parameter and its value. Click one to remove it, or choose **Clear all**. 4. **Copy or run.** Use **Copy URL**, **Copy cURL** or **Run**. Run opens a new tab. Your key is saved in this browser and sent only to `api.apitube.io`. Start from a preset for breaking news, technology companies, finance or trending entities, then adjust the filters. ## What the generated URL contains The builder shows each parameter's API name next to its label. For example, **Min score** is `sentiment.overall.score.min`, and **Min rank (OPR)** is `source.rank.opr.min`. Enabled boolean fields use `1`. Empty fields are left out of the URL. The builder shows only options supported by the selected endpoint. **Trends** appears for `/v1/news/trends`, and **Article lookup** for `/v1/news/article`. Trends has its own sorting and pagination options, so article options such as `sort.by`, `sort.order`, `page`, `fl`, `export`, faceting and highlighting are hidden there. ## Parameter syntax worth knowing **Most list filters accept up to three values.** This applies to `source.domain`, `language.code`, `category.id`, `topic.id`, `industry.id`, `entity.id`, `source.id`, `source.country.code`, `*.name` and their `ignore.*` versions. Extra values are ignored without an error. The article endpoint's `id` accepts up to 100 IDs. **Title searches are limited to a 31-day window.** `title`, `title_pattern`, `title_starts_with`, `title_ends_with` and `query` may not span more than 31 days of `published_at` on any plan. A wider explicit range returns `400 ER0110`; no range at all searches the last 31 days and reports `ER0366` in `meta.warnings`. **`title` supports phrases with proximity.** `"climate change"~2` matches the two words within two positions of each other. `title_pattern` is a plain substring match, not a regular expression — `^`, `.`, `*` and `|` are treated as literal characters. **Use `query` to combine conditions.** It supports `AND`, `OR`, `NOT`, parentheses, `field:value`, quoted phrases, ranges `[a TO b]` and entity blocks. It combines with other filters through `AND`. Invalid syntax returns `ER0701`–`ER0712`. See [advanced query syntax](/platform/news-api/filters#parameters). **Dates take `YYYY-MM-DD` or ISO 8601.** `2024-01-15` and `2024-01-15T10:30:00Z` are both accepted for `published_at`, `published_at.start` and `published_at.end`. **`per_page` is capped by plan.** The parameter accepts 1–250, but Free is limited to 10, Starter to 50 and Basic to 200; asking for more returns `400 ER0171`. The Free plan also cannot go past page 5 (`ER0173`). On `/v1/news/trends` the ceiling is 100. **Source rank uses whole numbers from 0 to 10.** Decimal values are rounded down: `source.rank.opr.min=0.7` becomes `0`. **Premium only** sets `source.rank.opr.min=6`. **Verified only** sets `source.rank.opr.min=5` and `is_duplicate=0`. **Turn on facets or highlighting before choosing their fields.** `facet=1`, `facet.range=1` and `hl=1` enable these features. Without the flag, selecting `facet.field` or `hl.fl` alone has no effect. The builder's checkboxes set the flags for you. ## Running the generated query in code Copy the URL from the builder and drop it into your client of choice. ```javascript const url = 'https://api.apitube.io/v1/news/everything?title=AI&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY'; const response = await fetch(url); const data = await response.json(); console.log(data.results.length); ``` ```python import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) data = response.json() ``` ```bash curl "https://api.apitube.io/v1/news/everything?title=AI&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` In production, keep your key on your server and send it in the `X-API-Key` header. See [Authentication](/platform/news-api/authentication). ## Related * [Search articles](/platform/news-api/everything) — the full parameter reference behind every field in the builder. * [All endpoints](/platform/news-api/endpoints) — which endpoint answers which question. * [HTTP response codes](/platform/news-api/http-response-codes) — what each error code from a generated request means. * [Integration guides](/platform/news-api/integrations/getting-started) — the same request in 25+ languages and frameworks. --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/powershell/client.md' description: Call the APITube News API from PowerShell with Invoke-RestMethod. --- # Integration ```powershell $url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" try { $response = Invoke-RestMethod -Uri $url -Method Get $response | ConvertTo-Json } catch { Write-Error "Error: $_" } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/reference/journalists.md' description: Directory of journalists with their outlets and coverage activity --- # Journalists Search journalist profiles by name. Each profile lists publishing `outlets`, a `coverage` summary of activity and subjects, and recent articles. Bylines with the same name are grouped in one profile. ::: warning Profiles can combine different authors Profiles use exact name matches. Different people with the same name, or generic bylines such as `admin` and `Redaktion`, may appear in one profile. ::: ::: tip Added in 1.0.42 Full response field definitions are in [API Response Structure](/platform/news-api/response-structure#reference-endpoints-response-structure). See also the [Find journalists by topic](/platform/news-api/common-workflows/recipes/journalists-by-beat) recipe. ::: ## Endpoints ``` GET /v1/journalists # list & search GET /v1/journalists/{id} # single journalist profile ``` Send your API key in the `X-API-Key` header or `api_key` URL parameter. ## List & search ``` GET /v1/journalists ``` ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `name` | string | No | Filter by journalist name (substring match). | | `page` | integer | No | Page number (default `1`). | | `per_page` | integer | No | Results per page (default `100`, max `250`; the plan ceiling applies — Free 10, Starter 50, Basic 200). | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ### Example ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/journalists?name=Alex&per_page=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/journalists", params={"name": "Alex", "per_page": 5, "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ name: "Alex", per_page: "5", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/journalists?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["name" => "Alex", "per_page" => 5, "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/journalists?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/journalists") q := u.Query() q.Set("name", "Alex") q.Set("per_page", "5") 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) } ``` ```java [Java] 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/journalists?name=Alex&per_page=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/journalists?name=Alex&per_page=5 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/everything ``` ::: ```json { "status": "ok", "limit": 5, "page": 1, "has_next_pages": true, "results": [ { "id": 15898, "name": "Alex Weiner", "outlets": [ { "id": 354, "name": "ktar.com", "domain": "ktar.com" }, { "id": 1277, "name": "arizonasports.com", "domain": "arizonasports.com" } ], "outlet_count": 2, "links": { "self": "https://api.apitube.io/v1/journalists/15898", "articles": "https://api.apitube.io/v1/news/everything?author.id=15898" } } ] } ``` ## Journalist profile ``` GET /v1/journalists/{id} ``` Returns a journalist with the `outlets` they publish under (merged by name, capped at 500 records), a `coverage` block, and `recent_articles`. `recent_articles` contains the **5 latest** articles, with all fields from `/v1/news/everything`, including `body` and `entities`. These fields can make the response large. ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `coverage` | string | No | Set to `false` to omit the `coverage` block. | | `api_key` | string | Yes\* | Your API key. | ```json { "id": 15898, "name": "Alex Weiner", "outlets": [ { "id": 1277, "name": "arizonasports.com", "domain": "arizonasports.com" }, { "id": 354, "name": "ktar.com", "domain": "ktar.com" } ], "links": { "self": "...", "articles": "..." }, "coverage": { "article_count": 265, "first_seen": "2025-06-24", "last_seen": "2026-05-22", "sentiment": { "positive": 61, "neutral": 0, "negative": 30 }, "momentum": { "last_30_days": 0, "previous_30_days": 0, "change_pct": null }, "timeline": [ { "period": "2025-06-01", "count": 1 } ], "top_topics": [ { "id": "industry.financial_news", "name": "Finance Industry News", "count": 91 } ], "top_entities": [ { "id": 1480590, "name": "University of Arizona", "count": 248 } ], "top_countries": [ { "id": 102, "name": "United States", "code": "us", "count": 265 } ], "top_languages": [ { "id": 1, "name": "English", "code": "en", "count": 265 } ] }, "recent_articles": [ { "id": 3074512345, "title": "...", "href": "...", "published_at": "...", "body": "...", "entities": [], "categories": [], "sentiment": {} } ] } ``` `links.articles` uses `?author.id=` for one author record. A profile may group several records, so this link can return fewer articles than `coverage.article_count`. The `author.id` filter accepts at most three IDs, which may not cover every record in a profile. `author.name` selects the first matching author record. Use `coverage` for profile totals and IDs from `recent_articles` to fetch the articles shown in the profile. ### Coverage fields | Field | Description | |-------|-------------| | `article_count` | Total articles across all author records with this name, up to 500 records. A journalist writing for three outlets may have three author IDs. The profile combines them, so this total can exceed the articles returned by `links.articles`. | | `first_seen` / `last_seen` | Date range of activity. | | `sentiment` | Article counts by overall polarity. | | `momentum` | Articles in the last 30 days vs. the previous 30 days. | | `timeline` | Monthly article counts. | | `top_topics` | Topics the journalist writes about most. | | `top_entities` | Entities (people, companies, places) the journalist covers most. | | `top_countries` / `top_languages` | Geographic and language spread of their articles. | | `recent_articles` | The journalist's latest articles. | ## Pricing Each request with results costs **1 point**. Searches with no results are free. If you have no credits left, the API returns `402`. ## Errors A request for a non-existent journalist returns `404` with code `ER0151` (`Journalist not found.`). --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/javascript/jquery-client.md description: Call the APITube News API from JavaScript using jQuery AJAX --- # jQuery integration ```javascript const settings = { "async": true, "crossDomain": true, "url": "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY", "method": "GET" }; $.ajax(settings).done(function (response) { console.log(response); }); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/language-examples.md description: Examples of using language parameters in News API --- # Language Query Examples ## Exclude a language and publisher country {#excluding-articles-in-a-specific-language-and-from-a-specific-country} Exclude articles in French and articles from France. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.source.country.code" => "fr", "ignore.language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Choose several languages {#getting-articles-in-multiple-languages} Find articles in English and French. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?language.code=en,fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Choose languages and sources {#multilingual-analysis-with-source-filtering} Find English, Japanese and German news from highly ranked sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,ja,de&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,ja,de", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,ja,de", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,ja,de", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,ja,de") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?language.code=en,ja,de&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,ja,de&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find business news in selected languages {#business-news-in-specific-languages} Find business news in Chinese and Korean. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "zh,ko", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Compare company sentiment across languages {#multilingual-organization-sentiment-analysis} Compare positive coverage of Google across languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,fr,de&organization.name=Google&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,fr,de", "organization.name": "Google", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr,de", "organization.name": "Google", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr,de", "organization.name" => "Google", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,fr,de") q.Set("organization.name", "Google") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?language.code=en,fr,de&organization.name=Google&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,fr,de&organization.name=Google&sentiment.overall.polarity=positive&sort.by=published_at 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/everything ``` ::: ## Compare regional coverage by language {#comparing-regional-news-in-different-languages} Compare Arabic and Turkish news, sorted by sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=ar,tr&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "ar,tr", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "ar,tr", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "ar,tr", "category.id" => "medtop:11000000", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "ar,tr") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?language.code=ar,tr&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=ar,tr&category.id=medtop:11000000&sort.by=sentiment.overall.score 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/everything ``` ::: ## Compare technology coverage across languages {#cross-language-technology-coverage-comparison} Compare AI coverage in European and Asian languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,fr,de,pt,tr&topic.id=industry.ai_news&sort.by=language.code&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,fr,de,pt,tr", "topic.id": "industry.ai_news", "sort.by": "language.code", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr,de,pt,tr", "topic.id": "industry.ai_news", "sort.by": "language.code", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr,de,pt,tr", "topic.id" => "industry.ai_news", "sort.by" => "language.code", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,fr,de,pt,tr") q.Set("topic.id", "industry.ai_news") q.Set("sort.by", "language.code") 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) } ``` ```java [Java] 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/everything?language.code=en,fr,de,pt,tr&topic.id=industry.ai_news&sort.by=language.code&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,fr,de,pt,tr&topic.id=industry.ai_news&sort.by=language.code 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/everything ``` ::: ## Find health news by language {#language-specific-health-news-analysis} Find health news in several languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,es,pt,it&title=health,medical,vaccine&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,es,pt,it", "title": "health,medical,vaccine", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,es,pt,it", "title": "health,medical,vaccine", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,es,pt,it", "title" => "health,medical,vaccine", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,es,pt,it") q.Set("title", "health,medical,vaccine") 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) } ``` ```java [Java] 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/everything?language.code=en,es,pt,it&title=health,medical,vaccine&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,es,pt,it&title=health,medical,vaccine 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/everything ``` ::: ## Follow financial sentiment across languages {#multilingual-financial-market-sentiment-tracking} Compare financial news and sentiment across languages and countries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,de,pt,tr&category.id=medtop:04000000&title=market,economy,trade&sort.by=sentiment.overall.score&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,de,pt,tr", "category.id": "medtop:04000000", "title": "market,economy,trade", "sort.by": "sentiment.overall.score", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,de,pt,tr", "category.id": "medtop:04000000", "title": "market,economy,trade", "sort.by": "sentiment.overall.score", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,de,pt,tr", "category.id" => "medtop:04000000", "title" => "market,economy,trade", "sort.by" => "sentiment.overall.score", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,de,pt,tr") q.Set("category.id", "medtop:04000000") q.Set("title", "market,economy,trade") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?language.code=en,de,pt,tr&category.id=medtop:04000000&title=market,economy,trade&sort.by=sentiment.overall.score&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,de,pt,tr&category.id=medtop:04000000&title=market,economy,trade&sort.by=sentiment.overall.score&sort.order=asc 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/php/laravel-framework.md description: >- Call the APITube News API from Laravel PHP using the HTTP client provided by the framework --- # Laravel integration ```php failed()) { $errorMessage = $response->clientError() ? "Client Error: " . $response->status() : "Server Error: " . $response->status(); echo "HTTP Request Error: " . $errorMessage; } else { echo $response->body(); } } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/c/libcurl-client.md' description: >- Call the APITube News API from C/C++ using the Libcurl library for HTTP requests --- # Libcurl integration ```c #include #include size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* out) { size_t totalSize = size * nmemb; out->append((char*)contents, totalSize); return totalSize; } int main() { CURL* curl; CURLcode res; std::string readBuffer; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res == CURLE_OK) { std::cout << readBuffer << std::endl; } else { std::cerr << "cURL Error: " << curl_easy_strerror(res) << std::endl; } } return 0; } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/list-of-countries.md' description: Find valid countries for the source.country.code filter. --- # List of Countries Use these countries with `source.country.code` to filter articles. :::tip Example usage https://api.apitube.io/v1/news/everything?api\_key=YOUR\_API\_KEY\&source.country.code=us ::: Available countries: | Country code | Country name | |--------------|----------------------------------| | `af` | Afghanistan | | `al` | Albania | | `dz` | Algeria | | `ao` | Angola | | `ai` | Anguilla | | `ag` | Antigua and Barbuda | | `ar` | Argentina | | `am` | Armenia | | `aw` | Aruba | | `au` | Australia | | `at` | Austria | | `az` | Azerbaijan | | `bs` | Bahamas | | `bh` | Bahrain | | `bd` | Bangladesh | | `bb` | Barbados | | `by` | Belarus | | `be` | Belgium | | `bz` | Belize | | `bt` | Bhutan | | `bo` | Bolivia | | `ba` | Bosnia and Herzegovina | | `bw` | Botswana | | `br` | Brazil | | `io` | British Indian Ocean Territory | | `bn` | Brunei | | `bg` | Bulgaria | | `bf` | Burkina Faso | | `bi` | Burundi | | `kh` | Cambodia | | `cm` | Cameroon | | `ca` | Canada | | `td` | Chad | | `cl` | Chile | | `cn` | China | | `cc` | Cocos Islands | | `co` | Colombia | | `cg` | Congo | | `cr` | Costa Rica | | `hr` | Croatia | | `cu` | Cuba | | `cy` | Cyprus | | `cz` | Czech Republic | | `dk` | Denmark | | `dj` | Djibouti | | `do` | Dominican Republic | | `ec` | Ecuador | | `eg` | Egypt | | `er` | Eritrea | | `ee` | Estonia | | `et` | Ethiopia | | `fo` | Faroe Islands | | `fj` | Fiji | | `fi` | Finland | | `fr` | France | | `pf` | French Polynesia | | `gm` | Gambia | | `ge` | Georgia | | `de` | Germany | | `gh` | Ghana | | `gi` | Gibraltar | | `gr` | Greece | | `gl` | Greenland | | `gd` | Grenada | | `gp` | Guadeloupe | | `gt` | Guatemala | | `gn` | Guinea | | `gy` | Guyana | | `ht` | Haiti | | `hn` | Honduras | | `hk` | Hong Kong | | `hu` | Hungary | | `is` | Iceland | | `in` | India | | `id` | Indonesia | | `ir` | Iran | | `iq` | Iraq | | `ie` | Ireland | | `il` | Israel | | `it` | Italy | | `ci` | Ivory Coast | | `jm` | Jamaica | | `jp` | Japan | | `kz` | Kazakhstan | | `ke` | Kenya | | `xk` | Kosovo | | `kw` | Kuwait | | `kg` | Kyrgyzstan | | `la` | Laos | | `lv` | Latvia | | `lb` | Lebanon | | `ls` | Lesotho | | `lr` | Liberia | | `ly` | Libya | | `li` | Liechtenstein | | `lt` | Lithuania | | `lu` | Luxembourg | | `mo` | Macau | | `mk` | Macedonia | | `mg` | Madagascar | | `mw` | Malawi | | `my` | Malaysia | | `mv` | Maldives | | `mt` | Malta | | `mu` | Mauritius | | `mx` | Mexico | | `md` | Moldova | | `mc` | Monaco | | `mn` | Mongolia | | `me` | Montenegro | | `ma` | Morocco | | `mz` | Mozambique | | `na` | Namibia | | `np` | Nepal | | `nl` | Netherlands | | `nz` | New Zealand | | `ni` | Nicaragua | | `ne` | Niger | | `ng` | Nigeria | | `nu` | Niue | | `no` | Norway | | `pk` | Pakistan | | `ps` | Palestine | | `pa` | Panama | | `py` | Paraguay | | `pe` | Peru | | `ph` | Philippines | | `pl` | Poland | | `pt` | Portugal | | `qa` | Qatar | | `ro` | Romania | | `vc` | Saint Vincent and the Grenadines | | `ws` | Samoa | | `sm` | San Marino | | `st` | Sao Tome and Principe | | `sa` | Saudi Arabia | | `sn` | Senegal | | `rs` | Serbia | | `sc` | Seychelles | | `sl` | Sierra Leone | | `sg` | Singapore | | `sk` | Slovakia | | `si` | Slovenia | | `sb` | Solomon Islands | | `so` | Somalia | | `za` | South Africa | | `kr` | South Korea | | `es` | Spain | | `lk` | Sri Lanka | | `sr` | Suriname | | `sz` | Swaziland | | `se` | Sweden | | `ch` | Switzerland | | `sy` | Syria | | `tw` | Taiwan | | `tj` | Tajikistan | | `tz` | Tanzania | | `th` | Thailand | | `tg` | Togo | | `to` | Tonga | | `tt` | Trinidad and Tobago | | `tn` | Tunisia | | `tr` | Turkey | | `tm` | Turkmenistan | | `tv` | Tuvalu | | `ug` | Uganda | | `ae` | United Arab Emirates | | `gb` | United Kingdom | | `us` | United States | | `un` | Unknown | | `uy` | Uruguay | | `uz` | Uzbekistan | | `vu` | Vanuatu | | `ve` | Venezuela | | `vn` | Vietnam | | `ye` | Yemen | | `zm` | Zambia | | `zw` | Zimbabwe | --- --- url: 'https://docs.apitube.io/platform/news-api/list-of-languages.md' description: Find valid languages for the language.code filter. --- # List of Languages Use these languages with `language.code` to filter articles. :::tip Example usage https://api.apitube.io/v1/news/everything?api\_key=YOUR\_API\_KEY\&language.code=en ::: Articles are delivered in their original language. For 48 source languages, the [`translations`](/platform/news-api/response-structure#article-object-fields) block also includes an English translation of the title and description. The original fields stay unchanged, and the body is not translated. Two codes in the table are worth knowing about before you rely on them: * **`by` — Belarusian.** This is APITube's own identifier, not the ISO 639-1 one. The standard code `be` is **not** accepted and returns `400 ER0237`. The language currently matches no articles. * **`un` — undetermined.** A placeholder for articles whose language could not be detected; it also matches no articles today. Coverage varies by language. Check [`/v1/news/count`](/platform/news-api/count) before building a feed for the language you need. Available languages: | Language code | Language name | |---------------|---------------| | `af` | Afrikaans | | `sq` | Albanian | | `ar` | Arabic | | `hy` | Armenian | | `az` | Azerbaijani | | `eu` | Basque | | `by` | Belarusian | | `bn` | Bengali | | `bs` | Bosnian | | `bg` | Bulgarian | | `ca` | Catalan | | `zh` | Chinese | | `hr` | Croatian | | `cs` | Czech | | `da` | Danish | | `nl` | Dutch | | `en` | English | | `et` | Estonian | | `fi` | Finnish | | `fr` | French | | `ka` | Georgian | | `de` | German | | `el` | Greek | | `gu` | Gujarati | | `he` | Hebrew | | `hi` | Hindi | | `hu` | Hungarian | | `is` | Icelandic | | `id` | Indonesian | | `ga` | Irish | | `it` | Italian | | `ja` | Japanese | | `kn` | Kannada | | `ko` | Korean | | `la` | Latin | | `lv` | Latvian | | `lt` | Lithuanian | | `mk` | Macedonian | | `ms` | Malay | | `mt` | Maltese | | `no` | Norwegian | | `fa` | Persian | | `pl` | Polish | | `pt` | Portuguese | | `ro` | Romanian | | `sr` | Serbian | | `sk` | Slovak | | `sl` | Slovenian | | `es` | Spanish | | `sw` | Swahili | | `sv` | Swedish | | `ta` | Tamil | | `te` | Telugu | | `th` | Thai | | `tr` | Turkish | | `un` | Unknown | | `ur` | Urdu | | `vi` | Vietnamese | | `cy` | Welsh | | `yi` | Yiddish | --- --- url: 'https://docs.apitube.io/platform/news-api/list-of-topics.md' description: Find valid topics for the topic.id filter. --- # List of Topics Use these topics with `topic.id` to filter articles. :::tip Example usage https://api.apitube.io/v1/news/everything?api\_key=YOUR\_API\_KEY\&topic.id=industry.automotive\_news ::: ### Industry news topics {#industries-news-topics} | Topic ID | Topic name | |---------------------------------------------------------------|---------------------------------------------------| | industry.aerospace\_news | Aerospace Industry News | | industry.agriculture\_news | Agriculture Industry News | | industry.ai\_news | AI Industry News | | market\_news.commodities.ammonia | Ammonia Market News | | market\_news.commodities.aromatics\_market | Aromatics Market News | | industry.automotive\_news | Automotive Industry News | | market\_news.commodities.base\_metals | Base Metals Market News | | market\_news.commodities.base\_oils\_and\_waxes | Base Oils And Waxes Market News | | market\_news.commodities.battery\_materials | Battery Materials Market News | | market\_news.commodities.biofuels\_and\_feedstocks | Biofuels and Feedstocks Market News | | industry.commodities.biofuels\_production | Biofuels Production Industry News | | market\_news.commodities.bitumen\_and\_asphalt | Bitumen And Asphalt Market News | | market\_news.commodities.carbon\_markets | Carbon Markets News | | market\_news.commodities.chemicals | Chemicals Market News | | market\_news.commodities.chlor\_alkali | Chlor Alkali Market News | | market\_news.commodities.coal | Coal Market News | | market\_news.commodities.crude\_oil | Crude Oil Market News | | market\_news.commodities.crude\_oil\_products | Crude Oil Products Market News | | industry.crypto\_news | Crypto Industry News | | market\_news.commodities.electric\_power | Electric Power Market News | | industry.energy\_news | Energy Industry News | | market\_news.commodities.fertilizers | Fertilizers Market News | | industry.financial\_news | Finance Industry News | | industry.commodities.freight | Freight Industry News | | market\_news.commodities.gas\_and\_power | Gas And Power Market News | | industry.green\_energy\_news | Green Energy Industry News | | industry.healthcare\_news | Healthcare Industry News | | market\_news.commodities.heavy\_olefins | Heavy Olefins Market News | | market\_news.commodities.hydrogen | Hydrogen Market News | | industry.commodities.industrial\_manufacturing | Industrial Manufacturing Industry News | | market\_news.commodities.jet\_fuel | Jet Fuel Market News | | market\_news.commodities.light\_olefins | Light Olefins Market News | | market\_news.commodities.liquefied\_natural\_gas | Liquefied Natural Gas Market News | | market\_news.commodities.liquefied\_petroleum\_gas | Liquefied Petroleum Gas Market News | | market\_news.commodities.marine\_fuels | Marine Fuels Market News | | industry.commodities.metallurgy\_news | Metallurgy Industry News | | market\_news.commodities.metals | Metals Market News | | market\_news.commodities.methanol | Methanol Market News | | industry.military\_news | Military Industry News | | industry.commodities.mining | Mining Industry News | | industry.movies\_news | Movies Industry News | | industry.commodities.natural\_gas\_and\_power\_distribution | Natural Gas And Power Distribution Industry News | | market\_news.commodities.natural\_gas | Natural Gas Market News | | market\_news.commodities.nitrogen | Nitrogen Market News | | market\_news.commodities.npk\_fertilizers | NPK Fertilizers Market News | | market\_news.commodities.octane\_blending | Octane Blending Market News | | industry.commodities.oil\_refining\_and\_distribution | Oil Refining And Distribution Industry News | | market\_news.commodities.oleochemicals | Oleochemicals Market News | | industry.commodities.petrochemicals | Petrochemicals Industry News | | industry.petrochemicals\_news | Petrochemicals Industry News | | industry.pharmacy\_news | Pharmacy Industry News | | market\_news.commodities.phosphates | Phosphates Market News | | market\_news.commodities.pipe\_and\_tube | Pipe And Tube Market News | | market\_news.commodities.polymers | Polymers Market News | | market\_news.commodities.polyurethanes | Polyurethanes Market News | | market\_news.commodities.potash | Potash Market News | | market\_news.commodities.rare\_earths | Rare Earths Market News | | industry.real\_estate\_news | Real Estate Industry News | | industry.retail\_news | Retail Industry News | | market\_news.commodities.road\_fuels | Road Fuels Market News | | market\_news.commodities.scrap | Scrap Market News | | market\_news.commodities.specialty\_and\_minor\_metals | Specialty And Minor Metals Market News | | market\_news.commodities.steel | Steel Market News | | market\_news.commodities.steel\_raw\_materials | Steel Raw Materials Market News | | market\_news.commodities.sulphur\_and\_sulphuric\_acid | Sulphur And Sulphuric Acid Market News | | market\_news.commodities.sustainable\_and\_specialty\_fertilizers | Sustainable And Specialty Fertilizers Market News | | industry.technology\_news | Technology Industry News | | industry.telecommunications\_news | Telecommunications Industry News | | industry.commodities.upstream\_oil\_and\_gas | Upstream Oil And Gas Industry News | --- --- url: 'https://docs.apitube.io/platform/news-api/local.md' description: >- Get news around a geographic point ranked by distance, with per-article distance and an optional local insights dashboard --- # Local News Find news near a location with `/v1/news/local`. Send `lat`/`lng` coordinates or a `place` name. Results are sorted by distance and include `distance_km` and `nearest_location`. You can also request summaries of local coverage. ## Endpoint ``` GET /v1/news/local POST /v1/news/local ``` GET and POST return the same results. Send parameters in the URL with `GET` or as JSON in the request body with `POST`. ## Local endpoint vs. the geo filter For `/v1/news/local`, use `lat`, `lng` and `radius`. The [geo filter](/platform/news-api/filters#geo-and-local) on `/v1/news/everything` uses `location.lat`, `location.lng` and `location.radius`. Both select news near a point. The local endpoint also supports sorting by distance, `distance_km`, `nearest_location`, place names, relevance ranking and `local_insights`. ## Query Parameters The endpoint accepts the shared [Filters](/platform/news-api/filters), plus the local parameters listed below. **Choose a center** with both `lat` and `lng`, or with `place`. If you send both, the API uses the coordinates. On Basic and above, you can also use `prompt`, but you must still send the center separately. ### Local parameters {#geo-and-local} | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `lat` | number | No | Latitude of the search center (required unless `place` is given). Range: -90–90. | | `lng` | number | No | Longitude of the search center (required unless `place` is given). Range: -180–180. | | `place` | string | No | Use a place name, such as `Berlin`, as the search center. For ambiguous names, add `country` or send `lat`/`lng`. Coordinates take priority when both are sent. Example: `Berlin`. | | `country` | string | No | Two-letter ISO 3166-1 alpha-2 country code. Add it when a place name exists in several countries (e.g. `de`). Example: `de`. | | `radius` | number | No | Search radius in kilometers (default 50, max 20000). Range: max 20000, > 0. Default: `50`. | | `sort` | string | No | Sort order: nearest first (`distance`), newest first (`published_at`), or `relevance` (blends proximity + source authority + recency + breaking; adds `relevance_score` to each article). One of: `distance`, `published_at`, `relevance`. Default: `distance`. | | `ranking` | string | No | Choose how relevance is ranked when sort=relevance: balanced, proximity (distance), authority (source rank) or fresh (recency). Use w.\* parameters to adjust individual weights. One of: `balanced`, `proximity`, `authority`, `fresh`. Default: `balanced`. | | `w.distance` | number | No | How much distance affects the relevance score. Overrides the selected preset. Range: min 0. | | `w.opr` | number | No | How much source rank affects the relevance score. Overrides the selected preset. Range: min 0. | | `w.recency` | number | No | How much article age affects the relevance score. Overrides the selected preset. Range: min 0. | | `w.important` | number | No | How much breaking-news importance affects the relevance score. Overrides the selected preset. Range: min 0. | | `insights` | string | No | List the local summaries you want, separated by commas: mood, hotspots, events, entities, bias, sources, timeline, top\_categories, top\_topics, breaking, velocity, movers. For the most accurate velocity and movers results, omit the published\_at filter. Each block costs 1 extra point. Example: `top_categories,breaking,movers`. | ## Response Format ```json { "status": "ok", "query": { "lat": 52.52, "lng": 13.4, "radius_km": 50, "sort": "distance" }, "total": 128, "results": [ { "id": 0, "title": "string", "href": "string", "distance_km": 3.2, "nearest_location": { "entity_id": 0, "name": "string", "lat": 52.51, "lng": 13.41, "country": "de" } } ] } ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `status` | string | Always `ok` on success. | | `query` | object | The center and settings that were used: `lat`, `lng`, `radius_km`, `sort`. When `place` is used it also carries `place` and `resolved_entity_id`. | | `total` | integer | Exact number of matching articles inside the radius. | | `results` | array | Article objects (same fields as `/v1/news/everything`) with the extra fields below. | | `results[].distance_km` | float | Distance from the center to the article's nearest matched location. | | `results[].nearest_location` | object | Closest matched place: `entity_id`, `name`, `lat`, `lng`, `country`. | | `results[].relevance_score` | float | Present only when `sort=relevance`. | | `ranking_weights` | object | The effective relevance weights (present when `sort=relevance`). | | `local_insights` | object | Present only when `insights` is requested (see below). | ## Local insights To get summaries for the search area, list the blocks you want in `insights`, separated by commas. The response includes them in `local_insights`. Available blocks are: `mood`, `hotspots`, `events`, `entities`, `bias`, `sources`, `timeline`, `top_categories`, `top_topics`, `breaking`, `velocity`, `movers`. An unknown value returns `400 ER0420`. Four blocks have different names in the response: `events` becomes `top_events`, `entities` becomes `top_entities`, `bias` becomes `bias_split`, and `sources` becomes `top_sources`. Other blocks keep their names. The `movers` block finds entities and topics gaining attention within your search radius. It compares recent coverage with the previous 14 days. ::: warning Insights can increase response time Requesting more insight blocks can slow down the response. Broad searches with `hotspots` may time out with `502`. Request only the blocks you need, two or three at a time. Add article filters to narrow the search before requesting insights. ::: ## Billing Each `/v1/news/local` request costs **1 point plus 1 point per requested insight block**. Without `insights`, it costs 1 point. With `insights=mood,hotspots,breaking`, it costs 4 points. You are charged only if the response contains articles. ## Request Examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/local?lat=52.52&lng=13.40&radius=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/news/local", params={"lat": "52.52", "lng": "13.40", "radius": "50", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ lat: "52.52", lng: "13.40", radius: "50", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/news/local?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["lat" => "52.52", "lng" => "13.40", "radius" => "50", "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/local?$query"), true); print_r($data); ``` ::: ### Geocode a place name and rank by relevance ```bash curl "https://api.apitube.io/v1/news/local?place=Berlin&country=de&radius=30&sort=relevance&ranking=authority&api_key=YOUR_API_KEY" ``` ### Attach a local insights dashboard ```bash curl "https://api.apitube.io/v1/news/local?lat=52.52&lng=13.40&radius=50&insights=mood,hotspots,breaking&api_key=YOUR_API_KEY" ``` ## Error Responses | Code | Status | Meaning | |------|--------|---------| | `ER0406` | 400 | No center provided — send `lat` and `lng` together, or a `place`. | | `ER0407` | 400 | `lat` must be a valid latitude between `-90` and `90`. | | `ER0408` | 400 | `lng` must be a valid longitude between `-180` and `180`. | | `ER0409` | 400 | `radius` must be a positive number up to `20000` km. | | `ER0420` | 400 | Unknown value in `insights`. | | `ER0421` | 400 | The API could not find coordinates for `place`. Use a more specific name, add `country` or send `lat`/`lng`. | | `ER0422` | 400 | Unknown `sort` value — allowed: `distance`, `published_at`, `relevance`. | | `ER0423` | 400 | Unknown `ranking` preset — allowed: `balanced`, `proximity`, `authority`, `fresh`. | | `ER0424` | 400 | A `w.*` weight is not a non-negative number. | --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/lua/lua-socket-client.md description: Call the APITube News API from Lua using LuaSocket --- # LuaSocket integration ```lua -- Install: luarocks install luasocket local http = require("socket.http") local ltn12 = require("ltn12") function makeRequest() local url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" local response_body = {} local res, status, response_header = http.request{ url = url, method = "GET", sink = ltn12.sink.table(response_body) } if res and status == 200 then print("Response: " .. table.concat(response_body)) elseif status >= 400 and status < 500 then print("Client Error: " .. status) elseif status >= 500 then print("Server Error: " .. status) else print("HTTP Request Error") end end -- Make the HTTP request makeRequest() ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/perl/lwp-client.md' description: 'Call the APITube News API from Perl using the LWP::UserAgent module' --- # LWP integration ```perl #!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use JSON; my $ua = LWP::UserAgent->new; $ua->timeout(30); my $url = 'https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY'; my $response = $ua->get($url); if ($response->is_success) { my $data = decode_json($response->decoded_content); print JSON->new->pretty->encode($data); } else { print "HTTP Request Error: " . $response->status_line . "\n"; } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/make.md' description: >- Automate news monitoring workflows with APITube News API and Make (formerly Integromat) — no coding required --- # Make (Integromat) Integration Use [Make](https://www.make.com), formerly Integromat, to build news monitoring, alerts and AI summaries with visual workflows. ## Prerequisites * Make account ([free](https://www.make.com/en/register) or paid plan) * APITube API key (get one from your [dashboard](https://apitube.io)) ## Setting Up APITube Credentials Use Make's **HTTP** module to call the API. Save your API key as a credential to reuse it in other scenarios. ### Option 1: API Key Connection (recommended) 1. In your scenario, add an **HTTP** → **Make a request** module 2. Click **Add** next to Credentials 3. Choose **API Key** as the type 4. Configure: * **Name**: `APITube API` * **Key**: `X-API-Key` * **Value**: your API key from [apitube.io](https://apitube.io) * **Placement**: `Header` 5. Click **Save** ### Option 2: Inline Header When configuring an HTTP module, add a header manually: * **Header name**: `X-API-Key` * **Header value**: your API key :::tip Choose Option 1 to save the key securely and reuse it in HTTP modules across your scenarios. ::: ## API Endpoints Reference | Endpoint | Method | Description | |----------|--------|-------------| | `/v1/news/everything` | GET | Search all articles with 50+ filters | | `/v1/news/top-headlines` | GET | Headlines from highly ranked sources | | `/v1/news/article` | GET | Get articles by ID | | `/v1/news/story/:articleId` | GET | Get related articles for a story | | `/v1/news/trends` | GET | Trending subjects and article counts | Base URL: `https://api.apitube.io` Full list of endpoints and parameters: [Endpoints](/platform/news-api/endpoints) | [Parameters](/platform/news-api/filters#parameters) ## Scenario 1: News Monitoring → Google Sheets Automatically collect news articles into a Google Sheets spreadsheet on a schedule. **Scenario flow:** `Scheduler` → `HTTP (GET)` → `JSON Parse` → `Iterator` → `Google Sheets (Add Row)` **Step-by-step setup:** ### Module 1: Scheduler * **Run scenario**: `Every 15 minutes` ### Module 2: HTTP — Make a request * **URL**: `https://api.apitube.io/v1/news/everything` * **Method**: `GET` * **Credentials**: select your `APITube API` credential * **Query String** (add each as a separate parameter): * `title` = `artificial intelligence` * `language.code` = `en` * `per_page` = `50` * `sort.by` = `published_at` * `sort.order` = `desc` * **Parse response**: `Yes` ### Module 3: Iterator * **Array**: select `results` from the HTTP response ### Module 4: Google Sheets — Add a Row * Connect your Google account and select the target spreadsheet * Map columns: * **Title** → `title` * **URL** → `href` * **Source** → `source.domain` * **Published** → `published_at` * **Sentiment** → `sentiment.overall.polarity` * **Image** → `image` **Customization tips:** * Change the `title` parameter to monitor different keywords * Add `category.id` to filter by category (see [list of categories](/platform/news-api/list-of-categories)) * Add `source.country.code` to filter by country (e.g., `us`, `gb`) * Use `person.name` or `organization.name` to follow news about specific people or companies * Add a **Filter** between Iterator and Google Sheets to apply additional conditions ## Scenario 2: News to Slack / Telegram Send news alerts to your team's Slack channel or Telegram group. **Scenario flow:** `Scheduler` → `HTTP (GET)` → `JSON Parse` → `Iterator` → `Slack / Telegram` **Step-by-step setup:** ### Module 1: Scheduler * **Run scenario**: `Every 30 minutes` ### Module 2: HTTP — Make a request * **URL**: `https://api.apitube.io/v1/news/everything` * **Method**: `GET` * **Credentials**: select your `APITube API` credential * **Query String**: * `title` = `startup funding` * `language.code` = `en` * `per_page` = `10` * `sort.by` = `published_at` * `sort.order` = `desc` * **Parse response**: `Yes` ### Module 3: Iterator * **Array**: select `results` from the HTTP response ### Module 4a: Slack — Create a Message * **Channel**: select your target channel * **Text**: ```json "*<{href}|{title}>*\n_{source.domain}_ • {published_at}\n{description}" ``` Replace each `{field}` with its value from the Iterator module. ### Module 4b (alternative): Telegram Bot — Send a Message * **Chat ID**: your group/channel ID * **Text**: map `title`, `source.domain`, `published_at`, and `href` fields from the Iterator * **Parse Mode**: `HTML` or `Markdown` :::tip Add a **Filter** between the Iterator and Slack/Telegram modules. For example, send only articles with a sentiment score above 0 or from a specific source. ::: ## Scenario 3: AI News Digest → Email Use AI to summarise each day's news and email the summary. **Scenario flow:** `Scheduler` → `HTTP (GET)` → `Text Aggregator` → `OpenAI (Chat)` → `Gmail` **Step-by-step setup:** ### Module 1: Scheduler * **Run scenario**: `Once a day` at `8:00 AM` ### Module 2: HTTP — Make a request * **URL**: `https://api.apitube.io/v1/news/top-headlines` * **Method**: `GET` * **Credentials**: select your `APITube API` credential * **Query String**: * `language.code` = `en` * `per_page` = `20` * `sort.by` = `published_at` * `sort.order` = `desc` * **Parse response**: `Yes` ### Module 3: Iterator * **Array**: select `results` from the HTTP response ### Module 4: Text Aggregator * **Source Module**: Iterator * **Text**: map `title`, `source.domain`, and `href` fields from the Iterator, formatted as `- {title} ({source.domain}) {href}` * **Row separator**: newline ### Module 5: OpenAI — Create a Chat Completion * **Model**: `gpt-4o-mini` * **Messages**: * **Role**: `user` * **Content**: `Summarize the following news articles into a concise daily digest. Group by topic, highlight the most important stories, and keep it under 500 words.` + aggregated text from Module 4 ### Module 6: Gmail — Send an Email * **To**: your email address * **Subject**: `Daily News Digest` * **Content**: OpenAI response from Module 5 ## Parameters See [Parameters](/platform/news-api/filters#parameters) for 50+ filters, including language, category, sentiment, entities and date ranges. ## Tips & Tricks * **Avoid duplicates**: Use `published_at.start` with Make's `formatDate(now; "YYYY-MM-DD'T'HH:mm:ss")` function, subtracting your polling interval * **Rate limits**: APITube allows 50 requests per minute. Space your Scheduler intervals accordingly * **Pagination**: Use `page` parameter to fetch more results. Max `per_page` is 250 (10 on Free, 50 on Starter, 200 on Basic) * **Error handling**: To handle API timeouts, right-click a module → **Add error handler** → **Resume** * **Make plan limits**: Free Make plan allows 1,000 operations/month. Each Iterator cycle counts as one operation, so keep `per_page` low or use filters * **Remember processed articles**: Save article URLs in Make's **Data Store** module to avoid processing the same article again in later runs ## Next Steps * [Common Workflows](/platform/news-api/common-workflows/getting-started) — more query examples * [Parameters](/platform/news-api/filters#parameters) — full parameter reference * [Endpoints](/platform/news-api/endpoints) — all available endpoints * [API Reference](https://api-reference.apitube.io) — interactive API explorer --- --- url: 'https://docs.apitube.io/guides/user-guide/make-your-first-api-call.md' description: >- A step-by-step guide to making your first request to the APITube News API, from getting an API key to understanding the response --- # Make Your First API Call Make your first News API request, read the response and add filters for language, topic and date. ## What is APITube News API? Use APITube to get articles from more than **300,000 verified news sources** worldwide. You can: * **Search** articles by title, keyword, language, category, topic, or industry * **Filter** by date range, country, source, author, entity (people, organizations, brands) * **Analyze** sentiment at the article, title, and body level * **Export** results as JSON, CSV, XLSX, XML, RSS, Parquet, or JSONL * **Stream** articles in real time via Server-Sent Events (SSE) The API is free to use for development — you just need an API key. ## Prerequisites Before you start, you need three things: 1. **An APITube account** — [sign up for free](https://apitube.io/#sign-up) if you haven't already. 2. **Your API key** — after registration, copy the API key from your dashboard. 3. **A terminal** — curl is pre-installed on macOS and Linux. On Windows, use PowerShell or install [curl](https://curl.se/). :::tip Your API key is a long alphanumeric string. Keep it secret — do not share it publicly or commit it to version control. ::: ## Step 1: Make Your First Request Open your terminal and run this command: ```shell curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything?per_page=3" ``` Each part of the command has a purpose: | Part | Meaning | |------|---------| | `curl` | Command-line tool for making HTTP requests | | `-H "X-API-Key: YOUR_API_KEY"` | Sends your API key in the request header for authentication | | `https://api.apitube.io` | APITube base URL | | `/v1/news/everything` | Endpoint that returns articles from all sources | | `?per_page=3` | Limits the response to 3 articles | :::tip Replace `YOUR_API_KEY` with the actual key from your dashboard. ::: ## Step 2: Understand the Response You will receive a JSON response like this: ```json { "status": "ok", "limit": 3, "path": "https://api.apitube.io/v1/news/everything?per_page=3", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/everything?per_page=3&page=2", "has_previous_page": false, "previous_page": "", "export": { "json": "https://api.apitube.io/v1/news/everything?per_page=3&export=json", "xlsx": "https://api.apitube.io/v1/news/everything?per_page=3&export=xlsx", "csv": "https://api.apitube.io/v1/news/everything?per_page=3&export=csv", "tsv": "https://api.apitube.io/v1/news/everything?per_page=3&export=tsv", "xml": "https://api.apitube.io/v1/news/everything?per_page=3&export=xml", "rss": "https://api.apitube.io/v1/news/everything?per_page=3&export=rss", "parquet": "https://api.apitube.io/v1/news/everything?per_page=3&export=parquet", "jsonl": "https://api.apitube.io/v1/news/everything?per_page=3&export=jsonl" }, "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "results": [ { "id": 987654321, "href": "https://example.com/article/tech-conference", "published_at": "2026-03-25T10:30:00Z", "title": "Global Tech Conference Announces New AI Initiatives", "description": "Leading technology companies gathered to discuss the future of artificial intelligence and its impact on various industries.", "body": "The annual Global Tech Conference kicked off today with a series of announcements focused on artificial intelligence...", "body_html": "

The annual Global Tech Conference kicked off today with a series of announcements focused on artificial intelligence...

", "language": "en", "author": { "id": 456, "name": "Jane Smith" }, "image": "https://example.com/images/tech-conference.jpg", "categories": [ { "id": 602, "name": "science and technology", "score": 0.95, "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:13000000" } } ], "topics": [ { "id": "industry.technology_news", "name": "Technology Industry News", "score": 0.92, "links": { "self": "https://api.apitube.io/v1/news/topic/industry.technology_news" } } ], "industries": [ { "id": 312, "name": "Education Consulting for Education", "links": { "self": "https://api.apitube.io/v1/news/industry/312" } } ], "entities": [ { "id": 95, "name": "Google", "type": "organization", "links": { "self": "https://api.apitube.io/v1/news/entity/95", "wikipedia": "https://en.wikipedia.org/wiki/Google", "wikidata": "https://www.wikidata.org/wiki/Q95" }, "frequency": 5, "sentiment": { "score": 0.31, "polarity": "positive", "mentions": { "positive": 3, "neutral": 2, "negative": 0 } }, "title": { "pos": [] }, "body": { "pos": [ { "start": 12, "end": 18 }, { "start": 45, "end": 51 } ] } } ], "source": { "id": 508004, "domain": "example.com", "home_page_url": "https://example.com", "type": "news", "bias": "center", "rankings": { "opr": 8 }, "location": { "country_name": "United States", "country_code": "us" }, "favicon": "https://example.com/favicon.ico" }, "sentiment": { "overall": { "score": 0.85, "polarity": "positive" }, "title": { "score": 0.78, "polarity": "positive" }, "body": { "score": 0.87, "polarity": "positive" } }, "summary": [ { "sentence": "The annual Global Tech Conference kicked off today with major AI announcements.", "sentiment": { "score": 0.82, "polarity": "positive" } }, { "sentence": "Industry leaders committed to responsible AI development standards.", "sentiment": { "score": 0.90, "polarity": "positive" } } ], "keywords": ["technology", "artificial intelligence", "conference", "AI", "innovation"], "links": [ { "url": "https://example.com/ai-standards", "type": "link" } ], "media": [ { "url": "https://example.com/images/tech-conference.jpg", "type": "image" } ], "story": { "id": "story-789", "uri": "https://api.apitube.io/v1/news/story/3036291250" }, "shares": { "total": 1250, "facebook": 450, "twitter": 600, "reddit": 200 }, "is_duplicate": false, "is_free": true, "is_breaking": false, "read_time": 4, "sentences_count": 18, "paragraphs_count": 6, "words_count": 542, "characters_count": 3210 } ] } ``` Here are the key fields to pay attention to: | Field | Description | |-------|-------------| | `status` | `"ok"` if the request was successful, `"error"` otherwise | | `results` | Array of article objects — the main data | | `results[].title` | Article headline | | `results[].description` | Short article summary | | `results[].href` | URL of the original article | | `results[].published_at` | Publication date in ISO 8601 format | | `results[].language.code` | Two-letter language code (e.g. `en`, `de`, `fr`) | | `results[].categories` | Article categories with relevance scores | | `results[].entities` | People, organizations, brands mentioned in the article | | `results[].sentiment` | Sentiment analysis — overall, title, and body separately | | `results[].source` | Publisher details: domain, country and ranking | | `results[].summary` | Key sentences extracted from the article | | `export` | URLs to download the same results as JSON, CSV, XLSX, XML, RSS, Parquet, or JSONL | | `has_next_pages` | `true` if there are more results — use `page` parameter to paginate | | `request_id` | Unique ID for debugging — include it if you contact support | For a complete description of every field, see the [API Response Structure](/platform/news-api/response-structure) page. ## Step 3: Add Filters Add filters to narrow your results. The examples below start with one filter and then combine several: ### Filter by language Get only English-language articles: ```shell curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything?language.code=en&per_page=5" ``` ### Search by title Find articles with "climate" in the title: ```shell curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything?title=climate&language.code=en&per_page=5" ``` ### Filter by date range Narrow results to a specific time period: ```shell curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything?title=climate&language.code=en&published_at.start=2026-03-01&published_at.end=2026-03-25&per_page=5" ``` ### Filter by category Get articles from the "technology" category: ```shell curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&language.code=en&per_page=5" ``` You can combine any of these filters together. See the full [Parameters](/platform/news-api/filters#parameters) reference for all available options. ## Step 4: Try It in Python Here is the same request using Python and the `requests` library: ```python import requests url = "https://api.apitube.io/v1/news/everything" headers = { "X-API-Key": "YOUR_API_KEY" } params = { "title": "climate", "language.code": "en", "per_page": 5 } response = requests.get(url, headers=headers, params=params) data = response.json() print(f"Status: {data['status']}") print(f"Found {len(data['results'])} articles\n") for article in data["results"]: print(f"- {article['title']}") print(f" {article['href']}\n") ``` :::tip Install the requests library with `pip install requests` if you don't have it yet. ::: ## Step 5: Try It in JavaScript Using the built-in `fetch` API (Node.js 18+ or any modern browser): ```javascript const API_KEY = 'YOUR_API_KEY'; const params = new URLSearchParams({ title: 'climate', 'language.code': 'en', per_page: '5' }); const response = await fetch( `https://api.apitube.io/v1/news/everything?${params}`, { headers: { 'X-API-Key': API_KEY } } ); const data = await response.json(); console.log(`Status: ${data.status}`); console.log(`Found ${data.results.length} articles\n`); data.results.forEach(article => { console.log(`- ${article.title}`); console.log(` ${article.href}\n`); }); ``` ## Common Errors If something goes wrong, check the HTTP status code: | HTTP Code | Meaning | What to Do | |-----------|---------|------------| | `401` | Invalid or missing API key | Check that the `X-API-Key` header is present and the key is correct | | `402` | No points on account | Top up your account balance | | `429` | Rate limit exceeded | Wait and retry — see limits below | | `400` | Malformed request | Check your parameter names and values | :::warning The free plan allows 100 requests per day (10 requests per minute, 10 articles per request) and returns the first 5 pages of results. If you need higher limits, consider [upgrading your plan](https://apitube.io/#pricing). ::: ## Next Steps Now that you have made your first API call, explore further: * **[Authentication](/platform/news-api/authentication)** — all authentication methods in detail * **[Endpoints](/platform/news-api/endpoints)** — all available API endpoints * **[Parameters](/platform/news-api/filters#parameters)** — full list of filters and options * **[Integration examples](/platform/news-api/integrations/getting-started)** — code snippets in 30+ programming languages * **[Common Workflows](/platform/news-api/common-workflows/getting-started)** — real-world usage patterns and examples * **[Interactive Query Builder](/platform/news-api/query-builder)** — build API queries visually * **[Rate Limits](/platform/news-api/rate-limits)** — understand plan limits and quotas * **[Postman Collection](https://www.postman.com/apitube/apitube/overview)** — explore the API interactively in Postman :::tip If you have any questions or need assistance, reach out to the [support team](mailto:hello@apitube.io). ::: --- --- url: 'https://docs.apitube.io/platform/news-api/ai/mcp-server.md' description: >- Connect AI assistants like Cursor and Claude Desktop directly to News API using Model Context Protocol --- # MCP Server Connect your AI assistant to the MCP (Model Context Protocol) server to search the News API in plain language. For example, ask "find me the latest AI news" to get matching articles. ## What is MCP Server? MCP lets assistants such as Cursor and Claude Desktop call external tools. After you connect APITube, your assistant can build search requests and read the results for you. Use the hosted server at . You do not need to install a server. **Use cases:** * Search for news articles directly from your AI assistant * Filter news by language, sentiment, topics, and more * Get breaking news stories * Research specific topics without leaving your IDE Add the hosted server to your assistant's settings with your API key to get started. ## How to Connect ### Step 1: Get API Key Get your API key from [APITube](https://apitube.io): 1. Sign up on [apitube.io](https://apitube.io) 2. Get your personal API key 3. Keep it secure ### Step 2: Configure MCP Client Add the MCP server to your AI assistant's configuration. The hosted server speaks HTTP JSON-RPC, so pass your API key in the `Authorization` header. :::tip One-click install On Cursor or VS Code you can skip the config file entirely — the [Code Editors Setup](/platform/news-api/ai/code-editors#install-in-one-click) page builds an install link with your key already in it. ::: **For Cursor** (`~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project): ```json { "mcpServers": { "apitube-news": { "url": "https://mcp.apitube.io/", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` **For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS). Claude Desktop launches MCP servers as local processes, so bridge the remote server with `mcp-remote`: ```json { "mcpServers": { "apitube-news": { "command": "npx", "args": [ "-y", "mcp-remote", "https://mcp.apitube.io/", "--header", "Authorization: Bearer YOUR_API_KEY" ] } } } ``` :::tip Setting up VS Code, Windsurf, or Claude Code instead? See [Code Editors Setup](/platform/news-api/ai/code-editors) for per-editor instructions. ::: ### Step 3: Restart Your AI Assistant Save the configuration and restart Cursor or Claude Desktop. ## How to Use After connecting, ask your assistant for news: ### Basic Examples **Search for news:** ```text Find me the latest news about artificial intelligence ``` **Filter by language:** ```text Show me news about Bitcoin in English ``` **Get breaking news:** ```text What are the breaking news stories right now? ``` **Search with sentiment:** ```text Find positive news about Tesla ``` ### Advanced Queries The AI assistant can handle complex queries with multiple filters: **Multiple filters:** ```text Find breaking news about climate change from verified sources published today ``` **Specific requirements:** ```text Show me long-form articles about SpaceX with images, published in the last week ``` **Entity search:** ```text Find news mentioning Elon Musk and Tesla ``` ## Available Features The MCP server supports all News API features: * **Search by title/keywords** - Find articles matching specific terms * **Language filtering** - Filter by language (English, Russian, etc.) * **Sentiment analysis** - Filter by positive, negative, or neutral sentiment * **Date ranges** - Search within specific time periods * **Media filtering** - Find articles with images or videos * **Source quality** - Filter by verified or premium sources * **Breaking news** - Get only breaking news stories * **Entity search** - Find news about specific people, organizations, or locations * **Topic/Category filtering** - Filter by predefined topics and categories ## Technical Details ### How It Works 1. You ask a question in natural language 2. The AI assistant converts it to an MCP tool call 3. MCP server translates it to a News API request 4. Results are returned to the AI assistant 5. The AI formats and presents the news to you ### API Endpoints * **JSON-RPC endpoint**: `POST https://mcp.apitube.io/` * **Protocol version**: latest `2025-11-25`; the server negotiates down to the version your client requests (older versions such as `2024-11-05` remain supported) * **Server version**: `1.0.0` ### Available Tools The MCP server provides the following tools: * **search\_news** - Search for news articles with advanced filtering by language, category, sentiment, entities, media content, and more * **suggest** - Resolve a name or prefix (e.g. "Tesla") to APITube entity/category/topic/industry IDs, so you can use them in the `search_news` filters (`entity.id`, `category.id`, `topic.id`, `industry.id`) ### Available Prompts Ready-made query templates (slash commands in MCP clients), built on top of the tools above: * **monitor\_company** - Track recent news and sentiment about a company * **topic\_sentiment** - Break down the sentiment of coverage about a topic * **breaking\_news** - Get the latest breaking news, optionally filtered by subject and country * **compare\_coverage** - Compare volume and sentiment of coverage for two subjects ### Authentication The client sends the API key from your configuration in the request headers. ## Troubleshooting ### Testing Server Connection **Check if the server is available:** ```bash curl -X POST https://mcp.apitube.io/ \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} }, "id": 1 }' ``` **Expected response:** ```json { "jsonrpc": "2.0", "result": { "protocolVersion": "2024-11-05", "serverInfo": { "name": "APITube News MCP-Server", "version": "1.0.0" }, "capabilities": { "tools": {"listChanged": true}, "prompts": {"listChanged": true} } } } ``` ### API Key Issues If you see authentication errors: 1. Verify your API key is correct on [apitube.io](https://apitube.io) 2. Check the configuration file syntax 3. Send your key in the `Authorization: Bearer YOUR_API_KEY` header. For Cursor, add it to `headers`. For Claude Desktop, pass it with `--header` to `mcp-remote`. 4. Restart your AI assistant 5. Try testing with curl to verify the API key works **Specific authentication errors:** * **`401` with code `ER0230`** — your API key has expired. Check or extend the key's expiry date in your [API key settings](/platform/news-api/authentication). * **`403` with code `ER0603`** — your API key is not allowed to call the MCP tools (`search_news`, `suggest`). Grant the key the matching permissions in its settings, or use a key that has full access. * **`503` with code `ER0900`** means the server could not check your key. Wait a few seconds and retry. You do not need to replace the key. * **`403` with code `ER0706`** — the MCP server is not available on the Free plan. Upgrade the subscription to use it. ### Connection Problems If you can't connect to : * Check your internet connection * Verify firewall settings * Try accessing the URL in a browser ### Testing with a Real Query **Test with actual news search:** ```bash curl -X POST https://mcp.apitube.io/ \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "search_news", "arguments": { "title": "Bitcoin", "per_page": 5 } }, "id": 1 }' ``` ## Alternative: Direct HTTP Access You can also use the MCP server as a regular HTTP API without an AI assistant: ```bash curl -X POST https://mcp.apitube.io/ \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "search_news", "arguments": { "title": "AI technology", "language": {"code": "en"}, "is_breaking": 1 } }, "id": 1 }' ``` :::tip Use directly without running your own server. ::: ## Next Steps * Check out [common workflows](/platform/news-api/common-workflows/getting-started) for query examples * Learn about [available parameters](/platform/news-api/filters#parameters) * Explore [authentication options](/platform/news-api/authentication) ## Support If you encounter issues: 1. Check the [Technical FAQ](/platform/news-api/technical-faq) 2. Verify your API key on [apitube.io](https://apitube.io) 3. Check the error message returned by your MCP client 4. Contact support through the APITube website --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/media-examples.md description: Examples of using media parameters in News API --- # Media Query Examples ## Set image and video counts {#search-for-articles-with-specific-media-counts} Find articles with at least 2 images and 1 video. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "media.videos.count" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("media.videos.count", "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) } ``` ```java [Java] 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/everything?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=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/everything ``` ::: ## Set image dimensions {#filter-articles-by-image-dimensions} Filter articles by image dimensions. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "200", "media.images.width.max" => "800", "media.images.height.min" => "200", "media.images.height.max" => "800", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.width.min", "200") q.Set("media.images.width.max", "800") q.Set("media.images.height.min", "200") q.Set("media.images.height.max", "800") 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) } ``` ```java [Java] 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/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800 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/everything ``` ::: ## Find articles with images and videos {#rich-media-content-curation} Find technology articles with images and videos. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "category.id" => "medtop:13000000", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find articles with large images {#high-quality-visual-news-aggregation} Find positive technology articles with large images. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.width.min=800&media.images.height.min=600&media.images.count=1&sentiment.overall.polarity=positive&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.width.min": "800", "media.images.height.min": "600", "media.images.count": "1", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "800", "media.images.height.min": "600", "media.images.count": "1", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "800", "media.images.height.min" => "600", "media.images.count" => "1", "sentiment.overall.polarity" => "positive", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.width.min", "800") q.Set("media.images.height.min", "600") q.Set("media.images.count", "1") q.Set("sentiment.overall.polarity", "positive") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?media.images.width.min=800&media.images.height.min=600&media.images.count=1&sentiment.overall.polarity=positive&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.width.min=800&media.images.height.min=600&media.images.count=1&sentiment.overall.polarity=positive&category.id=medtop:13000000 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/everything ``` ::: ## Find articles with several types of media {#interactive-media-content-curation} Find articles with several kinds of media. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "category.id" => "medtop:13000000", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&category.id=medtop:13000000&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find product reviews with images {#image-rich-product-reviews} Find product reviews with images. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&title=review&category.id=medtop:13000000&organization.name=Apple,Google&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "title": "review", "category.id": "medtop:13000000", "organization.name": "Apple,Google", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "title": "review", "category.id": "medtop:13000000", "organization.name": "Apple,Google", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "title" => "review", "category.id" => "medtop:13000000", "organization.name" => "Apple,Google", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("title", "review") q.Set("category.id", "medtop:13000000") q.Set("organization.name", "Apple,Google") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.images.count=2&title=review&category.id=medtop:13000000&organization.name=Apple,Google&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&title=review&category.id=medtop:13000000&organization.name=Apple,Google&sort.by=media.images.count&sort.order=desc 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/everything ``` ::: ## Compare media across sources {#cross-platform-visual-content-comparison} Compare images and videos in coverage from highly ranked sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=1&source.domain=theguardian.com,foxnews.com,nytimes.com&topic.id=industry.ai_news&sort.by=source.domain,media.images.count&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "1", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "topic.id": "industry.ai_news", "sort.by": "source.domain,media.images.count", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "1", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "topic.id": "industry.ai_news", "sort.by": "source.domain,media.images.count", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "1", "source.domain" => "theguardian.com,foxnews.com,nytimes.com", "topic.id" => "industry.ai_news", "sort.by" => "source.domain,media.images.count", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "1") q.Set("source.domain", "theguardian.com,foxnews.com,nytimes.com") q.Set("topic.id", "industry.ai_news") q.Set("sort.by", "source.domain,media.images.count") 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) } ``` ```java [Java] 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/everything?media.images.count=1&source.domain=theguardian.com,foxnews.com,nytimes.com&topic.id=industry.ai_news&sort.by=source.domain,media.images.count&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=1&source.domain=theguardian.com,foxnews.com,nytimes.com&topic.id=industry.ai_news&sort.by=source.domain,media.images.count 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/everything ``` ::: ## Find company announcements with media {#multimedia-organization-announcement-coverage} Find positive product-announcement coverage with image filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=1&organization.name=Apple,Google,Microsoft,Amazon&title=launch,announce,unveil,reveal&sentiment.overall.polarity=positive&sort.by=organization.name,published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "1", "organization.name": "Apple,Google,Microsoft,Amazon", "title": "launch,announce,unveil,reveal", "sentiment.overall.polarity": "positive", "sort.by": "organization.name,published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "1", "organization.name": "Apple,Google,Microsoft,Amazon", "title": "launch,announce,unveil,reveal", "sentiment.overall.polarity": "positive", "sort.by": "organization.name,published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "1", "organization.name" => "Apple,Google,Microsoft,Amazon", "title" => "launch,announce,unveil,reveal", "sentiment.overall.polarity" => "positive", "sort.by" => "organization.name,published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "1") q.Set("organization.name", "Apple,Google,Microsoft,Amazon") q.Set("title", "launch,announce,unveil,reveal") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "organization.name,published_at") 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) } ``` ```java [Java] 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/everything?media.images.count=1&organization.name=Apple,Google,Microsoft,Amazon&title=launch,announce,unveil,reveal&sentiment.overall.polarity=positive&sort.by=organization.name,published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=1&organization.name=Apple,Google,Microsoft,Amazon&title=launch,announce,unveil,reveal&sentiment.overall.polarity=positive&sort.by=organization.name,published_at 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/migrations/from-bing-news.md' description: >- Move from Bing News Search, retired in August 2025, to APITube. Find parameter mappings and a compatibility library. No Azure project required. --- # Migrating from Bing News Search API ::: warning The Bing Search APIs were retired on August 11, 2025 Legacy `Ocp-Apim-Subscription-Key` credentials now return `410 Gone`, and the `/v7.0/news` endpoints are permanently decommissioned. ::: Microsoft's replacement, *Grounding with Bing Search*, runs inside Azure AI Agent Service and requires Azure setup. If you need a direct HTTP endpoint to replace `GET /v7.0/news/search?q=...`, use the mapping below. ## Your first request ```bash # Bing News Search v7 (retired) curl "https://api.bing.microsoft.com/v7.0/news/search?q=tesla&mkt=en-US&count=100&sortBy=Date" \ -H "Ocp-Apim-Subscription-Key: YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&source.country.code=us&per_page=100&sort.by=published_at&sort.order=desc" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | Bing | APITube | Note | |------|---------|------| | `q` | `title` | Headlines only — see below | | `mkt` (`en-US`) | `language.code` + `source.country.code` | One market code becomes two filters | | `cc` | `source.country.code` | | | `setLang` | `language.code` | | | `category` | `category.id` | Bing's categories become IPTC codes | | `count` | `per_page` | 250 max (10 on Free, 50 on Starter, 200 on Basic), up from 100 | | `offset` | `offset` | Works directly | | `sortBy=Date` | `sort.by=published_at&sort.order=desc` | | | `freshness=Day` | `published_at.start=NOW-1d` | `Week` → `NOW-7d`, `Month` → `NOW-30d` | | `since` | `published_at.start` | Unix timestamp → ISO 8601 | | `originalImg` | — | `image` is always the full-size URL | | `textDecorations` / `textFormat` | `hl=true` | Highlighting, different markup | | `safeSearch` | — | No equivalent | | `Ocp-Apim-Subscription-Key` | `X-API-Key` | | The [full table](https://github.com/apitube/bing-news-api-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## Response mapping | Bing `NewsArticle` | APITube | |--------------------|---------| | `value[]` | `results[]` | | `name` | `title` | | `url` | `href` | | `description` | `description` | | `datePublished` | `published_at` | | `provider[0].name` | `source.domain` | | `image.thumbnail.contentUrl` | `image` | | `category` | `categories[]` | | `totalEstimatedMatches` | [`/v1/news/count`](/platform/news-api/count) — and it is exact, not estimated | ## What does not carry over **Search scope.** Bing's `q` covered the whole article. `title=` covers headlines. To find articles about a company, person or subject, use `organization.name`, `person.name` or `category.id`. **`safeSearch`.** No equivalent filter. **Trending topics.** `/v7.0/news/trendingtopics` becomes `/v1/news/trends?field=entity.id`, which ranks by article volume rather than search volume. **Market codes.** `mkt=en-US` bundles language and country into one value. Split it: `language.code=en` and `source.country.code=us`. ## What you gain APITube responses include article text, entities with Wikidata links, sentiment for the title, body and whole article, categories, topics, industries, publisher details and readability scores. You can also use exports, webhooks and streaming. ## Next steps * **[bing-news-api-apitube-migration-kit](https://github.com/apitube/bing-news-api-apitube-migration-kit)** — parameter and response mappings, a Node.js and Python compatibility library that returns Bing-style responses, and an AI prompt for converting multiple queries * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-gnews.md' description: >- Move from GNews.io v4 to APITube — parameter mapping for /api/v4/search, up to 250 articles per request instead of 10, and no pagination depth limit --- # Migrating from GNews Replace `/api/v4/search` with `/v1/news/everything` and `/api/v4/top-headlines` with `/v1/news/top-headlines`. Rename the parameters and check search scope: APITube searches headlines. ## Why teams switch | | GNews.io | APITube | |---|----------|---------| | **Articles per request** | **10** on Free, 25 on Essential (€49.99/mo), 50 on Business (€99.99/mo), 100 on Enterprise (€249.99/mo) | **250** on Basic and up — Starter is capped at 50 and Free at 10 | | **Pagination depth** | Hard stop at **1,000 articles** | No depth limit on paid plans | | **Article delay on Free** | **12-hour delay**, non-commercial use only | No delay, plus SSE and WebSocket streaming | | **Archive on Free** | 30 days | Years, on every plan | | **Article details** | None | Entities, sentiment, IPTC categories, readability, publisher bias | Going from 10 to 100 articles per request costs €249.99/month on GNews. Here `per_page=250` costs $99/month on Basic — and even the $29 Starter plan returns 50 per request, five times GNews Free. ## Your first request ```bash # GNews curl "https://gnews.io/api/v4/search?q=tesla&lang=en&country=us&max=10&apikey=YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&source.country.code=us&per_page=10" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | GNews | APITube | Note | |-------|---------|------| | `q` | `title` | Headlines only — see below | | `in=title` | `title` | Direct equivalent, and lossless | | `in=description,content` | — | No body-text search | | `lang` | `language.code` | Same ISO 639-1 codes | | `country` | `source.country.code` | | | `category` | `category.id` | Their 9 categories become IPTC MediaTopic codes | | `in` | — | Scope selector has no equivalent | | `nullable` | — | Use `has_image=1`, `has_author=1` instead | | `from` / `to` | `published_at.start` / `.end` | | | `sortby=publishedAt` | `sort.by=published_at` | | | `sortby=relevance` | — | See limitations | | `max` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `page` | `page` | No 1,000-article ceiling | | `expand=content` | — | Full `body` is always returned | | `apikey` | `api_key` or `X-API-Key` header | | The [full table](https://github.com/apitube/gnews-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Search scope.** GNews `q` covers title, description, and content by default. `title=` covers headlines. If your query set `in=title`, the conversion is lossless. Otherwise use an entity filter: ```bash organization.name=Tesla # NER over the full article text ``` **`sortby=relevance`.** Combined with a search term, `sort.by=relevance` currently returns `500` on APITube. Use `sort.by=published_at`. **`expand=content`.** Not needed — the full `body` comes back on every article without a parameter. ## What you gain APITube includes entities with Wikidata links, separate title and body sentiment, categories, topics, industries, publisher rank and bias, and readability scores. Export results as CSV, XLSX, Parquet, JSONL, RSS or XML. ## Next steps * **[gnews-apitube-migration-kit](https://github.com/apitube/gnews-apitube-migration-kit)** — full parameter tables, a compatibility library for Node.js and Python that keeps the GNews response format, and an AI prompt for bulk query conversion * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-marketaux.md' description: >- Move from Marketaux (api.marketaux.com) to APITube — why ticker filters have no equivalent, how entity sentiment maps precisely, and when this migration is the wrong idea --- # Migrating from Marketaux Replace `/v1/news/all` with `/v1/news/everything`. First check whether your application relies on financial-instrument filters. ## Is this migration right for you? Marketaux is a **financial** news API built on ticker symbols, exchanges and instrument types. APITube is a general news API with entity recognition. **Ticker-based searches need a different approach.** APITube has no ticker, exchange or instrument-type filter. Unsupported parameter names may be ignored: ```bash # Verified on 27 July 2026 ticker=TSLA → 3,050,338,423 articles (the entire index — the parameter is ignored) symbol=TSLA → 3,050,338,443 articles (same) ``` The closest substitute is the company name, which answers a different question: ```bash curl "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY&organization.name=Tesla" ``` That matches coverage **of the company**, not of the listed instrument. **Sentiment about individual entities has a direct equivalent.** If you use Marketaux to measure sentiment about a company or person, the same filters are available here: ```bash # all coverage of Tesla curl "https://api.apitube.io/v1/news/count?api_key=YOUR_API_KEY&organization.name=Tesla" # with negative coverage filtered out curl "https://api.apitube.io/v1/news/count?api_key=YOUR_API_KEY&organization.name=Tesla&entity.sentiment.score.min=0" ``` Both APIs include sentiment about a specific entity. You can use it to monitor negative coverage about a company. ## Parameter mapping | Marketaux | APITube | Fidelity | |-----------|---------|----------| | `symbols` | `organization.name` | **Approximate** — company, not instrument | | `entity_types` | `person.name` / `organization.name` / `location.name` | Partial | | `industries` | `industry.id` | Different taxonomies — verify each value | | `countries` | `source.country.code` | **Different meaning**: exchange country → publisher country | | `sentiment_gte` / `sentiment_lte` | `entity.sentiment.score.min` / `.max` | **Exact** | | `search` | `title` or `query` | Headlines only | | `language` | `language.code` | 34 of 37 codes work | | `domains` | `source.domain` | Max 3 | | `exclude_domains` | `ignore.source.domain` | | | `published_after` / `published_before` | `published_at.start` / `.end` | | | `limit` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `page` | `page` | | | `exchanges`, `must_have_entities`, `filter_entities` | — | No equivalent | ## Two traps worth naming **`countries` means something different.** On Marketaux it is the country of the **exchange**; on APITube `source.country.code` is where the **publisher** is based. Converting it silently answers a different question. **Use a known entity name.** A ticker-to-name mapping must use the name APITube recognises. An unknown name returns `400 ER0220`. Check the [entity mapping table](https://github.com/apitube/marketaux-apitube-migration-kit/blob/main/reference/entity-mapping.md) or search Suggest before converting requests. ## If you also use The News API Marketaux and [The News API](https://www.thenewsapi.com) share endpoint paths, response formats and search syntax. See [migrating from The News API](/platform/migrations/from-thenewsapi) for the shared parameters. The Marketaux kit also covers the financial filters. ## What you gain APITube returns full article text and sentiment scores for the title, body and individual entities. It also includes IPTC MediaTopics, topics, industries, publisher political bias, Open Page Rank and readability scores. Page sizes depend on your plan: 10 on Free, 50 on Starter, 200 on Basic and up to 250 on higher plans. You can export results in eight formats. ## Next steps * **[marketaux-apitube-migration-kit](https://github.com/apitube/marketaux-apitube-migration-kit)** — every parameter mapped, the ticker-to-company table verified entry by entry against the live API, a compatibility library for Node.js and Python, and an AI prompt that refuses to invent ticker mappings * [Migrating from The News API](/platform/migrations/from-thenewsapi) — the shared engine underneath * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-mediastack.md' description: >- Move from Mediastack v1 to APITube with parameter mappings, full article text, sentiment, entities and publisher details. --- # Migrating from Mediastack Replace `/v1/news` with `/v1/news/everything`. Convert `offset` to page-based pagination and check search scope: APITube searches headlines. ## Why teams switch | | Mediastack | APITube | |---|-----------|---------| | **Article text** | `description` only — an excerpt. No full-text field on any plan | Full `body` and `body_html` | | **Free tier** | **100 calls per month** (~3/day), delayed data, no historical access, no commercial use | Higher limits, no commercial restriction | | **Article details** | None — no sentiment, no entities, no topics, no source ranking | Sentiment, entities with Wikidata IDs, IPTC categories, publisher authority and bias | | **Article identity** | No article ID in the response | Stable integer `id` plus a lookup endpoint | | **Results per request** | 100 | **250** | ## Your first request ```bash # Mediastack curl "http://api.mediastack.com/v1/news?access_key=YOUR_KEY&keywords=tesla&languages=en&countries=us&limit=100" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&source.country.code=us&per_page=100" \ -H "X-API-Key: YOUR_API_KEY" ``` Mediastack's free tier uses HTTP. APITube uses HTTPS for all requests. ## Parameter mapping | Mediastack | APITube | Note | |------------|---------|------| | `keywords` | `title` | Headlines only — see below | | `languages` | `language.code` | Max 3 values | | `countries` | `source.country.code` | Max 3 values | | `categories` | `category.id` | Their 7 categories become IPTC codes | | `sources` | `source.domain` | Max 3, exact domain | | `date` | `published_at.start` / `.end` | A range becomes two parameters | | `sort=published_desc` | `sort.by=published_at&sort.order=desc` | | | `sort=popularity` | `sort.by=source.rank.opr` | Approximate — publisher authority | | `limit` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `offset` | `offset` | Works directly | | `access_key` | `api_key` or `X-API-Key` header | | Mediastack's negation syntax (`-cnn` inside `sources`) becomes `ignore.source.domain`. The [full table](https://github.com/apitube/mediastack-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Search scope.** `keywords` covers the title and description; `title=` covers headlines only. **`date` as a range string.** Mediastack accepts `2026-07-01,2026-07-27` in one parameter. Split it into `published_at.start` and `published_at.end`. **Response fields.** Update your response handling for the additional fields returned by APITube. ## What you gain APITube responses include full article text, entities with Wikidata links, sentiment, categories, topics, industries, publisher details, readability, share counts and article IDs. You can export results in eight formats. ## Next steps * **[mediastack-apitube-migration-kit](https://github.com/apitube/mediastack-apitube-migration-kit)** — full parameter tables derived from Mediastack's own OpenAPI spec, a compatibility library for Node.js and Python, and an AI prompt for bulk conversion * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-newsapi-ai.md' description: >- Move from NewsAPI.ai / Event Registry to APITube — Wikipedia URI translation, sentiment in every language instead of English only, and plain values instead of identifier lookups --- # Migrating from NewsAPI.ai Replace `getArticles` with `GET /v1/news/everything`. Convert Wikipedia URIs, DMOZ paths and ISO 639-3 language codes to APITube names, categories and ISO 639-1 codes. ## Why teams switch | | NewsAPI.ai | APITube | |---|-----------|---------| | **Sentiment coverage** | **English only** — their docs state that setting `minSentiment`/`maxSentiment` reduces results to English articles | Every language | | **Free tier** | 2,000 searches **one time**, not renewed; last 30 days only | Renewing quota | | **Entity identity** | Wikipedia URIs — an autosuggest call before you can search | Plain names, plus Wikidata links on the response | | **Category taxonomy** | DMOZ — a directory discontinued in 2017 | IPTC MediaTopics, actively maintained | | **Articles per request** | 100 | **250** | Check the limitations below if you rely on body-text search, events or concept matching. ## Your first request ```jsonc // NewsAPI.ai — POST with a JSON body { "action": "getArticles", "keyword": "Tesla Inc", "keywordLoc": "title", "lang": "eng", "sourceLocationUri": ["http://en.wikipedia.org/wiki/United_States"], "articlesCount": 100, "apiKey": "YOUR_KEY" } ``` ```bash # APITube — a plain GET curl "https://api.apitube.io/v1/news/everything?title=Tesla&language.code=en&source.country.code=us&per_page=100" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Identifier translation Convert these four kinds of identifiers: ``` conceptUri=http://en.wikipedia.org/wiki/Tesla,_Inc. → organization.name=Tesla conceptUri=http://en.wikipedia.org/wiki/Elon_Musk → person.name=Elon Musk sourceLocationUri=.../Germany → source.country.code=de locationUri=.../Germany → location.name=Germany categoryUri=dmoz/Business → category.id=medtop:04000000 lang=eng → language.code=en authorUri=mark_mazzetti@nytimes.com → author.name=Mark Mazzetti ``` Use the name after the last `/` in the URI. Replace underscores with spaces, then remove company suffixes and words used to distinguish entries with the same name. `sourceLocationUri` describes where the publisher is; `locationUri` describes the place the article is about. Use a different filter for each. ## Parameter mapping | NewsAPI.ai | APITube | Note | |------------|---------|------| | `keyword` | `title` | Headlines only | | `keywordLoc=title` | `title` | Lossless | | `conceptUri` | `person.name` / `organization.name` / `location.name` | Translate the URI first | | `categoryUri` | `category.id` | DMOZ → IPTC; 7 top-level paths confirmed | | `lang` | `language.code` | ISO 639-3 → ISO 639-1; **8 of 57 have no equivalent** | | `sourceUri` | `source.domain` | No translation needed | | `minSentiment` / `maxSentiment` | `sentiment.overall.score.min` / `.max` | Same −1…1 scale, and **not limited to English** | | `dateStart` / `dateEnd` | `published_at.start` / `.end` | | | `articlesCount` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `articlesPage` | `page` | | | `articlesSortBy=date` | `sort.by=published_at` | | | `ignoreSourceGroupUri=paywall/*` | `is_paywall=0` | | The [full table](https://github.com/apitube/newsapi-ai-apitube-migration-kit/blob/main/reference/parameter-mapping.md), including all 57 language codes and the URI translation algorithm, is in the migration kit. ## What does not carry over **The events model.** `getEvents`, `eventUri`, and the breaking-events feed have no counterpart. APITube clusters articles into stories (`story.id`) but does not expose an event object. This is the main reason a team might decide not to migrate. **Body-text search.** `keywordLoc` defaults to `body`. APITube searches headlines. **Concept disambiguation at query time.** `Apple_Inc.` and `Apple` are different concepts on NewsAPI.ai. `organization.name=Apple` is one name — the entity type narrows it, but not as precisely. **Eight languages.** `kaz`, `kur`, `mal`, `mar`, `pan`, `rus`, `ukr`, and `gsw` have no APITube equivalent. Belarusian `bel` maps to `by`, not the ISO `be`. **`articlesSortBy=rel`.** Combined with a search term, `sort.by=relevance` currently returns `500`. ## What you gain APITube returns sentiment in every language, IPTC MediaTopics categories and filter values you can use without a separate lookup. Articles also include separate title and body sentiment, a clickbait flag and publisher bias. You can export results in eight formats. Page sizes are 10 on Free, 50 on Starter, 200 on Basic and up to 250 on higher plans. ## Next steps * **[newsapi-ai-apitube-migration-kit](https://github.com/apitube/newsapi-ai-apitube-migration-kit)** — the URI translation reference, all 57 language codes, a compatibility library for Node.js and Python that keeps the Event Registry response format, and an AI prompt for bulk conversion * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-newsapi-org.md' description: >- Move from NewsAPI.org v2 to APITube — parameter mapping for /v2/everything and /v2/top-headlines, full article text instead of 200-character excerpts, and no 24-hour delay --- # Migrating from NewsAPI.org Replace `/v2/everything` with `/v1/news/everything` and `/v2/top-headlines` with `/v1/news/top-headlines`. Most parameters have equivalents. Check headline-only search and convert `sources` to `source.domain`. ## Why teams switch | | NewsAPI.org | APITube | |---|-------------|---------| | **Article text** | `content` truncated to **200 characters** — their FAQ states full content is unavailable on *any* plan | Full `body` and `body_html` | | **Article delay on Free** | **24-hour delay**; the Developer plan is licensed for development only, never production | No artificial delay, plus SSE and WebSocket streaming | | **`country` on top-headlines** | Accepts **`us` only** — the other 53 country codes were removed from the parameter | `source.country.code` covers 178 countries on every endpoint | | **Articles per request** | 100 | **250** | | **Article details** | None | Entities, sentiment, IPTC categories, readability, publisher bias | ## Your first request ```bash # NewsAPI.org curl "https://newsapi.org/v2/everything?q=tesla&language=en&pageSize=100&sortBy=publishedAt&apiKey=YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&per_page=100&sort.by=published_at&sort.order=desc" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | NewsAPI.org | APITube | Note | |-------------|---------|------| | `q` | `title` | Headlines only — see below | | `qInTitle` | `title` | Direct equivalent, and lossless | | `sources` | `source.domain` | Their source **IDs** (`bbc-news`) become **domains** (`bbc.co.uk`). Max 3 | | `domains` | `source.domain` | Max 3 | | `excludeDomains` | `ignore.source.domain` | | | `language` | `language.code` | Same ISO 639-1 codes | | `country` | `source.country.code` | Works on every endpoint here, not just source lookup | | `category` | `category.id` | Their 7 categories become IPTC MediaTopic codes | | `from` / `to` | `published_at.start` / `.end` | | | `sortBy=publishedAt` | `sort.by=published_at` | | | `sortBy=popularity` | `sort.by=source.rank.opr` | Approximate — publisher authority, not article popularity | | `sortBy=relevancy` | — | See limitations | | `pageSize` | `per_page` | 250 max (10 on Free, 50 on Starter, 200 on Basic), up from 100 | | `page` | `page` | | | `apiKey` | `api_key` or `X-API-Key` header | | The [full table of all 15 parameters](https://github.com/apitube/newsapi-org-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Search scope.** `q` matches the title, description, and content; `title=` matches headlines. If your query used `qInTitle`, the conversion is lossless — check that first. Otherwise, filter on the entity instead: ```bash organization.name=Tesla # NER over the full article text ``` **`sortBy=relevancy`.** Combined with a search term, `sort.by=relevance` currently returns `500` on APITube. Use `sort.by=published_at` instead. **Source IDs.** `bbc-news`, `the-verge`, and the rest are NewsAPI.org's own identifiers. Resolve them to domains through their `/v2/sources` endpoint before migrating, then filter with `source.domain`. **`/v2/top-headlines/sources`.** No dedicated endpoint here. `/v1/news/trends?field=source.id` returns domains ranked by article volume. ## What you gain Every article carries entities with Wikidata links, sentiment split into title/body/overall, IPTC categories plus topics and industries, readability scores, publisher bias and authority rank, and the full body text. See [Response structure](/platform/news-api/response-structure). ## Next steps * **[newsapi-org-apitube-migration-kit](https://github.com/apitube/newsapi-org-apitube-migration-kit)** — full parameter tables, a compatibility library for Node.js and Python that keeps the NewsAPI.org response format, and an AI prompt that rewrites your saved queries * [Parameters reference](/platform/news-api/filters#parameters) — every filter APITube supports * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) — the 3-value cap, silent parameter drops, wildcards --- --- url: 'https://docs.apitube.io/platform/migrations/from-newscatcher.md' description: >- Move from NewsCatcher News API v3 to APITube — parameter mapping for /api/search, IPTC tags without a plan upgrade, and self-serve signup instead of a sales call --- # Migrating from NewsCatcher Replace `/api/search` with `/v1/news/everything`. Entity, sentiment and IPTC filters have equivalents. Check search scope, results per request and the two Chinese language codes. ## Why teams switch | | NewsCatcher | APITube | |---|-------------|---------| | **Getting a key** | Fill in a form, book a demo, talk to sales. No public pricing | Sign up, key in the dashboard, first request in a minute | | **IPTC tags** | `v3_nlp_iptc_tags` — a paid plan tier | Standard filter on every plan | | **Articles per request** | 1,000 | 250 | | **Sentiment** | Title and content | Title, body, **and overall**, plus per-entity | | **Query syntax** | Boolean, wildcards, `NEAR()` proximity | Boolean and phrase proximity; **no wildcards** | NewsCatcher allows more articles per request. Check this limit when planning batch requests. ## Your first request ```bash # NewsCatcher curl "https://v3-api.newscatcherapi.com/api/search?q=Tesla&lang=en&countries=US&page_size=100&sort_by=date" \ -H "x-api-token: YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=Tesla&language.code=en&source.country.code=us&per_page=100&sort.by=published_at&sort.order=desc" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | NewsCatcher | APITube | Note | |-------------|---------|------| | `q` | `title` | Headlines only — see below | | `search_in=title` | `title` | Lossless | | `lang` | `language.code` | **`cn` and `tw` both become `zh`** | | `countries` | `source.country.code` | Either case works | | `sources` | `source.domain` | Max 3, exact domain | | `not_sources` | `ignore.source.domain` | | | `theme` | `category.id` | 16 themes → IPTC codes | | `iptc_tags` | `category.id` | Prefix the numeric ID with `medtop:` — **no plan upgrade needed** | | `ORG_entity_name` | `organization.name` | | | `PER_entity_name` | `person.name` | | | `LOC_entity_name` | `location.name` | | | `title_sentiment_min` / `_max` | `sentiment.title.score.min` / `.max` | Same −1…1 scale | | `content_sentiment_min` / `_max` | `sentiment.body.score.min` / `.max` | | | `exclude_duplicates` | `is_duplicate=0` | | | `from_` / `to_` | `published_at.start` / `.end` | | | `sort_by=date` | `sort.by=published_at` | | | `page_size` | `per_page` | 250 max (10 on Free, 50 on Starter, 200 on Basic), down from 1,000 | The [full table of all 57 parameters](https://github.com/apitube/newscatcher-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Search scope.** `search_in` defaults to `title_content`. APITube searches headlines. If your query already set `search_in: "title"`, the conversion is lossless. **Wildcards.** `technolog*` has no equivalent, and passing it through returns the **entire index** with a `200`. Expand it by hand into an `OR` list. **`NEAR()` proximity.** APITube uses `"a b"~N` to allow gaps between words in a headline. For example, `title="a b"~5` allows a gap of up to 5 positions; the maximum is 10. NewsCatcher's `NEAR()` can span 100 words across the whole article. **Clustering.** `clustering_enabled` returns grouped results. APITube puts a `story.id` on every article but has no clustered response format. **Chinese.** NewsCatcher uses `cn` and `tw`; APITube uses `zh` for both, so the China/Taiwan distinction is lost. **Entity names must match exactly.** `organization.name=Apple Inc` returns `400`; `Apple` works. Check with `/v1/suggest/entities?prefix=…`. ## What you gain IPTC MediaTopics without a plan upgrade, sentiment towards a specific entity (`entity.sentiment.score`), publisher political bias, readability scoring, geo search by coordinates, and export to eight formats. ## Next steps * **[newscatcher-apitube-migration-kit](https://github.com/apitube/newscatcher-apitube-migration-kit)** — all 57 parameters, the 16-theme IPTC table verified against the live API, a compatibility library for Node.js and Python, and an AI prompt for bulk conversion * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-newsdata-io.md' description: >- Move from NewsData.io v1 to APITube — parameter mapping for /api/1/latest, sentiment and AI entities on every plan instead of $349 and $1,299 tiers --- # Migrating from NewsData.io Replace `/api/1/latest` and `/api/1/archive` with `/v1/news/everything`. Convert `nextPage` tokens to numbered pages and check headline-only search. ## Why teams switch | | NewsData.io | APITube | |---|-------------|---------| | **Sentiment analysis** | Professional plan — **$349.99/month** | Every plan, on every article | | **AI entities** (`ai_org`, `ai_region`) | Corporate plan — **$1,299.99/month** | Every plan, with Wikidata IDs | | **Articles per request** | 50 on paid plans, **10 on Free** | **250** on Basic and up — Starter is capped at 50 and Free at 10 | | **Article delay on Free** | **12-hour delay**, no archive | No delay, plus SSE and WebSocket streaming | | **Archive** | 6 months / 2 years / 10 years by tier | Years, on every plan | ## Your first request ```bash # NewsData.io curl "https://newsdata.io/api/1/latest?apikey=YOUR_KEY&q=tesla&language=en&country=us&size=10" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&source.country.code=us&per_page=10" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | NewsData.io | APITube | Note | |-------------|---------|------| | `q` | `title` | Headlines only — see below | | `qInTitle` | `title` | Lossless | | `qInMeta` | — | No metadata search | | `language` | `language.code` | Max 3 values | | `country` | `source.country.code` | Max 3 values | | `category` | `category.id` | Their categories become IPTC codes | | `excludecategory` | `ignore.category.id` | | | `domain` / `domainurl` | `source.domain` | Max 3, exact domain | | `excludedomain` | `ignore.source.domain` | | | `sentiment` | `sentiment.overall.polarity` | **Free here, $349.99/mo there** | | `tag` | `topic.id` | | | `timeframe` | `published_at.start` | `24` → `NOW-24h`; minutes need an absolute timestamp | | `from_date` / `to_date` | `published_at.start` / `.end` | | | `size` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `page` (token) | `page` (number) | See below | | `apikey` | `api_key` or `X-API-Key` header | | The [full table](https://github.com/apitube/newsdata-io-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Pagination.** NewsData.io uses a `nextPage` token. APITube uses page numbers and returns a ready-to-use `next_page` URL. You cannot reuse stored tokens; restart pagination. **Search scope.** `q` covers title and content. `title=` covers headlines. If your query used `qInTitle`, the conversion is lossless. **`timeframe` in minutes.** `timeframe=15` means 15 minutes on NewsData.io. APITube has no minute unit — `NOW-15m` would mean 15 **months**. Use an absolute ISO timestamp for sub-hour windows. **Article IDs.** NewsData.io uses string `article_id`; APITube uses integers. An ID from one API cannot be used in the other. ## What you gain APITube includes sentiment and entities on plans below NewsData.io's $349/$1,299 tiers. It also returns full article text, IPTC MediaTopics, topics, industries, publisher bias and rank, and readability scores. You can search by location and export results in eight formats. ## Next steps * **[newsdata-io-apitube-migration-kit](https://github.com/apitube/newsdata-io-apitube-migration-kit)** — full parameter tables derived from NewsData.io's own OpenAPI spec, a compatibility library for Node.js and Python, and an AI prompt for bulk conversion * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-perigon.md' description: >- Move from Perigon to APITube with parameter mappings and guidance on pagination, search operators and sentiment scores. --- # Migrating from Perigon Replace `/v1/all` with `/v1/news/everything`. Check three differences: page numbers start at 1, adjacent search terms use AND, and sentiment scores use a different scale. ## Why teams switch | | Perigon | APITube | |---|---------|---------| | **Articles per request** | 100 | **250** | | **Sentiment** | Three probabilities per article | Signed score for **title, body, overall, and per entity** | | **Category taxonomy** | 15 fixed names | IPTC MediaTopics — thousands of codes, plus topics and industries | | **Publisher metadata** | Source name and domain | Domain, country, **political bias**, Open Page Rank | | **Article text** | Full content | Full `body` and `body_html`, plus a `summary` made from sentences in the article | ## Your first request ```bash # Perigon — page 0 is the first page curl "https://api.goperigon.com/v1/all?q=tesla&language=en&page=0&size=100" \ -H "x-api-key: YOUR_KEY" ``` ```bash # APITube — page 1 is the first page curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&page=1&per_page=100" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Three differences to handle {#the-three-traps} **1. Convert page numbers.** Perigon starts at 0; APITube starts at 1. APITube treats `page=0` as page 1, so forwarding page numbers unchanged can repeat the first page. Send `perigon_page + 1`. **2. Choose AND or OR explicitly.** Perigon reads `q=Elon Musk` as *Elon OR Musk*. APITube reads `title=Elon Musk` as *Elon AND Musk*. Use `query=title:(Elon OR Musk)` to keep OR matching. Quoted phrases such as `"Elon Musk"` work the same way on both. **3. Sentiment scores need adjustment.** Perigon returns `positive`, `negative` and `neutral` probabilities that add up to 1. APITube returns a score from negative to positive for each sentiment field. Use `score ≈ positive − negative` as a starting point: `positiveSentimentFrom=0.6` becomes `sentiment.overall.score.min=0.2`. Check the results and adjust the threshold. There is no equivalent for `neutralSentimentFrom` or `neutralSentimentTo`. ## Parameter mapping | Perigon | APITube | Note | |---------|---------|------| | `q` | `title` or `query` | Headlines only, and the default operator inverts — see above | | `title` | `title` | Lossless | | `content`, `desc`, `url` | — | No body, description or URL search | | `category` | `category.id` | 13 of 15 names map to IPTC codes, max 3 | | `excludeCategory` | `ignore.category.id` | | | `topic` | `topic.id` | Different taxonomies — verify each value | | `source` | `source.domain` | Max 3, exact domain | | `excludeSource` | `ignore.source.domain` | | | `sourceCountry` | `source.country.code` | | | `companyName` | `organization.name` | Strip legal suffixes — `Apple Inc` returns `400` | | `personName` | `person.name` | Must match a person name known to the API | | `companyDomain` | — | **Different meaning** — the company's site, not the publisher | | `companyId`, `personWikidataId` | — | APITube entity ids are its own | | `byline` | `author.name` | Real journalist names only; desk names return `400` | | `language` | `language.code` | No `ru`, no `uk` | | `from` / `to` | `published_at.start` / `.end` | | | `addDateFrom`, `refreshDateFrom` | — | Publication date only | | `positiveSentimentFrom` / `To` | `sentiment.overall.score.min` / `.max` | Approximate | | `negativeSentimentFrom` / `To` | `sentiment.overall.score.max` / `.min` | Approximate, sign inverts | | `neutralSentimentFrom` / `To` | — | No neutral axis | | `showReprints=false` | `is_duplicate=0` | Reprint **grouping** is lost | | `medium=Video` | `has_video=1` | "Has a video" ≠ "is a video" | | `lat` / `lon` / `maxDistance` | `/v1/news/local` `lat` / `lng` / `radius` | A different endpoint | | `page` | `page` | **+1** | | `size` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic (`400 ER0171` above) | | `sortBy=date` | `sort.by=published_at` | | | `sortBy=relevance` | — | Returns `500` with a search term; use `sort.by=source.rank.opr` | The [full table of every Articles parameter](https://github.com/apitube/perigon-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Body-text search.** `content=`, `desc=` and `url=` have no equivalent, and APITube **ignores unknown parameters silently** — forwarding them returns the whole index with a `200`. Search headlines and filter the returned `body` locally. **Wildcards.** `q=immuni*` fails the same way: `title=immuni*` is accepted and returns the entire index. Expand into `query=title:(immunity OR immunization OR immunology)`. **Relevance boosting.** `^2` has no equivalent. Sent verbatim it becomes a literal search term. **Google Content Categories.** `taxonomy=/Finance/Banking` and `prefixTaxonomy` use a hierarchy with no mechanical mapping to IPTC. Pick an IPTC code by hand. **Grouped and related articles.** APITube has no equivalent for `/v1/stories/all` or its `clusterId` filter. Each article has `story.id`, which you can use to group results in your code. There is no equivalent for `/v1/vector/news/all` or vector embeddings, the numeric representations used for similarity search. For article summaries, use the `summary` array instead of `/v1/summarize`. **Russian and Ukrainian.** `language.code=ru` and `uk` return `400 ER0237`. There is no substitute. ## What you gain APITube returns up to 250 articles per request, compared with Perigon's 100. The limits are 10 on Free, 50 on Starter and 200 on Basic. Articles include separate title and body sentiment, sentiment about each entity, IPTC MediaTopics, topics, industries, publisher political bias, Open Page Rank and readability scores. Results can be exported in eight formats. ## Next steps * **[perigon-apitube-migration-kit](https://github.com/apitube/perigon-apitube-migration-kit)** — Articles parameter mappings, 13 verified category codes, query and sentiment conversion guides, and Node.js and Python compatibility libraries (101 tests). Includes an AI prompt for converting multiple queries. * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-quantexa.md' description: >- Move from Quantexa News API v6 to APITube — AQL entity blocks rewritten as parameters, cursor paging replaced by page numbers, and the three endpoints that need rebuilding --- # Migrating from Quantexa (Aylien) News API Replace `/v6/news/stories` with `/v1/news/everything`. Use an API key instead of an OAuth token. Rewrite Aylien Query Language filters and cursor pagination using the mappings below. ## Before you start: the API is not reachable `docs.aylien.com` and `api.aylien.com` **no longer resolve** — `NXDOMAIN` on both, checked against Cloudflare's resolver on 27 July 2026. Their status page still reads "All Systems Operational", so the public health indicator disagrees with DNS. There is no formal end-of-life announcement; only the February 2023 acquisition, the rebrand from AYLIEN News API to Quantexa News API, and the company's own note that some previously well-served use cases are "no longer as strong a fit". The mapping below is therefore derived from the official v6 documentation as archived on 19 June 2025. The APITube side was executed against the live API. ## Why teams switch | | Quantexa News API v6 | APITube | |---|---------------------|---------| | **Availability** | Domains do not resolve | Live | | **Per request** | 100 stories | **250** | | **Paging** | Cursor (`next_page_cursor`) | `page` + `per_page` | | **Auth** | OAuth bearer token | `X-API-Key` header, no exchange | | **Sentiment** | `positive` / `neutral` / `negative` label | Signed score per axis, **plus per entity** | | **Categories** | IPTC MediaTopics + IAB | IPTC MediaTopics | | **Rate limit** | 60/minute | 50/minute paid, 10/minute free | ## Your first request ```bash # Quantexa v6 (documented form — the host no longer resolves) curl "https://api.aylien.com/v6/news/stories?title=tesla&language=en&per_page=100" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&per_page=100" \ -H "X-API-Key: YOUR_API_KEY" ``` ## AQL entity blocks become parameters Convert entity conditions in `aql` entities:{{ ... }} blocks to separate API parameters: | AQL condition | APITube | |---------------|---------| | `surface_forms.text` + `type:Person` | `person.name` | | `surface_forms.text` + `type:Organization` | `organization.name` | | `surface_forms.text` + `type:Location` | `location.name` | | `stock_ticker` | — **no ticker filter exists** | | `overall_prominence`, `overall_frequency` | — not filterable (frequency is in the response) | | `links.wikidata` | — not filterable (the link is in the response) | | `type:` alone | — APITube filters by named entity, not by type | Names resolve against an index: `organization.name=Apple` works, `Apple Inc` returns `400 ER0220`; `location.name=New York City` works, `New York` returns `400 ER0218`. The endpoint that used to be `/v2/autocomplete/suggestions/entity-names` is now `/v1/suggest/entities?prefix=`. ## Parameter mapping | Quantexa | APITube | Note | |----------|---------|------| | `title` | `title` | Lossless | | `text` | `title` | **Narrows** — Quantexa matched title and body | | `body` | — | No body-text search | | `aql` | `person.name` / `organization.name` / `location.name` | See above | | `categories` (IPTC) | `category.id` | Same numbers, `medtop:` prefix | | `categories` (IAB) | — | No IAB taxonomy | | `industries` | `industry.id` | Different id spaces — verify each value | | `source.domain` | `source.domain` | Max 3 | | `source.name` | — | **Does not exist** — sending it returns the whole index | | `source.id` | `source.id` | Different id spaces; remap through the domain | | `source.locations.country` | `source.country.code` | | | `source.scopes.*` | — | No editorial-scope filter | | `source.rankings.alexa.rank` | `source.rank.opr` | Alexa is discontinued; different scale | | `author.name` | `author.name` | Desk names return `400 ER0204` | | `sentiment.title.polarity` | `sentiment.title.score.min` / `.max` | Label → score band | | `published_at` `[* TO *]` | `published_at.start` / `.end` | Range becomes two parameters | | `language` | `language.code` | No `ru`, no `uk` | | `per_page` | `per_page` | 100 → 250 (10 on Free, 50 on Starter, 200 on Basic) | | `cursor` | `page` | Cursor paging → page numbers | | `sort_by=relevance` | — | Returns `500 ER0183` with a search term | | `return[]` | — | No field selection | The [full table](https://github.com/apitube/quantexa-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## Category IDs differ between filters and responses {#categories-are-asymmetric-—-worth-knowing-before-you-debug-it} **Filtering** wants the code with a prefix: `category.id=medtop:04000000`. **Response IDs differ.** The category `id` is numeric; the IPTC code appears in `links.self`: ```json { "id": 199, "name": "economy, business and finance", "taxonomy": "iptc_mediatopics", "links": { "self": ".../iptc_mediatopics/medtop:04000000" } } ``` APITube lists 1,085 category codes. Most child categories use codes in the `20000xxx` range. Check each child code before using it; codes from other branches may be unavailable: ```bash # 400 ER0206 "category with ID 'medtop:01005000' not found." curl "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY&category.id=medtop%3A01005000" ``` Top-level codes are a mechanical rename; check each child code and fall back to its parent where missing. ## Three endpoints need rebuilding | Quantexa v6 | APITube | |-------------|---------| | `/v6/news/stories` | `/v1/news/everything` | | `/v6/news/trends` | `/v1/news/trends` — adds `growth_rate` | | `/v6/news/histograms` | Repeated `/v1/news/count`, one call per interval | | `/v6/news/time_series` | Repeated `/v1/news/count` | | `/v6/news/clusters` | **Nothing** | To build a daily series, call `/v1/news/count` once for each day. APITube does not return counts by time interval from a single request. APITube also has no endpoint for article clusters. Articles about the same story share `story.id`, so group them in your code. There is no `story_count`, `earliest_story` or `latest_story` field, and `story.id` cannot be used as a filter. ## What does not carry over **Body search.** No `body=` parameter, and unknown parameters are **ignored silently** — a forwarded one returns the whole index with a `200`. **Sentiment as a label.** Quantexa filters on `positive`, `neutral` or `negative`; APITube uses a numeric score. Choose score thresholds for each label, check the returned articles and adjust them. There is no exact conversion. **Cursor paging.** Real Quantexa cursors cannot be translated — they encode sort values from an index that no longer exists. **Russian and Ukrainian.** `400 ER0237`, no substitute. ## What you gain APITube includes sentiment about each entity, using filters such as `entity.sentiment.score.min`, as well as overall sentiment. It also provides topics and industries alongside IPTC categories, publisher bias and rank, readability, `growth_rate` for trends and eight export formats. Page sizes depend on your plan: 10 on Free, 50 on Starter, 200 on Basic and up to 250 on higher plans. ## Next steps * **[quantexa-apitube-migration-kit](https://github.com/apitube/quantexa-apitube-migration-kit)** — v6 parameter mappings for all five endpoints, an AQL query converter, and Node.js and Python compatibility libraries (91 tests, identical output). Includes an AI prompt that flags unsupported endpoints. * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-scrapingbee.md' description: >- Replace ScrapingBee news searches with APITube. Compare request mappings, costs and tasks that still need web scraping. --- # Migrating from ScrapingBee Use this guide to replace news searches and supported news-article requests from ScrapingBee. APITube does not replace general web scraping. The mappings cover Google Search API requests with `search_type=news` and article requests for publishers covered by APITube. ## Why use APITube for news collection? {#why-teams-move-the-news-half} | | ScrapingBee | APITube | |---|-------------|---------| | **Article text** | One fetch per article, then your extraction rules | `body` and `body_html` in the same response | | **Per request** | One page | Up to 250 articles (10 on Free, 50 on Starter, 200 on Basic) | | **Cost model** | Credits per request: 1 without JS, 5 with, 10–25 premium proxy, 75 stealth, 15 for a Google search | No per-request credit | | **Discovery** | RSS parsing, sitemap crawling, or SERP scraping | Search for articles with API filters | | **Extraction** | Per-publisher selectors that break on redesigns | Structured fields | | **Article details** | Yours to build | Entities, sentiment, IPTC categories, topics, industries, readability, publisher bias | ScrapingBee credit costs depend on options such as `render_js` and `premium_proxy`. See [ScrapingBee's knowledge base](https://help.scrapingbee.com/en/article/credit-system-explained-1h2ackp/). APITube returns article text with the search results, so you do not need a separate fetch request for every article. ## Your first request ```bash # ScrapingBee curl "https://app.scrapingbee.com/api/v1/store/google?search=tesla&search_type=news&country_code=us" \ -H "Authorization: Bearer YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&source.country.code=us" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | ScrapingBee | APITube | Note | |-------------|---------|------| | `search` | `title`, `query`, `source.domain`, `published_at.*` | Google operators split into separate parameters | | `search_type=news` | — | Endpoint choice. The other seven values have no equivalent | | `country_code` | `source.country.code` | **Proxy** country → **publisher** country. `uk` must become `gb` | | `extra_params[hl]` | `language.code` | Two letters only; `en-US` returns `400 ER0061` | | `extra_params[gl]` | `source.country.code` | Same caveat as `country_code` | | `extra_params[num]` | `per_page` | Max 250; 10 on Free, 50 on Starter, 200 on Basic | | `extra_params[start]` | `page` | Offset → page number | | `extra_params[tbs]` | `published_at.start` / `.end` | Write the bound explicitly | | `url` | — | **No URL lookup exists** — see below | | `extract_rules` | `title`, `body`, `published_at`, `author.name`, `image` | The fields are already there | | `render_js`, `premium_proxy`, `wait*`, `block_*` | — | Not needed: the API returns article content directly | | `js_scenario`, `screenshot*`, `cookies`, `session_id` | — | **Keep ScrapingBee** | Operators inside `search`: `site:` → `source.domain`, `-site:` → `ignore.source.domain`, `when:7d` → `published_at.start=NOW-7d`, `-term` → `ignore.title`, `intitle:` needs no equivalent because APITube already searches only headlines. `inurl:` has no equivalent. ## URL lookup is not supported {#the-trap-that-matters-most} **There is no URL lookup, and the obvious parameter names fail silently.** ```bash curl "https://api.apitube.io/v1/news/count?api_key=YOUR_API_KEY&href=https%3A%2F%2Fwww.bbc.co.uk%2Fnews%2Farticles%2Fc8dng1v72lno" # {"count":3050326333} ← the entire index ``` APITube does not support URL lookup with `href=`, `url=`, `article.href=` or `link=`. These parameters may be ignored while the request returns `200`. Search by topic, entity or publisher instead. ## Tasks that still need ScrapingBee {#what-stays-a-scrape} * Sites that are not news publishers — competitor pages, government portals, forums, e-commerce * Anything behind a login (`cookies`, `session_id`) * Anything interactive (`js_scenario` — consent walls, "load more", pagination) * Screenshots * Extracting specific elements from a web page's HTML * Fetching one specific URL Keep ScrapingBee for these tasks. The [migration kit](https://github.com/apitube/scrapingbee-apitube-migration-kit) lists them in `reference/what-you-keep-scraping.md`. ## Check your domains first ```bash curl "https://api.apitube.io/v1/news/count?api_key=YOUR_API_KEY&source.domain=example.com" ``` A count request can return a positive count, `{"count": 0}` with HTTP `200`, or `400 ER0214` for an unknown source. Check the count as well as the status to confirm coverage. ## Other migration differences to check {#other-things-that-will-bite} **Search is headlines-only.** No body-text parameter. Filter on `organization.name` instead of a keyword, or filter the returned `body` locally. **`NOW-30m` means thirty months.** APITube reads `m` as months. `NOW-1h`, `NOW-7d` and `NOW-1y` behave as expected; there is no minutes unit. **Wildcards return everything.** `title=immuni*` gives `200` and the whole index. Expand into `query=title:(immunity OR immunization OR immunology)`. **Unknown parameters are ignored.** A forwarded `search=` or `render_js=` produces a successful-looking response with the query unfiltered. ## What you gain APITube returns article text, entities with per-entity sentiment, separate title and body sentiment, categories, topics, industries, publisher details and readability scores. Responses also include `is_duplicate` and `story.id`, and support eight export formats. ## Next steps * **[scrapingbee-apitube-migration-kit](https://github.com/apitube/scrapingbee-apitube-migration-kit)** — news search and article request mappings, a list of tasks that still need scraping, and Node.js and Python compatibility libraries (73 tests, identical output). Includes an AI prompt that flags requests it cannot convert. * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-serpapi.md' description: >- Move from SerpApi's engine=google_news to APITube — operator mapping for site:/when:, pagination that SerpApi does not have, and the article body that removes your scraping stage --- # Migrating from SerpApi Google News Replace `https://serpapi.com/search?engine=google_news` with `/v1/news/everything`. Convert operators inside `q`, such as `site:` and `when:`, to separate parameters. APITube returns article text with the search results. ## Why teams switch | | SerpApi Google News | APITube | |---|---------------------|---------| | **Article text** | **None** — you follow the link and fetch it yourself | Full `body` and `body_html` in the response | | **Pagination** | **None** — one request, one page | `page` + `per_page`, up to 250 (10 on Free, 50 on Starter, 200 on Basic) | | **Total count** | Not reported | `/v1/news/count` | | **Filtering** | Google's `q` operators | 60+ parameters you can combine in one request | | **Article details** | None | Entities, sentiment (title/body/overall/per-entity), IPTC categories, topics, industries, publisher bias and rank, readability | | **Result identity** | Search-result tokens | Stable integer IDs | Check how search scope, coverage and response fields differ below. ## Your first request ```bash # SerpApi curl "https://serpapi.com/search?engine=google_news&q=tesla&gl=us&hl=en&api_key=YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&source.country.code=us&language.code=en" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Operators become parameters | In `q` | APITube | |--------|---------| | `tesla` | `title=tesla` | | `tesla musk` | `title=tesla,musk` (comma is AND, as on Google) | | `"artificial intelligence"` | `title="artificial intelligence"` | | `tesla OR rivian` | `query=title:(tesla OR rivian)` | | `tesla -musk` | `title=tesla` + `ignore.title=musk` | | `site:bbc.co.uk` | `source.domain=bbc.co.uk` | | `-site:cnn.com` | `ignore.source.domain=cnn.com` | | `when:7d` | `published_at.start=NOW-7d` | | `after:` / `before:` | `published_at.start` / `.end` | | `intitle:` / `allintitle:` | Nothing — APITube only searches headlines anyway | | `location:"New York City"` | `location.name=New York City` | | `source:BBC` | `source.domain=bbc.co.uk` — **`source.name` does not exist** | Inside `query=`, every bare term needs its `title:` prefix: `query=tesla OR rivian` does not search headlines at all. The [full operator reference](https://github.com/apitube/serpapi-apitube-migration-kit/blob/main/reference/query-operators.md) is in the migration kit. ## Parameter mapping | SerpApi | APITube | Note | |---------|---------|------| | `q` | `title`, `query`, `source.domain`, `published_at.*` | Splits — see above | | `gl` | `source.country.code` | Google's search country → the publisher's country. **`uk` must become `gb`** | | `hl` | `language.code` | Interface language → article language. Two letters only | | `so=1` | `sort.by=published_at&sort.order=desc` | | | `so=0` | — | `sort.by=relevance` returns `500` with a search term | | `topic_token`, `section_token` | `category.id` / `topic.id` | Google-specific tokens; choose APITube categories or topics manually | | `publication_token` | `source.domain` | | | `story_token` | — | `story.id` groups articles but is not a filter | | `kgmid` | `organization.name` / `person.name` | | | `no_cache`, `async`, `zero_trace`, `device` | — | They describe how SerpApi scrapes Google | | `output=html` | — | JSON, plus eight export formats | | — | `page`, `per_page` | New: SerpApi has no pagination | ## What does not carry over **Relevance ordering.** `sort.by=relevance` returns `500 ER0183` when a search term is present. Use `sort.by=published_at`, or `sort.by=source.rank.opr` to order results by the publisher's Open Page Rank. This ranks publishers rather than individual articles. **Body-text search.** APITube searches headlines. There is no `content=`, and **unknown parameters are ignored silently** — a forwarded one returns the whole index with a `200`. The compensation is that the body is in the response, so filter locally. **Wildcards.** `title=immuni*` is accepted and returns the entire index with a `200`. Expand into `query=title:(immunity OR immunization OR immunology)`. **`when:30m`.** APITube reads `m` as **months**: `NOW-30m` returns 28 509 of 29 747 `title=tesla` articles. `NOW-1h`, `NOW-7d` and `NOW-1y` behave as expected; there is no minutes unit. **Google's clustering.** `highlight` and `stories[]` have no counterpart. Articles covering the same story share a `story.id`, but there is no lead article and no cluster endpoint. **Russian and Ukrainian.** `language.code=ru` and `uk` return `400 ER0237`. Google's regional forms (`en-US`, `pt-BR`, `zh-CN`) return `400 ER0061` — two-letter codes only. ## Two things to check before cutting over **Check domain coverage.** Map `site:` to `source.domain`, then check `/v1/news/count`. HTTP `200` with a count of zero means there are no matching articles. **Do not add a country filter on top of a domain.** Many publishers carry `country_code: "un"` in the source index, so `source.domain=theguardian.com&source.country.code=gb` returns nothing while the domain alone returns thousands. ## What you gain Search results include `body`, `body_html`, `summary`, entities and sentiment. You also get separate title and body sentiment, IPTC categories, topics, industries, publisher details, readability and eight export formats. Use pages to fetch more results: 10 articles per page on Free, 50 on Starter, 200 on Basic and up to 250 on higher plans. ## Next steps * **[serpapi-apitube-migration-kit](https://github.com/apitube/serpapi-apitube-migration-kit)** — `google_news` parameter and operator mappings, Node.js and Python compatibility libraries (82 tests, identical output), and an AI prompt for converting multiple queries * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-gdelt.md' description: >- Move from GDELT's free research dataset to APITube — what converts, what GDELT still does better, and the rate limit that decides your timeline --- # Migrating from the GDELT DOC 2.0 API Replace `api.gdeltproject.org/api/v2/doc/doc` with `/v1/news/everything`. Check the differences in language coverage, search and rate limits before migrating. ## These are not the same kind of product GDELT is a **free research dataset**. APITube is a **commercial news API**. Choose based on the features and coverage you need. | | GDELT DOC 2.0 | APITube | |---|---------------|---------| | **Key required** | No | Yes | | **Cost** | Free | Paid, free tier available | | **Rate limit** | Effectively a handful per hour — see below | 50/minute paid, 10/minute free | | **Records per request** | 250 | 250 | | **Paging** | **None** | `page` | | **Search scope** | Full article text, 65+ languages | Headlines | | **Article body** | **Not returned** | `body` and `body_html` | | **Fields per article** | 8 | Dozens | | **Errors** | **HTTP 200 with a plain-text body** | JSON with a status and an error code | **Move to APITube for:** the article text, commercial licensing, entity extraction, sentiment, and a rate limit that supports production traffic. **Keep GDELT if you need:** free full-text searches in 65 languages, GKG topic categories or tone timelines. APITube does not replace this research coverage. ## Your first request ```bash # GDELT — no key needed curl "https://api.gdeltproject.org/api/v2/doc/doc?query=tesla&mode=artlist&format=json&maxrecords=250" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&per_page=250" \ -H "X-API-Key: YOUR_API_KEY" ``` ## GDELT reports errors with HTTP 200 Check the response body as well as the HTTP status. For example, request more than the maximum number of results: ```bash curl "https://api.gdeltproject.org/api/v2/doc/doc?query=tesla&mode=artlist&format=json&maxrecords=251" # HTTP 200 # A maximum of 250 records can be returned (10 on Free, 50 on Starter, 200 on Basic). ``` GDELT can return HTTP `200` with a plain-text error, including for rate limits. A JSON parser will fail on these responses. If your code treats JSON parsing failures as empty results, it may hide GDELT errors. APITube returns a structured error such as `400 ER0171`, which you can handle directly. ## The rate limit is the real migration cost GDELT's throttle message says "one request every 5 seconds". Measured on 27 July 2026: | Interval between requests | Requests that got through | |---|---| | 6 seconds | 1 of 7 | | 16 seconds | 4 of 12 | | 60 seconds | 3 of 8 | | 150 seconds | 0 of 3 | | **300 seconds, over 35 minutes** | **0 of 7** | Slower retries did not clear the block in this test. Roughly 60 requests over 90 minutes triggered it, and none of the retry intervals tested restored access. A pause that worked once did not work again later in the same session. On GDELT, waiting longer between retries did not restore access during this test. APITube returns HTTP `429` when you exceed its documented per-minute limit. Wait for that limit to reset before retrying. **Request limits affect how long it takes to download past articles. Account for them when planning a migration.** ## Parameter mapping | GDELT | APITube | Note | |-------|---------|------| | `query` (bare terms) | `title` | Full text → headlines | | `query domain:X` | `source.domain=X` | Exact | | `query sourcelang:english` | `language.code=en` | **Name → ISO code** | | `query sourcecountry:US` | `source.country.code=us` | **Name → ISO code** | | `query theme:X` | — | No GKG taxonomy | | `maxrecords` | `per_page` | Both cap at 250; APITube caps Free at 10, Starter at 50 and Basic at 200 | | `mode=artlist` | *(the default)* | | | `mode=timelinevol` | `/v1/news/trends` | Different endpoint and response format | | `mode=tonechart` | — | Compute from `sentiment.overall.score` | | — | `page` | GDELT has no paging at all | The [full table](https://github.com/apitube/gdelt-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit, including the parameters it deliberately leaves unmapped because they could not be verified. ## Convert language and country names to codes {#names-become-codes-and-that-breaks-naive-ports} GDELT returns language and country names in English. APITube expects ISO codes. ``` GDELT: "language": "Serbian", "sourcecountry": "Serbia" APITube: language.code=sr source.country.code=rs ``` Forwarding the name fails, and the error tells you which mistake you made: | What you send | Response | |---|---| | `language.code=Serbian` | `400 ER0061` — must be 1–2 characters | | `language.code=zz` | `400 ER0237` — not found | | `source.country.code=Serbia` | `400 ER0246` — must be 2 characters | | `source.country.code=zz` | `400 ER0212` — not found | A **length** error means a GDELT value was forwarded unconverted — a bug in your mapping code. A **not-found** error means your table produced a code APITube does not carry — a real coverage gap. Note also that the United Kingdom is `gb`, not `uk`. ## Russian and Ukrainian are absent `language.code=ru` and `=uk` return `400 ER0237`; `source.country.code=ru` returns `400 ER0212`. GDELT covers both. There is no substitute and no partial coverage. Before migrating, run your usual GDELT queries and count the rows marked `"Russian"`. Check how much coverage your application would lose. ## The language mix will shift Compare language coverage with your own queries before switching. A similar total article count does not guarantee a similar mix of languages. Check each language your application needs and compare its share of the results. Compare article counts **by language** before switching. ## Other migration differences to check {#other-things-that-will-bite} **No paging on GDELT.** `maxrecords` returns up to 250 and stops — no offset, no cursor. Queries that matched more were worked around by slicing the date range. On APITube that workaround is unnecessary: use `page`. **`seendate` is not `published_at`.** GDELT records when it *first saw* the article; APITube records publication time. For a late pickup these differ, and nothing reconciles them. **Date formats differ.** GDELT writes `20260709T120000Z` (ISO 8601 basic); APITube's filters take `2026-07-09T12:00:00Z` (extended). **Multi-value filters apply the first 3.** A fourth domain or language is dropped with no error. ## What you gain APITube returns article text with the search results. It also includes entities with Wikidata links and sentiment scores, separate title and body sentiment, categories, topics, industries, publisher bias and rank, readability, `is_duplicate`, `story.id` and eight export formats. ## Next steps * **[gdelt-apitube-migration-kit](https://github.com/apitube/gdelt-apitube-migration-kit)** — verified parameter mappings, unsupported or unverified parameters, language and country tables with article counts, and Node.js and Python compatibility libraries (29 tests each, identical output). Includes an AI prompt that flags queries it cannot convert. * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-thenewsapi.md' description: >- Move from The News API to APITube. Map /v1/news/all parameters and compare article limits, full text and article metadata. --- # Migrating from The News API Replace `/v1/news/all` with `/v1/news/everything` and `/v1/news/top` with `/v1/news/top-headlines`. Check search scope and supported languages. Existing article UUIDs cannot be reused. ## Why teams switch | | The News API | APITube | |---|-------------|---------| | **Articles per request** | **3** free · 25 Basic · 50 Standard · **100 on the $79 Pro plan** | **250** — 10 on Free, 50 on the $29 Starter plan | | **Article text** | `snippet` — the first ~60 characters | Full `body` and `body_html` | | **Article details** | Categories, keywords, a relevance score | Entities with Wikidata links, sentiment (title/body/overall/per-entity), IPTC + topics + industries, readability, publisher bias | | **Category taxonomy** | 10 fixed categories | IPTC MediaTopics — thousands of codes | ## Your first request ```bash # The News API curl "https://api.thenewsapi.com/v1/news/all?api_token=YOUR_TOKEN&search=tesla&language=en&categories=business&limit=50" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&category.id=medtop:04000000&per_page=50" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | The News API | APITube | Note | |--------------|---------|------| | `search` | `title` or `query` | Headlines only — see below | | `search_fields=title` | `title` | Lossless | | `categories` | `category.id` | 10 categories → IPTC codes, max 3 | | `exclude_categories` | `ignore.category.id` | | | `domains` | `source.domain` | Max 3, exact domain | | `exclude_domains` | `ignore.source.domain` | | | `source_ids` | `source.id` | **The ID spaces are unrelated** — remap through the domain | | `language` | `language.code` | 34 of 37 codes work | | `locale` | `source.country.code` | 53 of 55 codes work | | `published_after` / `published_before` | `published_at.start` / `.end` | | | `published_on` | `published_at.start` + `.end` | A single day becomes a range | | `sort=published_on` | `sort.by=published_at` | | | `limit` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | | `api_token` | `api_key` or `X-API-Key` header | | ### Search operators ``` usd + gbp → title=usd,gbp (comma is AND) usd | gbp → query=title:(usd OR gbp) -cad → ignore.title=cad "Apple Inc" → title="Apple Inc" forex + (usd|gbp) -cad → query=title:forex AND (title:usd OR title:gbp) NOT title:cad ``` The [full table of all 57 parameters](https://github.com/apitube/thenewsapi-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **Russian and Ukrainian.** `language.code=ru` and `uk` return `400`, and `source.country.code=ru` / `ua` return `400`. There is no substitute. If either is part of your coverage, this migration does not work. **Prefix wildcards.** `search=technolog*` has no equivalent, and passing it through returns the **entire index** with a `200`. Expand it by hand. **Stored UUIDs.** The News API identifies articles by UUID; APITube uses integers. `/v1/news/uuid/{uuid}` becomes `?article.id=`, but existing UUIDs cannot be converted to APITube IDs. Find the same articles in APITube and save their IDs. **`/v1/news/similar/{uuid}`.** No similar-article endpoint. `story.id` exists on every article but is not a working filter. **Per-category headline grouping.** `/v1/news/headlines` returns one object keyed by category. APITube needs one request per category. ## What you gain APITube returns full article text, compared with The News API's 60-character snippet. It also includes entities, title/body/overall sentiment, categories, topics, industries, publisher bias and readability scores. Results can be exported in eight formats. The News API returns up to 100 articles on its $79 plan. APITube returns 10 on Free, 50 on the $29 Starter plan, 200 on Basic and up to 250 on higher plans. ## Next steps * **[thenewsapi-apitube-migration-kit](https://github.com/apitube/thenewsapi-apitube-migration-kit)** — 57 parameter mappings, verified category, locale and language tables, Node.js and Python compatibility libraries, and an AI prompt for converting multiple queries * [Parameters reference](/platform/news-api/filters#parameters) * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations/from-worldnewsapi.md' description: >- Move from World News API to APITube with entity and location filter mappings. Check AND and OR evaluation order to keep your search results consistent. --- # Migrating from World News API Replace `/search-news` with `/v1/news/everything`. Entity and sentiment filters have equivalents. Add parentheses to converted queries because AND and OR precedence differs. ## Why teams switch | | World News API | APITube | |---|---------------|---------| | **Articles per request** | 100 | **250** | | **Quota model** | Points: 1 per request **plus 0.01 per result** — a 100-article request costs 2 points | Flat request count, regardless of `per_page` | | **Sentiment** | One score per article | **Three** — title, body, overall — plus per-entity | | **Category taxonomy** | 13 fixed categories | IPTC MediaTopics plus topics and industries | | **Entity types** | `ORG`, `PER`, `LOC` | Those three plus brand, event, sport, disease, disaster | Include paging requests when estimating your quota usage. ## Read this before converting a single query World News API binds `OR` **more tightly** than the implicit `AND`. From their own documentation: > `tesla model OR ford` is read as `tesla AND (model OR ford)`, NOT as `(tesla AND model) OR ford` APITube evaluates `AND` before `OR`. Add parentheses to keep the meaning of a World News API query: ```bash # What World News API meant query=title:tesla AND (title:model OR title:ford) # 4,067 articles # What a direct copy would mean on APITube query=title:tesla AND title:model OR title:ford # different set, no error ``` **Always parenthesise every `OR` chain when converting.** The compatibility library does this automatically. ## Your first request ```bash # World News API curl "https://api.worldnewsapi.com/search-news?text=tesla&language=en&source-country=us&number=100&sort=publish-time&api-key=YOUR_KEY" ``` ```bash # APITube curl "https://api.apitube.io/v1/news/everything?title=tesla&language.code=en&source.country.code=us&per_page=100&sort.by=published_at&sort.order=desc" \ -H "X-API-Key: YOUR_API_KEY" ``` ## Parameter mapping | World News API | APITube | Note | |----------------|---------|------| | `text` | `title` or `query` | Headlines only, and see precedence above | | `text-match-indexes=title` | `title` | Lossless | | `entities=ORG:Tesla` | `organization.name=Tesla` | Direct | | `entities=PER:Elon Musk` | `person.name=Elon Musk` | Direct | | `entities=LOC:Ireland` | `location.name=Ireland` | Direct | | `categories` | `category.id` | 13 categories → IPTC codes, max 3 | | `source-country` | `source.country.code` | Up to 3 here, one there | | `language` | `language.code` | **44 of 58 codes work** | | `news-sources` | `source.domain` | 10 values become 3 | | `authors` | `author.name` | Max 3 | | `min-sentiment` / `max-sentiment` | `sentiment.overall.score.min` / `.max` | Same −1…1 scale | | `earliest-publish-date` / `latest-publish-date` | `published_at.start` / `.end` | | | `location-filter=lat,lng,radius` | [`/v1/news/local?lat=&lng=&radius=`](/platform/news-api/local) | A **separate endpoint** | | `sort=publish-time` | `sort.by=published_at` | | | `offset` | `offset` | Works directly | | `number` | `per_page` | 250 max; 10 on Free, 50 on Starter, 200 on Basic | The [full table of all 18 parameters](https://github.com/apitube/worldnewsapi-apitube-migration-kit/blob/main/reference/parameter-mapping.md) is in the migration kit. ## What does not carry over **14 of 58 language codes**, including **Russian and Ukrainian**. Only `nb` has a substitute (`no`). The others — `aa`, `am`, `my`, `lo`, `mr`, `mi`, `ne`, `si`, `so`, `tg`, `uz` — are absent. Check your traffic before converting. **Body-text search.** `text-match-indexes` defaults to title + content. The entity filter is the replacement, and it maps directly. **Location search.** World News API combines `location-filter` with other filters on `/search-news`. On APITube, use the separate `/v1/news/local` endpoint. Check its supported filters before converting your request. **`/extract-news` and `/extract-news-links`.** APITube serves its own index; it does not fetch and parse arbitrary URLs on demand. **Entity synonym normalisation.** `LOC:USA` and `LOC:United States of America` are the same concept there. Here names resolve against an index — `organization.name=Apple Inc` returns `400`, `Apple` works. ## What you gain APITube includes title/body/overall sentiment, sentiment about individual entities and five additional entity types. It also returns IPTC MediaTopics, topics, industries, publisher political bias and rank, readability scores and a clickbait flag. You can export results in eight formats. Requests have no per-result charge. Page sizes are 10 on Free, 50 on Starter, 200 on Basic and up to 250 on higher plans. ## Next steps * **[worldnewsapi-apitube-migration-kit](https://github.com/apitube/worldnewsapi-apitube-migration-kit)** — 18 parameter mappings, a query converter that preserves AND/OR evaluation order, 58 checked language codes, Node.js and Python compatibility libraries, and an AI prompt for converting multiple queries * [Parameters reference](/platform/news-api/filters#parameters) * [Local news endpoint](/platform/news-api/local) — the `location-filter` replacement * [Common migration issues](/platform/migrations/#what-every-migration-has-in-common) --- --- url: 'https://docs.apitube.io/platform/migrations.md' description: >- Move from NewsAPI.org, GNews, NewsCatcher, Mediastack, NewsData.io and other news APIs. Find parameter mappings, compatibility libraries and unsupported features. --- # Migrating to APITube Use these guides to move your requests to APITube. Each guide maps parameters, explains differences in search and responses, and links to a compatibility library for keeping your existing response-handling code. The guides note unsupported features and link to migration kits with parameter mappings. ## Pick your API | You are on | Guide | Migration kit | |------------|-------|---------------| | [NewsAPI.org](https://newsapi.org) | [From NewsAPI.org](/platform/migrations/from-newsapi-org) | [newsapi-org-apitube-migration-kit](https://github.com/apitube/newsapi-org-apitube-migration-kit) | | [GNews](https://gnews.io) | [From GNews](/platform/migrations/from-gnews) | [gnews-apitube-migration-kit](https://github.com/apitube/gnews-apitube-migration-kit) | | [NewsCatcher](https://www.newscatcherapi.com) | [From NewsCatcher](/platform/migrations/from-newscatcher) | [newscatcher-apitube-migration-kit](https://github.com/apitube/newscatcher-apitube-migration-kit) | | [NewsData.io](https://newsdata.io) | [From NewsData.io](/platform/migrations/from-newsdata-io) | [newsdata-io-apitube-migration-kit](https://github.com/apitube/newsdata-io-apitube-migration-kit) | | [Mediastack](https://mediastack.com) | [From Mediastack](/platform/migrations/from-mediastack) | [mediastack-apitube-migration-kit](https://github.com/apitube/mediastack-apitube-migration-kit) | | [NewsAPI.ai / Event Registry](https://newsapi.ai) | [From NewsAPI.ai](/platform/migrations/from-newsapi-ai) | [newsapi-ai-apitube-migration-kit](https://github.com/apitube/newsapi-ai-apitube-migration-kit) | | [The News API](https://www.thenewsapi.com) | [From The News API](/platform/migrations/from-thenewsapi) | [thenewsapi-apitube-migration-kit](https://github.com/apitube/thenewsapi-apitube-migration-kit) | | [World News API](https://worldnewsapi.com) | [From World News API](/platform/migrations/from-worldnewsapi) | [worldnewsapi-apitube-migration-kit](https://github.com/apitube/worldnewsapi-apitube-migration-kit) | | [Marketaux](https://www.marketaux.com) | [From Marketaux](/platform/migrations/from-marketaux) | [marketaux-apitube-migration-kit](https://github.com/apitube/marketaux-apitube-migration-kit) | | [Perigon](https://www.goperigon.com) | [From Perigon](/platform/migrations/from-perigon) | [perigon-apitube-migration-kit](https://github.com/apitube/perigon-apitube-migration-kit) | | [SerpApi Google News](https://serpapi.com/google-news-api) | [From SerpApi](/platform/migrations/from-serpapi) | [serpapi-apitube-migration-kit](https://github.com/apitube/serpapi-apitube-migration-kit) | | [ScrapingBee](https://www.scrapingbee.com) | [From ScrapingBee](/platform/migrations/from-scrapingbee) | [scrapingbee-apitube-migration-kit](https://github.com/apitube/scrapingbee-apitube-migration-kit) | | [Quantexa News API](https://www.quantexa.com) *(formerly Aylien; API host no longer resolves)* | [From Quantexa](/platform/migrations/from-quantexa) | [quantexa-apitube-migration-kit](https://github.com/apitube/quantexa-apitube-migration-kit) | | [Bing News Search](https://learn.microsoft.com/en-us/previous-versions/bing/search-apis/bing-news-search/overview) *(retired August 2025)* | [From Bing News Search](/platform/migrations/from-bing-news) | [bing-news-api-apitube-migration-kit](https://github.com/apitube/bing-news-api-apitube-migration-kit) | | [GDELT DOC 2.0](https://www.gdeltproject.org) *(free, no key, no article body)* | [From GDELT](/platform/migrations/from-gdelt) | [gdelt-apitube-migration-kit](https://github.com/apitube/gdelt-apitube-migration-kit) | ## What every migration has in common Check these differences before converting requests. They apply across the migration guides. ### 1. Search covers headlines, not article bodies Most news APIs search the title **and** the body text by default. APITube's `title=` searches headlines only. ```bash # Other APIs: matches "Tesla" anywhere in the article q=Tesla # APITube: matches "Tesla" in the headline title=Tesla ``` If your previous API searched article bodies, a headline-only search may return fewer results. Use entity filters when you want news about a person, company or place: ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/everything?organization.name=Tesla" ``` Entity filters match subjects mentioned in article text. See [Parameters](/platform/news-api/filters#parameters) for `person.name`, `location.name`, `entity.id` and other options. ### 2. Comma-separated filters apply at most three values ```bash language.code=en,de,fr,it # Italian is ignored — no error ``` The fourth value onwards is dropped silently. Two ways around it: ```bash # The boolean query language has no value-count limit query=language.code:(en OR de OR fr OR it OR es) # Or split into requests of three and deduplicate on the article id ``` ### 3. Unknown parameters are ignored, not rejected Unknown parameters are ignored even when the request returns `200 ok`. Check names before forwarding parameters from another API: ```bash # Both return the entire index with HTTP 200 curl "…/v1/news/count?q=tesla&api_key=KEY" curl "…/v1/news/count?country=us&api_key=KEY" ``` The compatibility libraries warn about parameters they leave out. If you convert requests by hand, check names against [Parameters](/platform/news-api/filters#parameters). ### 4. Wildcards are not supported, and they fail quietly ```bash title=technology # 75,574 articles ✅ title=technolog* # the entire index ❌ HTTP 200, filter dropped ``` Expand prefix searches into an explicit `OR` list: ```bash query=title:(technology OR technological OR technologies) ``` The boolean form at least errors properly: `query=title:technolog*` returns `400 ER0704`. ### 5. Set a generous client timeout and retry on `500` Response time depends on the filters and the number of articles requested. Use smaller pages and request only the fields you need for large jobs. A timeout may return `500` or `502`. The same request can succeed on retry. Set your client timeout above 30 seconds and retry once on `500`. When paging through results, fetch `/v1/news/count` once for each set of filters rather than for every page. ## Endpoint equivalents at a glance | What you want | APITube endpoint | |---------------|------------------| | Search everything | [`/v1/news/everything`](/platform/news-api/endpoints) | | Top headlines | `/v1/news/top-headlines` | | Breaking news | `/v1/news/everything?is_breaking=1` | | Result count | [`/v1/news/count`](/platform/news-api/count) | | Geo search | [`/v1/news/local`](/platform/news-api/local) | | Aggregation / trends | `/v1/news/trends?field=entity.id` | | Real-time push | [Webhooks](/platform/news-api/webhooks) or [WebSocket stream](/platform/news-api/websocket-stream) | | Entity autocomplete | `/v1/suggest/entities?prefix=` | ## What you gain APITube article responses include: * **Named entities** with Wikidata and Wikipedia links, occurrence counts, and per-entity sentiment * **Sentiment** split into title, body, and overall on a −1…1 scale * **Three ways to group news** — IPTC MediaTopics (`category.id`), editorial topics (`topic.id`), and industry sectors (`industry.id`) * **Full article body** as text and HTML * **Publisher metadata** — political bias, authority rank, country * **Readability scores** — Flesch-Kincaid, reading ease, target audience * **250 articles per request** (10 on Free, 50 on Starter, 200 on Basic) * **Export** to JSON, JSONL, CSV, TSV, XLSX, XML, RSS, and Parquet from any query ## Before you start 1. **Get a key** at [apitube.io](https://apitube.io) and make one request: ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/everything?title=bitcoin&per_page=3" ``` 2. **Check your languages.** APITube does not index every language every competitor lists — most notably **Russian and Ukrainian are not available**. The per-service guides list exactly which codes are rejected. Confirm yours works before converting anything: ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/count?language.code=de" ``` 3. **Read your service's guide.** Convert requests by hand, or use the compatibility library in its migration kit. ## Getting help * [Parameters reference](/platform/news-api/filters#parameters) — every filter APITube supports * [Response structure](/platform/news-api/response-structure) — every field an article carries * [HTTP response codes](/platform/news-api/http-response-codes) — what each error code means * [Interactive query builder](/platform/news-api/query-builder) — build and test a request in the browser If a mapping is incorrect, open an issue in the relevant migration kit. --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/perl/mojo-client.md' description: 'Call the APITube News API from Perl using the Mojo::UserAgent client' --- # Mojo::UserAgent integration ```perl #!/usr/bin/perl use strict; use warnings; use Mojo::UserAgent; use Mojo::JSON qw(encode_json); my $ua = Mojo::UserAgent->new; $ua->connect_timeout(30); my $url = 'https://api.apitube.io/v1/news/everything'; my $tx = $ua->get($url => form => { per_page => 50, api_key => 'YOUR_API_KEY' }); if (my $res = $tx->result) { if ($res->is_success) { my $data = $res->json; print $res->body; } else { print "HTTP Request Error: " . $res->code . "\n"; } } else { my $err = $tx->error; print "Connection error: $err->{message}\n"; } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/company-monitoring.md description: 'Track a company''s coverage volume, sentiment and momentum over time' --- # Monitor a Company Use [Companies](/platform/news-api/reference/companies) to track article volume, sentiment, changes in attention, and the sources and topics covering a company. ## Step 1: Find the company {#step-1-resolve-the-company} Look the company up by name (or Wikidata ID) and take its `id`. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/companies?name=Tesla&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/companies", params={ "name": "Tesla", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "name": "Tesla", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/companies?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["name" => "Tesla", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/companies?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/companies") q := u.Query() q.Set("name", "Tesla") 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) } ``` ```java [Java] 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/companies?name=Tesla&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/companies?name=Tesla 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/everything ``` ::: ## Step 2: Read the coverage block Fetch the profile and inspect `coverage`: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/companies/474?api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/companies/474", params={ "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/companies/474?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/companies/474?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/companies/474") q := u.Query() 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) } ``` ```java [Java] 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/companies/474?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/companies/474 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/everything ``` ::: * **Is attention rising?** — `coverage.momentum.change_pct`. * **What's the tone?** — `coverage.sentiment` (positive / neutral / negative). * **Who's writing?** — `coverage.top_sources`. * **About what?** — `coverage.top_topics`. * **What broke today?** — `recent_articles`. ## Step 3: Poll on a schedule Check the profile regularly and alert when sentiment or `momentum.change_pct` crosses a threshold you choose. Coverage may take about 5 minutes to update. ```python import requests def snapshot(company_id, api_key): r = requests.get( f"https://api.apitube.io/v1/companies/{company_id}", params={"api_key": api_key}, ).json() cov = r["coverage"] return { "articles_30d": cov["momentum"]["last_30_days"], "change_pct": cov["momentum"]["change_pct"], "sentiment": cov["sentiment"], } ``` > Tip: for a complete, filterable feed (by date, sentiment, source) follow the profile's `links.articles` into `/v1/news/everything`. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/automotive-ev-monitor.md description: >- Track carmakers, EV charging and vehicle sales coverage — scope by industry ID, narrow to one manufacturer, then watch recalls and launches --- # Monitor the Automotive and EV Industry Combine vehicle manufacturing, vehicle sales and EV charging with [`industry.id`](/platform/news-api/list-of-industries) to get one automotive feed. Add event and sentiment filters to focus on the news you need. ## Step 1: Choose the industries to follow {#step-1-scope-the-sector} Send up to 3 IDs in `industry.id`, separated by commas, to match any of them. Use `801` for Vehicle Manufacturing (vehicles and parts), `805` for Vehicle Sales (dealerships, fleets and online sales), and `807` for EV Charging. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=801,805,807&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "801,805,807", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "801,805,807", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "801,805,807", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "801,805,807") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?industry.id=801,805,807&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=801,805,807&sort.by=published_at&sort.order=desc&per_page=20 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/everything ``` ::: * **Part of the industry** — each article's `industries` array shows whether it covers manufacturing, sales or charging. * **Tone of the coverage** — `sentiment.overall.polarity` and `sentiment.overall.score`. * **Publisher** — `source.domain` identifies the website. Use `source.country.code` to see the publisher's country. ## Step 2: Narrow to one manufacturer Add `title` to select headlines mentioning a manufacturer. This helps narrow a broad industry feed to one company. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=801,805,807&title=Tesla&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "801,805,807", "title": "Tesla", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "801,805,807", "title": "Tesla", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "801,805,807", "title" => "Tesla", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "801,805,807") q.Set("title", "Tesla") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?industry.id=801,805,807&title=Tesla&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=801,805,807&title=Tesla&per_page=20 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/everything ``` ::: For a topic rather than a company — `title=electric vehicle` — multiple words are matched as AND, so every word must appear in the headline. Wrap the phrase in double quotes to require the exact order. ## Step 3: Split the feed into recalls and launches Use `event.type=recall` for safety recalls and `event.type=product-launch` for new models and product announcements. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=801,805,807&event.type=recall&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "801,805,807", "event.type": "recall", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "801,805,807", "event.type": "recall", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "801,805,807", "event.type" => "recall", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "801,805,807") q.Set("event.type", "recall") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?industry.id=801,805,807&event.type=recall&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=801,805,807&event.type=recall&sort.by=published_at&sort.order=desc&per_page=20 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/everything ``` ::: Change the event type to compare recalls with launches. Use a count request when you only need the totals: ```python import requests MAKERS = ["Tesla", "Toyota", "BYD", "Volkswagen"] AUTO = "801,805,807" def scoreboard(api_key, event, since="2026-01-01"): rows = {} for maker in MAKERS: r = requests.get( "https://api.apitube.io/v1/news/count", params={ "industry.id": AUTO, "title": maker, "event.type": event, "published_at.start": since, "api_key": api_key, }, ).json() rows[maker] = r["count"] return dict(sorted(rows.items(), key=lambda kv: -kv[1])) ``` > Tip: use EV charging (`807`) on its own to follow charging infrastructure and utility partnerships. --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/n8n.md' description: >- Automate news monitoring workflows with APITube News API and n8n — no coding required --- # n8n Integration Use [n8n](https://n8n.io) to check for news, send alerts and create AI summaries with visual workflows. ## Prerequisites * n8n account ([self-hosted](https://docs.n8n.io/hosting/) or [n8n Cloud](https://n8n.io/cloud/)) * APITube API key (get one from your [dashboard](https://apitube.io)) ## Setting Up APITube Credentials Save your APITube API key in n8n: 1. In n8n, navigate to **Credentials** → **Add credential** 2. Select **Header Auth** from the credential types 3. Name it `APITube API` 4. Set **Name** to `X-API-Key` 5. Set **Value** to your API key from [apitube.io](https://apitube.io) 6. Click **Save** :::tip When configuring HTTP Request nodes in the workflows below, set **Authentication** to **Generic Credential Type**, then select **Header Auth** and choose your `APITube API` credential. ::: ## API Endpoints Reference | Endpoint | Method | Description | |----------|--------|-------------| | `/v1/news/everything` | GET | Search all articles with 50+ filters | | `/v1/news/top-headlines` | GET | Headlines from highly ranked sources | | `/v1/news/article` | GET | Get articles by ID | | `/v1/news/story/:articleId` | GET | Get related articles for a story | | `/v1/news/trends` | GET | Trending subjects and article counts | Base URL: `https://api.apitube.io` Full list of endpoints and parameters: [Endpoints](/platform/news-api/endpoints) | [Parameters](/platform/news-api/filters#parameters) ## Workflow 1: News Monitoring Monitor news by keywords, categories, or sources on a schedule. **How it works:** * Schedule Trigger runs every 15 minutes * HTTP Request searches APITube for new articles * IF node filters results by condition (e.g., sentiment score) * Results are saved to Google Sheets (or any destination) **n8n workflow JSON:** ```json { "name": "APITube — News Monitoring", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "minutes", "minutesInterval": 15 } ] } }, "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 0], "id": "schedule-trigger", "name": "Every 15 minutes" }, { "parameters": { "url": "https://api.apitube.io/v1/news/everything", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "title", "value": "artificial intelligence" }, { "name": "language.code", "value": "en" }, { "name": "published_at.start", "value": "={{ $now.minus(15, 'minutes').toISO() }}" }, { "name": "per_page", "value": "50" }, { "name": "sort.by", "value": "published_at" }, { "name": "sort.order", "value": "desc" } ] }, "options": { "response": { "response": { "responseFormat": "json" } } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [220, 0], "id": "http-request", "name": "Search APITube", "credentials": { "httpHeaderAuth": { "id": "YOUR_CREDENTIAL_ID", "name": "APITube API" } } }, { "parameters": { "fieldToSplitOut": "results", "options": {} }, "type": "n8n-nodes-base.splitOut", "typeVersion": 1, "position": [440, 0], "id": "split-articles", "name": "Split Articles" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "condition-sentiment", "leftValue": "={{ $json.sentiment.overall.score }}", "rightValue": 0, "operator": { "type": "number", "operation": "gte" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [660, 0], "id": "filter-positive", "name": "Positive Sentiment?" } ], "connections": { "Every 15 minutes": { "main": [[{ "node": "Search APITube", "type": "main", "index": 0 }]] }, "Search APITube": { "main": [[{ "node": "Split Articles", "type": "main", "index": 0 }]] }, "Split Articles": { "main": [[{ "node": "Positive Sentiment?", "type": "main", "index": 0 }]] } }, "pinData": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "tags": [], "triggerCount": 0 } ``` **To import:** Copy the JSON above, open n8n, click **⋮** → **Import from JSON**, paste, and update the credential ID. **Customization tips:** * Change `title` parameter to monitor different keywords * Add `category.id` to filter by category (see [list of categories](/platform/news-api/list-of-categories)) * Add `source.country.code` to filter by country (e.g., `us`, `gb`) * Use `entity.id` or `person.name` to follow news about a person, company or other subject ## Workflow 2: News to Slack / Telegram Send news alerts to your team's Slack channel or Telegram group. **How it works:** * Schedule Trigger runs every 30 minutes * HTTP Request fetches latest articles from APITube * Split In Batches processes articles one by one * Slack/Telegram node sends a formatted message with title, source, and link **n8n workflow JSON (Slack):** ```json { "name": "APITube — News to Slack", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "minutes", "minutesInterval": 30 } ] } }, "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 0], "id": "schedule-trigger", "name": "Every 30 minutes" }, { "parameters": { "url": "https://api.apitube.io/v1/news/everything", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "title", "value": "startup funding" }, { "name": "language.code", "value": "en" }, { "name": "published_at.start", "value": "={{ $now.minus(30, 'minutes').toISO() }}" }, { "name": "per_page", "value": "10" }, { "name": "sort.by", "value": "published_at" }, { "name": "sort.order", "value": "desc" } ] }, "options": { "response": { "response": { "responseFormat": "json" } } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [220, 0], "id": "http-request", "name": "Search APITube", "credentials": { "httpHeaderAuth": { "id": "YOUR_CREDENTIAL_ID", "name": "APITube API" } } }, { "parameters": { "fieldToSplitOut": "results", "options": {} }, "type": "n8n-nodes-base.splitOut", "typeVersion": 1, "position": [440, 0], "id": "split-articles", "name": "Split Articles" }, { "parameters": { "select": "channel", "channelId": { "__rl": true, "value": "YOUR_CHANNEL_ID", "mode": "id" }, "messageType": "block", "blocksUi": { "blocksValues": [ { "type": "section", "fields": { "values": [ { "textType": "mrkdwn", "text": "=*<{{ $json.href }}|{{ $json.title }}>*\n_{{ $json.source.domain }}_ • {{ $json.published_at }}\n{{ $json.description }}" } ] } } ] } }, "type": "n8n-nodes-base.slack", "typeVersion": 2.2, "position": [660, 0], "id": "slack-message", "name": "Send to Slack", "credentials": { "slackApi": { "id": "YOUR_SLACK_CREDENTIAL_ID", "name": "Slack" } } } ], "connections": { "Every 30 minutes": { "main": [[{ "node": "Search APITube", "type": "main", "index": 0 }]] }, "Search APITube": { "main": [[{ "node": "Split Articles", "type": "main", "index": 0 }]] }, "Split Articles": { "main": [[{ "node": "Send to Slack", "type": "main", "index": 0 }]] } }, "pinData": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "tags": [], "triggerCount": 0 } ``` **For Telegram:** Replace the Slack node with a Telegram node: * Use **Telegram** node → **Send Message** * Set **Chat ID** to your group/channel ID * Set **Text** to: ={{ $json.title }}\n{{ $json.source.domain }} • {{ $json.published\_at }}\n{{ $json.href }} ## Workflow 3: AI News Digest Use AI to summarise each day's news and email the summary. **How it works:** * Schedule Trigger runs once a day (e.g., 8:00 AM) * HTTP Request fetches top headlines from APITube * Code node formats articles into a readable list * OpenAI node summarizes the news into a concise digest * Gmail node sends the digest to your email **n8n workflow JSON:** ```json { "name": "APITube — AI News Digest", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "cronExpression", "expression": "0 8 * * *" } ] } }, "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 0], "id": "schedule-trigger", "name": "Daily at 8 AM" }, { "parameters": { "url": "https://api.apitube.io/v1/news/top-headlines", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "language.code", "value": "en" }, { "name": "published_at.start", "value": "={{ $now.minus(1, 'days').toISO() }}" }, { "name": "per_page", "value": "20" }, { "name": "sort.by", "value": "published_at" }, { "name": "sort.order", "value": "desc" } ] }, "options": { "response": { "response": { "responseFormat": "json" } } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [220, 0], "id": "http-request", "name": "Get Top Headlines", "credentials": { "httpHeaderAuth": { "id": "YOUR_CREDENTIAL_ID", "name": "APITube API" } } }, { "parameters": { "jsCode": "const articles = $input.first().json.results || [];\nconst formatted = articles.map((a, i) => \n `${i + 1}. ${a.title} (${a.source.domain})\\n ${a.href}\\n ${a.description || ''}`\n).join('\\n\\n');\n\nreturn [{ json: { articlesList: formatted, count: articles.length } }];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [440, 0], "id": "format-articles", "name": "Format Articles" }, { "parameters": { "resource": "chat", "operation": "message", "model": { "__rl": true, "value": "gpt-4o-mini", "mode": "list" }, "messages": { "values": [ { "content": "=You are a professional news editor. Summarize the following {{ $json.count }} news articles into a concise daily digest. Group by topic, highlight the most important stories, and keep it under 500 words.\n\n{{ $json.articlesList }}" } ] }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1.8, "position": [660, 0], "id": "openai-summarize", "name": "AI Summarize", "credentials": { "openAiApi": { "id": "YOUR_OPENAI_CREDENTIAL_ID", "name": "OpenAI" } } }, { "parameters": { "sendTo": "your-email@example.com", "subject": "=Daily News Digest — {{ $now.format('yyyy-MM-dd') }}", "emailType": "text", "message": "={{ $json.message.content }}" }, "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [880, 0], "id": "send-email", "name": "Send Email", "credentials": { "gmailOAuth2": { "id": "YOUR_GMAIL_CREDENTIAL_ID", "name": "Gmail" } } } ], "connections": { "Daily at 8 AM": { "main": [[{ "node": "Get Top Headlines", "type": "main", "index": 0 }]] }, "Get Top Headlines": { "main": [[{ "node": "Format Articles", "type": "main", "index": 0 }]] }, "Format Articles": { "main": [[{ "node": "AI Summarize", "type": "main", "index": 0 }]] }, "AI Summarize": { "main": [[{ "node": "Send Email", "type": "main", "index": 0 }]] } }, "pinData": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "tags": [], "triggerCount": 0 } ``` ## Tips & Tricks * **Avoid duplicate articles**: Use `published_at.start` with the n8n expression ={{ $now.minus(15, 'minutes').toISO() }} to only fetch articles since the last poll * **Rate limits**: APITube allows 50 requests per minute. Space your Schedule Triggers accordingly * **Pagination**: Use `page` parameter to fetch more results. Max `per_page` is 250 (10 on Free, 50 on Starter, 200 on Basic) * **Export formats**: Add `export=csv` or `export=xlsx` to get data in different formats * **Skip articles already processed**: Use n8n's **Remove Duplicates** node with `href` as the key field to avoid processing the same article twice ## Next Steps * [Common Workflows](/platform/news-api/common-workflows/getting-started) — more query examples * [Parameters](/platform/news-api/filters#parameters) — full parameter reference * [Endpoints](/platform/news-api/endpoints) — all available endpoints * [API Reference](https://api-reference.apitube.io) — interactive API explorer --- --- url: 'https://docs.apitube.io/platform/news-api/ai/natural-language-search.md' description: >- Send a plain-language sentence in the prompt parameter and the News API turns it into filters, returning the interpretation in meta.prompt --- # Natural Language Search Describe the news you want in the `prompt` parameter. The API turns your words into filters and returns matching articles. Check `meta.prompt` to see which filters it used. > **`prompt` is available on Basic and above.** Free and Starter return `403 ER0706`. Translating a prompt costs **2 points**. Repeating the same prompt within **24 hours** does not add a translation charge. ```bash curl "https://api.apitube.io/v1/news/everything?prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY" ``` That single request produces the same result as writing the filters yourself: ```text person.name=Elon Musk organization.name=Tesla language.code=en published_at.start=NOW-10DAY ``` See [Parameters](/platform/news-api/filters#prompt) for the `prompt` reference. Read below for supported filters, response fields and limits. ## How it differs from the MCP server and Ask News Choose how you want to ask for news: | How you search | Where the language is interpreted | What you get back | |---------|-----------------------------------|--------------------| | `prompt` parameter | **Inside the API**, before the search runs | The normal JSON response, plus `meta.prompt` | | [MCP Server](/platform/news-api/ai/mcp-server) | In the AI assistant, which then calls the API with filters | Whatever your assistant does with the articles | | Ask News (dashboard) | In the chat interface, which calls the API for you | A written answer with sources | Use `prompt` to search from your application in one HTTP request. You do not need an AI assistant, and the response includes the filters used. ## What the translation can produce A prompt can use only existing API filters and known names or IDs. **Text search.** If your words do not match a filter such as a person, category or source, the API searches for them in headlines. It puts up to 3 terms in `title`, with a total limit of 100 characters. Text in quotes stays an exact phrase. The prompt cannot search article bodies. **Entities.** People become `person.name`, places `location.name`, companies and organizations `organization.name`, product brands `brand.name`, named events `event.name`, diseases `disease.name`, natural disasters `disaster.name`, sports `sport.name`. Up to 3 values each. **Categories and topics.** Broad subjects use `category.id` from the **17 top-level IPTC categories**, such as `politics and government`, `economy, business and finance`, `sport` and `health`. More specific subjects use `topic.id` or `industry.id`. **Publishers and journalists.** Publisher domains become `source.domain`; journalist names become `author.name`. **Language and geography.** Article language becomes `language.code`, publisher country `source.country.code`. **Time.** Periods use relative expressions in `published_at.start` and `published_at.end`. For example, "the last 10 days" becomes `NOW-10DAY`. This range updates with each request. **Other filters.** Tone becomes `sentiment.overall.polarity`, sorting uses `sort.by` and `sort.order`, and the number of articles becomes `per_page`. Yes-or-no conditions use `is_breaking`, `has_image`, `has_video`, `is_paywall` and `is_long_read`: `1` requires the condition and `0` excludes it. ## How names become identifiers The API uses known names to select entity, category, topic and industry IDs. Check `meta.prompt` to see the values applied to your request. Entity names must match a known name, ignoring case. For example, a general request for earthquakes will not automatically select a specific event such as the 2013 Aceh earthquake. If an entity name is unknown, the API searches for it in headlines and lists the unused entity filter in `meta.prompt.ignored` with `reason: not_found`. Unknown domains, topics and other non-entity values are left out and reported in the same way. The request can still return results. For topics and industries, the API uses an exact name match when available. Otherwise, it selects the shortest matching name. ## Reading meta.prompt Every JSON response to a request that used `prompt` carries the interpretation: ```json { "meta": { "prompt": { "text": "positive Tesla coverage from German publishers this month", "applied": { "organization.name": "Tesla", "source.country.code": "de", "sentiment.overall.polarity": "positive", "published_at.start": "NOW/MONTH" }, "ignored": [ { "field": "topic.id", "value": "electric vehicles", "reason": "not_found" } ], "cached": true } } } ``` | Field | Meaning | |-------|---------| | `text` | Your prompt, trimmed, exactly as it was parsed. | | `applied` | The parameters that were added to the request. This is the request that actually ran. | | `ignored` | Values that were understood but not used, each with a `field`, a `value` and a `reason`. | | `cached` | `true` when this wording had already been parsed, meaning no parse fee was charged. | Use the fields in `meta.prompt` to check how the API understood your request. ### Why a value was ignored | `reason` | What happened | What to do | |----------|---------------|------------| | `not_found` | The name is not in the API's list of known values. Unknown entity names are searched in headlines instead. | Find the name with [Suggest](/platform/news-api/suggest/entities) and pass its ID. | | `explicit_param` | You sent that parameter yourself; your value was kept. | No action needed. Values you send directly take priority. | | `unsupported_on_endpoint` | The endpoint does not accept that filter. | Move the request to `/v1/news/everything`. | | `invalid_date` | The period could not be read as a date or as date math. | Pass `published_at.start` / `published_at.end` yourself. | | `title_too_long` | The term would exceed the 100-character limit for `title`, so the whole term was left out. | Shorten the prompt. | | `title_window_clamped` | The prompt produced a headline search plus a range wider than 31 days, so `published_at.start` was moved to the 31-day limit. | Expected — see [Search window limit](/platform/news-api/everything#limits). | ## Combining a prompt with ordinary parameters Parameters you send directly take priority over filters from `prompt`. Set exact requirements, such as language, yourself and describe the rest in the prompt. ```bash # The prompt asks for English, but language.code=de wins curl "https://api.apitube.io/v1/news/everything?prompt=Tesla%20news%20in%20English&language.code=de&api_key=YOUR_API_KEY" ``` The overridden value shows up as `{"field": "language.code", "value": "en", "reason": "explicit_param"}`. The filters from your prompt work like parameters you set yourself. You can still use sorting, pagination, [field selection](/platform/news-api/filters#field-selection), [faceting](/platform/news-api/filters#faceting) and any export format. ## Endpoint behaviour | Endpoint | Behaviour | |----------|-----------| | `/v1/news/everything`, `/v1/news/top-headlines`, `/v1/news/local`, `/v1/news/count`, `/v1/news/trends` | Full support, `meta.prompt` in the response. | | `/v1/news/category`, `/v1/news/topic`, `/v1/news/industry`, `/v1/news/entity` | Full support. The URL path selects the category, topic, industry or entity. The prompt adds other filters. | | `/v1/news/raw` | Accepted, but this endpoint only understands `published_at.start`, `published_at.end`, `sort.order` and `per_page`. Everything else is reported with `reason: unsupported_on_endpoint`. | | `/v1/news/stream` | The prompt is validated and its filters are applied to the stream, but SSE has no JSON response, so there is no `meta.prompt` to read. | | `/v1/news/ws` | Supported. The `subscribed` message shows the filters used. | | `/v1/news/article`, `/v1/news/story`, `/v1/fact-check`, `/v1/suggest/*` | `prompt` is ignored entirely. No translation runs and nothing is charged. | `prompt` works both as a query-string parameter and inside a `POST` body, on every endpoint above. ## Cost, caching and quota A new prompt translation costs **2 points** in addition to the endpoint's cost. Repeating the same prompt within **24 hours** uses the cached translation for free. Case and extra spaces do not matter: `Tesla NEWS` and `tesla news` count as the same prompt. Check `meta.prompt.cached` to see whether you were charged for a translation. Repeated prompts still use current date ranges and current filter values. For example, `NOW-10DAY` always means the 10 days before the request. If your quota is exhausted, the API returns `402 ER0176` without a translation charge. Reaching a pay-as-you-go spending limit returns `402 ER0177`. Failed translations are also free. ## Plan availability `prompt` is available on **Basic and above**. On Free and Starter the request fails with `403 ER0706` before the translation runs, so nothing is charged. Every other way of searching — the regular filters, the boolean [`query`](/platform/news-api/query-builder) language, all endpoints — works on every plan. | Plan | `prompt` | |------|----------| | Free | No — `403 ER0706` | | Starter | No — `403 ER0706` | | Basic | Yes | | Professional | Yes | | Corporate | Yes | ## Errors | Code | HTTP | When | |------|------|------| | `ER0706` | 403 | The plan does not include `prompt` (Free and Starter). Nothing is charged. | | `ER0800` | 400 | The prompt is shorter than 3 or longer than 500 characters. | | `ER0801` | 502 | The translation service is unavailable. Nothing is charged; retry. | | `ER0802` | 400 | Nothing usable came out of the prompt — either no filter was found in it, or everything it produced was overridden or unsupported. | If the API cannot translate your prompt, it returns an error. It will not return unfiltered articles as an answer. On `/v1/news/ws`, these errors arrive in an `error` message followed by close code `4001`. Full list: [Prompt Errors](/platform/news-api/http-response-codes#prompt-errors). ## Writing prompts that work * **Use full names.** "Elon Musk" matches a known person; "the Tesla guy" is searched as a headline keyword. * **Keep each request focused.** The API keeps at most 3 values per field. If you list eight companies, only the first three are used. * **Include a date range in your prompt.** For example, "in the last two weeks" or "since the start of the month". Without a date range, the API applies no date filter unless the prompt searches headlines. Headline searches cover at most 31 days. * **Check `meta.prompt.applied` the first time.** It is the fastest way to see whether the sentence was read the way you meant it. * **Set exact requirements as parameters.** Send `language.code` or `source.domain` directly when you need a specific language or publisher. Use the prompt to describe the subject. ## Next steps * Parameter reference: [`prompt`](/platform/news-api/filters#prompt) * Find an entity's ID: [Suggest](/platform/news-api/suggest/entities) * Search with an AI assistant: [MCP Server](/platform/news-api/ai/mcp-server) --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/ruby/unirest-client.md' description: >- Call the APITube News API from Ruby using the standard Net::HTTP library for HTTP requests --- # Unirest integration ```ruby require 'uri' require 'net/http' require 'openssl' url = URI("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` --- --- url: 'https://docs.apitube.io/platform/news-api.md' description: >- Start using the APITube News API. Find the base URL, authentication, request examples and guides to search, analysis, streaming and integrations. --- # APITube News API Search news from 300,000+ sources worldwide. Each article includes people and companies mentioned in the text, sentiment, IPTC categories, topics, industries and readability scores. Send requests to `https://api.apitube.io` with your API key. Use this page to find the guide you need, or see [Endpoints](/platform/news-api/endpoints) for the full endpoint list. ## Your first request ```bash curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/everything?title=bitcoin&per_page=3" ``` Get your key at [apitube.io](https://apitube.io). Send it in the `X-API-Key` header as shown above. [Authentication](/platform/news-api/authentication) also covers `Authorization: Bearer` and the `api_key` URL parameter. The response lists articles in `results`. Each article has an `href` with a link to the original page. See [API Response Structure](/platform/news-api/response-structure) for all fields. ## Sections of this reference | Section | What is in it | |:--------|:--------------| | [Getting started](/guides/user-guide/make-your-first-api-call) | Send your first authenticated request and read the results. | | [Articles](/platform/news-api/articles) | Search, headlines, category and topic feeds, local news, raw articles, article IDs and related stories. | | [Insights](/platform/news-api/insights) | Find trends, count articles or check a claim against the news. | | [Directories](/platform/news-api/reference/) | People, company and journalist profiles with recent articles and coverage summaries. | | [Real-time delivery](/platform/news-api/real-time) | Receive new articles through SSE, WebSocket or webhooks. | | [Reference data](/platform/news-api/reference-data) | Allowed filter values: countries, languages, categories, topics, industries, event types, autocomplete. | | [AI](/platform/news-api/ai/) | Natural language search, MCP server, code editor setup, agent skills. | | [Tools](/platform/news-api/tools) | Query builder, API explorer, Postman collection, SDKs and integrations. | | [Help](/platform/news-api/help) | Glossary, technical FAQ, debugging, status page. | ## API basics {#how-the-api-is-shaped} A few basics apply across the API: **Use the same filters across article endpoints.** [`/v1/news/everything`](/platform/news-api/everything) supports all filters. Other article endpoints add a specific selection: `/v1/news/category/{taxonomy}/{category_id}` searches one category, and `/v1/news/top-headlines` limits results by source quality. **Entity filters find a specific person, company, brand or place.** For example, `organization.name=Tesla` finds articles about the company, rather than every use of the word. To find an entity ID, enter part of its name in the [autocomplete endpoints](/platform/news-api/reference-data). **Each request uses points.** A standard request costs 1 point. The `prompt` parameter adds 2 points, and [fact-check](/platform/news-api/fact-check) costs 5 points. Check your remaining points for free with [`/v1/balance`](/platform/news-api/balance). Your [rate limit](/platform/news-api/rate-limits) sets how many requests you can send per minute. ## Next steps * Pick an endpoint: [Endpoints](/platform/news-api/endpoints) * See the filters in action: [Usage examples](/platform/news-api/common-workflows/examples/) * Build a request in the browser: [Interactive Query Builder](/platform/news-api/query-builder) * Coming from another provider: [Migrations](/platform/migrations/) --- --- url: 'https://docs.apitube.io/platform/news-api/filters.md' description: >- Complete News API filter and request option reference, with types, limits, accepted values and request examples for every parameter. --- # News API filters Use these filters to narrow the articles returned by `/v1/news/everything`. Combine filters for titles, dates, languages, sources, entities, sentiment and other criteria. Send parameters in the URL with `GET` or as JSON with `POST`. The [API reference](/platform/news-api/articles) describes each endpoint, its additional parameters and any exceptions to the shared filters. Use [Reference data](/platform/news-api/reference-data) to find valid codes and IDs. ## All filters and request options {#parameters} All parameters are optional. Every example below uses `/v1/news/everything`. ### Prompt Describe the news you want in plain language. The API chooses the filters. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prompt` | string | No | Describe the news you want, for example "Elon Musk, Tesla, news for the last 10 days". Check meta.prompt for the filters used. Parameters you send directly take priority. A new translation costs 2 extra points; repeated prompts use the cached translation for free. Requires Basic or above. Free and Starter return 403 ER0706. Range: 3–500 characters. | **Find articles Described in Plain Language** Find recent English-language articles about Tesla and Elon Musk using a plain-language request. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "prompt": "Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?prompt=Tesla%20and%20Elon%20Musk%20news%20in%20English%20for%20the%20last%2010%20days&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ### Title search {#title-and-full-text-search} Search inside article titles. Limited to a 31-day `published_at` window. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.title` | string | No | Exclude articles containing this text in the title. Range: 2–100 characters. | | `query` | string | No | Combine conditions with `AND`, `OR`, `NOT` and parentheses. Use `field:value` to choose a field, quotes and `~N` to find nearby words, `[a TO b]` for a range, and `{{...}}` for entity conditions. Terms without a field search titles. A result must also match any other filters you send. Title searches cover at most 31 days of `published_at`. Invalid syntax returns `ER0701`–`ER0712`. Range: 0–4000 characters. Example: `bitcoin AND NOT (etf OR futures)`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | | `title` | string | No | Search article titles. To find words near each other, use a phrase such as "climate change"~2. Searches can cover at most 31 days of published\_at. Without dates, the API searches the last 31 days. A wider explicit range returns ER0110. Range: 2–100 characters. | | `title_ends_with` | string | No | Find articles whose titles end with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | | `title_pattern` | string | No | Find titles containing this text. Special characters are treated literally; this is not a regular expression. Searches cover at most 31 days, as with title. Range: 2–200 characters. | | `title_starts_with` | string | No | Find articles whose titles start with this text. As with title, the date range can cover at most 31 days. Range: 2–100 characters. | **Find articles with a Specific Title Keyword** Find articles with "technology" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "technology") 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) } ``` ```java [Java] 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/everything?title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=technology 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/everything ``` ::: **Find articles with Multiple Title Keywords** Find articles that contain **both** "AI" **and** "innovation" in their titles. Multiple comma- or space-separated keywords use **AND logic** — every word must be present (order does not matter). To match articles containing *either* word, send one request per keyword and merge the results. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI,innovation&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI,innovation", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI,innovation", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI,innovation", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI,innovation") 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) } ``` ```java [Java] 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/everything?title=AI,innovation&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI,innovation 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/everything ``` ::: **Find articles with Titles Excluding Certain Words** Find articles that do not have "celebrity" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?ignore.title=celebrity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.title" => "celebrity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("ignore.title", "celebrity") 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) } ``` ```java [Java] 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/everything?ignore.title=celebrity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?ignore.title=celebrity 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/everything ``` ::: **Combined Title Filters for Specific News** Find titles about AI and exclude titles about job losses. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI&ignore.title=layoffs,job%20losses&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI", "ignore.title": "layoffs,job losses", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "ignore.title": "layoffs,job losses", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "ignore.title" => "layoffs,job losses", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI") q.Set("ignore.title", "layoffs,job losses") 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) } ``` ```java [Java] 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/everything?title=AI&ignore.title=layoffs,job%20losses&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI&ignore.title=layoffs,job%20losses 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/everything ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22breaking%20news%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"breaking news\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"breaking news\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"breaking news\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"breaking 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) } ``` ```java [Java] 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/everything?title=%22breaking%20news%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22breaking%20news%22 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/everything ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. Search for exact organization or person names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22Federal%20Reserve%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"Federal Reserve\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Federal Reserve\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Federal Reserve\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"Federal Reserve\"") 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) } ``` ```java [Java] 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/everything?title=%22Federal%20Reserve%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22Federal%20Reserve%22 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/everything ``` ::: **Search for an exact phrase** Find articles with the exact phrase "breaking news" in the title. Search for exact organization or person names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22United%20Nations%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"United Nations\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"United Nations\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"United Nations\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"United Nations\"") 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) } ``` ```java [Java] 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/everything?title=%22United%20Nations%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22United%20Nations%22 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/everything ``` ::: **Find words near each other** Find articles where "Apple" and "iPhone" appear near each other: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22Apple%20iPhone%22~5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"Apple iPhone\"~5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Apple iPhone\"~5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Apple iPhone\"~5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"Apple iPhone\"~5") 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) } ``` ```java [Java] 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/everything?title=%22Apple%20iPhone%22~5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22Apple%20iPhone%22~5 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/everything ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=artificial%20intelligence&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "artificial intelligence", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "artificial intelligence", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "artificial intelligence", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "artificial intelligence") 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) } ``` ```java [Java] 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/everything?title=artificial%20intelligence&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=artificial%20intelligence 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/everything ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): Matches: "Artificial Intelligence" "Intelligence in Artificial Systems", "AI", "intelligent artificial systems" **Phrase search** (exact phrase only): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22artificial%20intelligence%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"artificial intelligence\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"artificial intelligence\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"artificial intelligence\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"artificial intelligence\"") 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) } ``` ```java [Java] 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/everything?title=%22artificial%20intelligence%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22artificial%20intelligence%22 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/everything ``` ::: **Compare keyword, phrase and proximity searches** **Regular search** (finds keywords in any order, with synonyms): Matches: "Artificial Intelligence" "Intelligence in Artificial Systems", "AI", "intelligent artificial systems" **Phrase search** (exact phrase only): Matches only: "Artificial Intelligence", "artificial intelligence" (exact phrase) **Proximity search** (words near each other): ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22artificial%20intelligence%22~3&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"artificial intelligence\"~3", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"artificial intelligence\"~3", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"artificial intelligence\"~3", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"artificial intelligence\"~3") 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) } ``` ```java [Java] 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/everything?title=%22artificial%20intelligence%22~3&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22artificial%20intelligence%22~3 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/everything ``` ::: **Find a company and product near each other** Find articles mentioning company and product name near each other: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"Tesla Cybertruck\"~3", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Tesla Cybertruck\"~3", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Tesla Cybertruck\"~3", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"Tesla Cybertruck\"~3") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/everything?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22Tesla%20Cybertruck%22~3&published_at.start=NOW-7DAYS 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/everything ``` ::: **Search for an exact event name** Search for specific event names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22Super%20Bowl%202024%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"Super Bowl 2024\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"Super Bowl 2024\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"Super Bowl 2024\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"Super Bowl 2024\"") 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) } ``` ```java [Java] 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/everything?title=%22Super%20Bowl%202024%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22Super%20Bowl%202024%22 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/everything ``` ::: **Search for an exact event name** Search for specific event names: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=%22World%20Cup%20Final%22&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "\"World Cup Final\"", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "\"World Cup Final\"", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "\"World Cup Final\"", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "\"World Cup Final\"") 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) } ``` ```java [Java] 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/everything?title=%22World%20Cup%20Final%22&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=%22World%20Cup%20Final%22 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/everything ``` ::: ### Article lookup | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `article.id` | string | No | Comma-separated article IDs (max 5). Example: `12345`. | ### Date 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`. | **Find articles within a specific date range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "published_at.start": "2022-01-01", "published_at.end": "2022-01-31", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?published_at.start=2022-01-01&published_at.end=2022-01-31&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find news using a relative time range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "published_at.start": "NOW-7DAYS", "published_at.end": "NOW", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["published_at.start" => "NOW-7DAYS", "published_at.end" => "NOW", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?published_at.start=NOW-7DAYS&published_at.end=NOW&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Search between exact times** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "published_at.start": "2025-03-01T14:00:00Z", "published_at.end": "2025-03-02T14:00:00Z", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "published_at.start": "2025-03-01T14:00:00Z", "published_at.end": "2025-03-02T14:00:00Z", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "published_at.start" => "2025-03-01T14:00:00Z", "published_at.end" => "2025-03-02T14:00:00Z", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("published_at.start", "2025-03-01T14:00:00Z") q.Set("published_at.end", "2025-03-02T14:00:00Z") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&published_at.start=2025-03-01T14:00:00Z&published_at.end=2025-03-02T14:00:00Z&sort.by=published_at&sort.order=asc 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/everything ``` ::: ### Languages | 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`. | **Exclude French articles and publishers in France** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.source.country.code": "fr", "ignore.language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.source.country.code" => "fr", "ignore.language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?ignore.source.country.code=fr&ignore.language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles in the English and French languages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?language.code=en,fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Compare languages and sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,ja,de", "source.rank.opr.min": "6", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,ja,de", "source.rank.opr.min": "6", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,ja,de", "source.rank.opr.min" => "6", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,ja,de") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,ja,de&source.rank.opr.min=6&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find business news in one language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "zh,ko", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "zh,ko", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Compare company sentiment across languages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "en,fr,de", "organization.name": "Netflix", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "en,fr,de", "organization.name": "Netflix", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "en,fr,de", "organization.name" => "Netflix", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "en,fr,de") q.Set("organization.name", "Netflix") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=en,fr,de&organization.name=Netflix&sentiment.overall.polarity=positive&sort.by=published_at 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/everything ``` ::: **Compare news by language and region** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "language.code": "ar,he", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "language.code": "ar,he", "category.id": "medtop:11000000", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["language.code" => "ar,he", "category.id" => "medtop:11000000", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("language.code", "ar,he") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?language.code=ar,he&category.id=medtop:11000000&sort.by=sentiment.overall.score 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/everything ``` ::: ### Source | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.source.bias` | string | No | Exclude publishers with these political biases, separated by commas. 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). | | `is_premium_source` | boolean | No | Filter by premium source status. | | `is_verified_source` | boolean | No | Filter by verified source status. | | `source.bias` | string | No | Filter by publishers' political bias, separated by commas. 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. | **Find articles from a specific source (e.g., "theguardian.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles from multiple sources (e.g., "theguardian.com" and "nytimes.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Choose a source and language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "theguardian.com", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles with rank between 0.5 and 0.9** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.rank.opr.min": "5", "source.rank.opr.max": "9", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "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/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["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/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.rank.opr.min=5&source.rank.opr.max=9&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Compare source bias across regions** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "source.country.code": "us,gb,de", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "source.country.code": "us,gb,de", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "source.country.code" => "us,gb,de", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("source.country.code", "us,gb,de") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us,gb,de&sort.by=sentiment.overall.score 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/everything ``` ::: **Find premium source articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_premium_source=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_premium_source": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_premium_source": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_premium_source" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_premium_source", "1") 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) } ``` ```java [Java] 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/everything?is_premium_source=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_premium_source=1&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/everything ``` ::: **Find verified source articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_verified_source=1&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_verified_source": "1", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_verified_source": "1", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_verified_source" => "1", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_verified_source", "1") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?is_verified_source=1&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_verified_source=1&published_at.start=2024-01-01 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/everything ``` ::: ### Authors | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `author.id` | string | No | Comma-separated author IDs (max 3). | | `author.name` | string | No | Filter by author name (comma-separated, max 3). Range: 0–100 characters. | | `has_author` | boolean | No | Filter articles with/without author. | | `ignore.author.id` | string | No | Exclude these author IDs (comma-separated, max 3). | | `ignore.author.name` | string | No | Exclude articles by these authors (comma-separated, max 3). Range: 0–100 characters. | **Find articles by a specific author (e.g., "AFP")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/everything?author.name=AFP&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP 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/everything ``` ::: **Find articles by multiple authors (e.g., "AFP" and "Reuters")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP,Reuters") 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) } ``` ```java [Java] 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/everything?author.name=AFP,Reuters&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters 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/everything ``` ::: **Choose an author and language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP") 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) } ``` ```java [Java] 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/everything?author.name=AFP&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP&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/everything ``` ::: **Find an author's articles on a subject** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "Ezra Klein", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "Ezra Klein", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "desc", "per_page": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "Ezra Klein", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "Ezra Klein") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "10") 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) } ``` ```java [Java] 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/everything?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=Ezra%20Klein&category.id=medtop:11000000&sort.by=published_at&sort.order=desc&per_page=10 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/everything ``` ::: **Compare sentiment by author** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "AFP,Reuters", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "AFP,Reuters", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "AFP,Reuters") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=AFP,Reuters&sort.by=sentiment.overall.score 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/everything ``` ::: **Follow an author's coverage over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "author.name": "Reuters", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["author.name" => "Reuters", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("author.name", "Reuters") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?author.name=Reuters&sort.by=published_at&sort.order=asc&per_page=100 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/everything ``` ::: **Find articles with attributed authors** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_author=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_author": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_author": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_author" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_author", "1") 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) } ``` ```java [Java] 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/everything?has_author=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_author=1&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/everything ``` ::: **Find articles without authors** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_author=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_author": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_author": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_author" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_author", "0") 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) } ``` ```java [Java] 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/everything?has_author=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_author=0 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/everything ``` ::: ### Categories | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `category.id` | string | No | Category IDs, separated by commas (max 3). Use IPTC Media Topic IDs such as medtop:04000000. Example: `medtop:04000000`. | | `ignore.category.id` | string | No | Exclude these categories (comma-separated, max 3). | **Find articles from a specific category (e.g., "Sport")** Find articles in the "sport" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:15000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?category.id=medtop:15000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles in the Finance Category** Find articles in the "finance" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Choose a category and language** Find articles in the "politics" category that are in French. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "language.code": "fr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "language.code" => "fr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Track category coverage over time** Get finance articles in date order to track coverage over time. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "published_at.start": "NOW-30DAY", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "published_at.start": "NOW-30DAY", "sort.by": "published_at", "sort.order": "asc", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "published_at.start" => "NOW-30DAY", "sort.by" => "published_at", "sort.order" => "asc", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("published_at.start", "NOW-30DAY") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&published_at.start=NOW-30DAY&sort.by=published_at&sort.order=asc&per_page=100 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/everything ``` ::: **Find category articles with images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:01000000", "media.images.count": "3", "source.rank.opr.min": "6", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:01000000", "media.images.count": "3", "source.rank.opr.min": "6", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:01000000", "media.images.count" => "3", "source.rank.opr.min" => "6", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:01000000") q.Set("media.images.count", "3") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:01000000&media.images.count=3&source.rank.opr.min=6&sort.by=media.images.count&sort.order=desc 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/everything ``` ::: **Compare sentiment across categories** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity": "positive", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:20000003,medtop:11000000,medtop:20000607", "sentiment.overall.polarity" => "positive", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:20000003,medtop:11000000,medtop:20000607") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:20000003,medtop:11000000,medtop:20000607&sentiment.overall.polarity=positive&sort.by=sentiment.overall.score 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/everything ``` ::: ### Topics | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.topic.id` | string | No | Exclude these topics (comma-separated, max 3). | | `topic.id` | string | No | Topic IDs, separated by commas (max 3). Find IDs with /v1/suggest/topics, for example industry.technology\_news. Example: `industry.technology_news`. | **Find articles from a specific topic (e.g., "crypto\_news")** Find articles in the "crypto news" topic. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?topic.id=industry.crypto_news&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Compare sentiment across topics** Compare sentiment across related topics. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news,industry.energy_news") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive 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/everything ``` ::: **Compare topic coverage by language** Compare topic coverage in different languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "language.code": "en,de,ja", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "language.code": "en,de,ja", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "language.code" => "en,de,ja", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("language.code", "en,de,ja") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&language.code=en,de,ja&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find a subject within a topic** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.crypto_news", "entity.id": "326,327", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "entity.id": "326,327", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "entity.id" => "326,327", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.crypto_news") q.Set("entity.id", "326,327") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&entity.id=326,327&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find expert coverage of a topic** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.technology_news", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.technology_news", "language.code": "en", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.technology_news", "language.code" => "en", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.technology_news") q.Set("language.code", "en") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&language.code=en&sort.by=published_at&sort.order=desc 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/everything ``` ::: ### Industries | 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`. | **Follow industry coverage over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400,438") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?industry.id=400,438&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400,438&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find innovation news across industries** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "400,438", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "400,438", "title": "innovation", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "400,438", "title" => "innovation", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "400,438") q.Set("title", "innovation") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=400,438&title=innovation&sentiment.overall.polarity=positive 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/everything ``` ::: ### Entities, people, organizations, brands | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `brand.name` | string | No | Filter by brand name (comma-separated, max 3). Range: 0–120 characters. | | `disaster.name` | string | No | Filter by natural disaster name (comma-separated, max 3). Range: 0–120 characters. | | `disease.name` | string | No | Filter by disease name (comma-separated, max 3). Range: 0–120 characters. | | `entity.id` | string | No | Comma-separated entity IDs (max 3). Example: `12345`. | | `event.name` | string | No | Filter by event name (comma-separated, max 3). Range: 0–120 characters. | | `ignore.brand.name` | string | No | Exclude articles mentioning these brands (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disaster.name` | string | No | Exclude articles mentioning these disasters (comma-separated, max 3). Range: 0–120 characters. | | `ignore.disease.name` | string | No | Exclude articles mentioning these diseases (comma-separated, max 3). Range: 0–120 characters. | | `ignore.entity.id` | string | No | Exclude these entity IDs (comma-separated, max 3). | | `ignore.event.name` | string | No | Exclude articles mentioning these events (comma-separated, max 3). Range: 0–120 characters. | | `ignore.location.name` | string | No | Exclude articles mentioning these locations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.organization.name` | string | No | Exclude articles mentioning these organizations (comma-separated, max 3). Range: 0–120 characters. | | `ignore.person.name` | string | No | Exclude articles mentioning these persons (comma-separated, max 3). Range: 0–120 characters. | | `ignore.sport.name` | string | No | Exclude articles mentioning these sports (comma-separated, max 3). Range: 0–120 characters. | | `location.name` | string | No | Filter by up to 3 known location names, separated by commas. Use /v1/suggest/entities to check the spelling. An unknown name returns 400 ER0218. Range: 0–120 characters. Example: `New York City`. | | `organization.name` | string | No | Filter by organization name (comma-separated, max 3). Range: 0–120 characters. Example: `Google`. | | `person.name` | string | No | Filter by person name (comma-separated, max 3). Range: 0–120 characters. Example: `Elon Musk`. | | `sport.name` | string | No | Filter by sport name (comma-separated, max 3). Range: 0–120 characters. | **Find articles about a specific entity (e.g., "Brad Pitt")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?entity.id=1278268&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles about multiple entities (e.g., "Brad Pitt" and "Angelina Jolie")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1282301&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1282301", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1282301&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles about an entity while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "ignore.entity.id": "315", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "ignore.entity.id": "315", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "ignore.entity.id" => "315", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: **Find articles mentioning both entities** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1282301", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268,1282301") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268,1282301&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Track entity mentions over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "per_page": "100", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "per_page" => "100", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268") q.Set("per_page", "100") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268&per_page=100&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find entities mentioned together** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?entity.id=1278268&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268&sort.by=published_at 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/everything ``` ::: **Find sentiment about an entity in market news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "entity.id": "1278268,1282301", "category.id": "medtop:04000000", "sentiment.overall.score.min": "0.7", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "entity.id": "1278268,1282301", "category.id": "medtop:04000000", "sentiment.overall.score.min": "0.7", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["entity.id" => "1278268,1282301", "category.id" => "medtop:04000000", "sentiment.overall.score.min" => "0.7", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("entity.id", "1278268,1282301") q.Set("category.id", "medtop:04000000") q.Set("sentiment.overall.score.min", "0.7") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?entity.id=1278268,1282301&category.id=medtop:04000000&sentiment.overall.score.min=0.7&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Find articles about a specific person (e.g., "Elon Musk")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk 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/everything ``` ::: **Find articles about multiple people (e.g., "Elon Musk" and "Donald Trump")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk,Donald%20Trump&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk,Donald Trump", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk,Donald Trump") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk,Donald%20Trump&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk,Donald%20Trump 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/everything ``` ::: **Compare sentiment about a person across sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "source.domain" => "theguardian.com,foxnews.com,nytimes.com", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("source.domain", "theguardian.com,foxnews.com,nytimes.com") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Find articles about a person and organization** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "organization.name" => "Tesla", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("organization.name", "Tesla") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Track negative coverage of a public figure** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find mentions of a person in research news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Stephen Hawking", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Stephen Hawking", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Stephen Hawking", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Stephen Hawking") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Stephen%20Hawking&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find articles about a specific organization (e.g., "Google")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") 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) } ``` ```java [Java] 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/everything?organization.name=Google&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google 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/everything ``` ::: **Find articles about multiple organizations (e.g., "Google" and "Apple")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google,Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google,Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google,Apple") 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) } ``` ```java [Java] 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/everything?organization.name=Google,Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google,Apple 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/everything ``` ::: **Include one organization and exclude another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "ignore.organization.name" => "Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("ignore.organization.name", "Apple") 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) } ``` ```java [Java] 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/everything?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&ignore.organization.name=Apple 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/everything ``` ::: **Follow competitor coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla,Meta,Netflix", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla,Meta,Netflix", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla,Meta,Netflix", "category.id" => "medtop:13000000", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla,Meta,Netflix") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla,Meta,Netflix&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Track company sentiment around financial news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "sort.by" => "published_at", "sort.order" => "asc", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&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/everything ``` ::: **Find company news about social responsibility** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Microsoft,Google,Amazon", "title" => "sustainability,ESG,green", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Microsoft,Google,Amazon") q.Set("title", "sustainability,ESG,green") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive 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/everything ``` ::: **Follow leadership changes** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "title" => "CEO", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("title", "CEO") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find articles about a specific disaster (e.g., "Earthquake")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") 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) } ``` ```java [Java] 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/everything?disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake 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/everything ``` ::: **Find articles about multiple disasters (e.g., "Earthquake" and "Tsunami")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disaster.name": "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake,2017 Pedrógão Grande Wildfire") 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) } ``` ```java [Java] 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/everything?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake,2017%20Pedrógão%20Grande%20Wildfire 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/everything ``` ::: **Find articles about a disaster while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disaster.name": "Great Hanshin Earthquake", "ignore.disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "ignore.disaster.name": "Great Hanshin Earthquake", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "ignore.disaster.name" => "Great Hanshin Earthquake", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") q.Set("ignore.disaster.name", "Great Hanshin Earthquake") 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) } ``` ```java [Java] 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/everything?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake&ignore.disaster.name=Great%20Hanshin%20Earthquake 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/everything ``` ::: **Find disaster coverage by region** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disaster.name": "Great Hanshin Earthquake", "location.name": "Japan", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disaster.name": "Great Hanshin Earthquake", "location.name": "Japan", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disaster.name" => "Great Hanshin Earthquake", "location.name" => "Japan", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disaster.name", "Great Hanshin Earthquake") q.Set("location.name", "Japan") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disaster.name=Great%20Hanshin%20Earthquake&location.name=Japan&sort.by=published_at 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/everything ``` ::: **Find articles about a specific disease (e.g., "COVID-19")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disease.name=COVID-19&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disease.name": "COVID-19", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "COVID-19", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "COVID-19", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disease.name", "COVID-19") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/everything?disease.name=COVID-19&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disease.name=COVID-19&category.id=medtop:07000000 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/everything ``` ::: **Find articles about multiple diseases** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disease.name=COVID-19,Influenza&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disease.name": "COVID-19,Influenza", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "COVID-19,Influenza", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "COVID-19,Influenza", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disease.name", "COVID-19,Influenza") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/everything?disease.name=COVID-19,Influenza&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disease.name=COVID-19,Influenza&category.id=medtop:07000000 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/everything ``` ::: **Find articles about a disease while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disease.name": "malaria", "ignore.disease.name": "dengue fever", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "malaria", "ignore.disease.name": "dengue fever", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "malaria", "ignore.disease.name" => "dengue fever", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disease.name", "malaria") q.Set("ignore.disease.name", "dengue fever") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/everything?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disease.name=malaria&ignore.disease.name=dengue%20fever&category.id=medtop:07000000 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/everything ``` ::: **Follow a disease outbreak** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "disease.name": "malaria", "category.id": "medtop:07000000", "published_at.start": "2024-01-01", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "disease.name": "malaria", "category.id": "medtop:07000000", "published_at.start": "2024-01-01", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["disease.name" => "malaria", "category.id" => "medtop:07000000", "published_at.start" => "2024-01-01", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("disease.name", "malaria") q.Set("category.id", "medtop:07000000") q.Set("published_at.start", "2024-01-01") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?disease.name=malaria&category.id=medtop:07000000&published_at.start=2024-01-01&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find articles about a specific brand (e.g., "Apple")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Coca-Cola") 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) } ``` ```java [Java] 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/everything?brand.name=Coca-Cola&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola 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/everything ``` ::: **Find articles about multiple brands (e.g., "Apple" and "Google")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola,Samsung%20Galaxy&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Coca-Cola,Samsung Galaxy", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola,Samsung Galaxy", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola,Samsung Galaxy", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Coca-Cola,Samsung Galaxy") 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) } ``` ```java [Java] 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/everything?brand.name=Coca-Cola,Samsung%20Galaxy&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola,Samsung%20Galaxy 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/everything ``` ::: **Include one brand and exclude another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Coca-Cola", "ignore.brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola", "ignore.brand.name": "Coca-Cola", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola", "ignore.brand.name" => "Coca-Cola", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Coca-Cola") q.Set("ignore.brand.name", "Coca-Cola") 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) } ``` ```java [Java] 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/everything?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola&ignore.brand.name=Coca-Cola 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/everything ``` ::: **Compare brand sentiment across markets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Tesla Robotaxi", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla Robotaxi", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla Robotaxi", "source.country.code" => "us,de,gb", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Tesla Robotaxi") q.Set("source.country.code", "us,de,gb") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Tesla%20Robotaxi&source.country.code=us,de,gb&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Find brand sponsorship coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Coca-Cola,Samsung Galaxy,iPhone Air", "title": "sponsorship,tournament,championship", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Coca-Cola,Samsung Galaxy,iPhone Air", "title": "sponsorship,tournament,championship", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Coca-Cola,Samsung Galaxy,iPhone Air", "title" => "sponsorship,tournament,championship", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Coca-Cola,Samsung Galaxy,iPhone Air") q.Set("title", "sponsorship,tournament,championship") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Coca-Cola,Samsung%20Galaxy,iPhone%20Air&title=sponsorship,tournament,championship&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Follow negative coverage of a brand** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "brand.name": "Tesla Robotaxi", "title": "recall", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "brand.name": "Tesla Robotaxi", "title": "recall", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["brand.name" => "Tesla Robotaxi", "title" => "recall", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("brand.name", "Tesla Robotaxi") q.Set("title", "recall") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?brand.name=Tesla%20Robotaxi&title=recall&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find articles about a specific sport (e.g., "Football")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sport.name": "Road tennis", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sport.name", "Road tennis") 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) } ``` ```java [Java] 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/everything?sport.name=Road%20tennis&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis 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/everything ``` ::: **Find articles about multiple sports** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis,Nike%20Hoop%20Summit&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sport.name": "Road tennis,Nike Hoop Summit", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis,Nike Hoop Summit", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis,Nike Hoop Summit", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sport.name", "Road tennis,Nike Hoop Summit") 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) } ``` ```java [Java] 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/everything?sport.name=Road%20tennis,Nike%20Hoop%20Summit&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis,Nike%20Hoop%20Summit 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/everything ``` ::: **Find articles about a sport while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sport.name": "Road tennis", "ignore.sport.name": "Road tennis", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sport.name": "Road tennis", "ignore.sport.name": "Road tennis", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sport.name" => "Road tennis", "ignore.sport.name" => "Road tennis", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sport.name", "Road tennis") q.Set("ignore.sport.name", "Road tennis") 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) } ``` ```java [Java] 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/everything?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sport.name=Road%20tennis&ignore.sport.name=Road%20tennis 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/everything ``` ::: ### Event types | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `event.category` | string | No | Filter by event category. One of: `business`, `society`, `environment`. | | `event.type` | string | No | Comma-separated event types (max 5). Values: merger-acquisition, ipo, layoffs, bankruptcy, product-launch, funding-round, earnings, partnership, executive-change, lawsuit, data-breach, recall, expansion, closure, stock-movement, contract-award, spin-off, regulatory-action, election, protest, crime, terrorism, accident, policy-change, scandal, death, award-ceremony, conflict, diplomacy, health-crisis, migration, human-rights, earthquake, hurricane, flood, wildfire, tornado, tsunami, volcanic-eruption, drought, climate-event, pollution, wildlife-event, avalanche. Example: `ipo`. | | `ignore.event.type` | string | No | Exclude these event types (comma-separated, max 5). | **Find articles about a specific event (e.g., "Black Friday")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.name=Black%20Friday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.name": "Black Friday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.name", "Black Friday") 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) } ``` ```java [Java] 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/everything?event.name=Black%20Friday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.name=Black%20Friday 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/everything ``` ::: **Find articles about multiple events** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.name=Black%20Friday,Cyber%20Monday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.name": "Black Friday,Cyber Monday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday,Cyber Monday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday,Cyber Monday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.name", "Black Friday,Cyber Monday") 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) } ``` ```java [Java] 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/everything?event.name=Black%20Friday,Cyber%20Monday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.name=Black%20Friday,Cyber%20Monday 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/everything ``` ::: **Find articles about an event while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.name=Black%20Friday&ignore.event.name=Black%20Friday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.name": "Black Friday", "ignore.event.name": "Black Friday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Black Friday", "ignore.event.name": "Black Friday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Black Friday", "ignore.event.name" => "Black Friday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.name", "Black Friday") q.Set("ignore.event.name", "Black Friday") 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) } ``` ```java [Java] 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/everything?event.name=Black%20Friday&ignore.event.name=Black%20Friday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.name=Black%20Friday&ignore.event.name=Black%20Friday 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/everything ``` ::: **Compare sentiment in event coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.name": "Super Bowl Sunday", "sentiment.overall.polarity": "positive", "published_at.start": "2024-01-01", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.name": "Super Bowl Sunday", "sentiment.overall.polarity": "positive", "published_at.start": "2024-01-01", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.name" => "Super Bowl Sunday", "sentiment.overall.polarity" => "positive", "published_at.start" => "2024-01-01", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.name", "Super Bowl Sunday") q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "2024-01-01") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.name=Super%20Bowl%20Sunday&sentiment.overall.polarity=positive&published_at.start=2024-01-01&sort.by=sentiment.overall.score 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/everything ``` ::: ### Sentiment | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `entity.sentiment.polarity` | string | No | Filter by the tone of coverage about an entity. Choose the entity with entity.id, person.name, organization.name, location.name, brand.name, event.name, disease.name, disaster.name or sport.name. Without one of these fields, the API returns 400 ER0293. 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. | | `is_clickbait` | boolean | No | Filter by clickbait detection. | | `sentiment.body.polarity` | string | No | Filter by the tone of the article body. One of: `positive`, `negative`, `neutral`. | | `sentiment.body.score` | number | No | Exact body sentiment score. Range: -1–1. | | `sentiment.body.score.max` | number | No | Maximum body sentiment score. Range: -1–1. | | `sentiment.body.score.min` | number | No | Minimum body sentiment score. Range: -1–1. | | `sentiment.consistent` | boolean | No | Find articles whose title and body have the same tone. | | `sentiment.mixed` | boolean | No | Find articles whose title and body have different tones. | | `sentiment.overall.polarity` | string | No | Filter by the overall tone of the article. One of: `positive`, `negative`, `neutral`. | | `sentiment.overall.score` | number | No | Exact overall sentiment score. Range: -1–1. | | `sentiment.overall.score.max` | number | No | Maximum overall sentiment score. Range: -1–1. | | `sentiment.overall.score.min` | number | No | Minimum overall sentiment score. Range: -1–1. | | `sentiment.title.polarity` | string | No | Filter by the tone of the article title. One of: `positive`, `negative`, `neutral`. | | `sentiment.title.score` | number | No | Exact title sentiment score. Range: -1–1. | | `sentiment.title.score.max` | number | No | Maximum title sentiment score. Range: -1–1. | | `sentiment.title.score.min` | number | No | Minimum title sentiment score. Range: -1–1. | | `sentiment_gap.max` | number | No | Maximum difference between title and body sentiment scores. Range: 0–2. | | `sentiment_gap.min` | number | No | Minimum difference between title and body sentiment scores. Range: 0–2. | **Find positive news** Find articles with positive sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive 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/everything ``` ::: **Find positive news from a Specific Country** Find articles with positive sentiment specifically from Japan ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "source.country.code" => "jp", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("source.country.code", "jp") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&source.country.code=jp 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/everything ``` ::: **Find positive news in the Last 24 Hours** Find articles with positive sentiment published in the last 24 hours. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "published_at.start": "2024-12-02", "published_at.end": "2024-12-03", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "published_at.start": "2024-12-02", "published_at.end": "2024-12-03", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "published_at.start" => "2024-12-02", "published_at.end" => "2024-12-03", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "2024-12-02") q.Set("published_at.end", "2024-12-03") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&published_at.start=2024-12-02&published_at.end=2024-12-03 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/everything ``` ::: **Find articles with Positive Sentiment and a Specific Title** Find articles with positive sentiment that have "technology" in their titles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("title", "technology") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&title=technology 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/everything ``` ::: **Filter several sentiment fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.score.min": "0.7", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.score.min": "0.7", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.score.min" => "0.7", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.score.min", "0.7") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.score.min=0.7&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Compare sentiment across markets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "negative", "source.country.code" => "us,gb,de", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "negative") q.Set("source.country.code", "us,gb,de") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000 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/everything ``` ::: **Compare sentiment across source types** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "sentiment.overall.polarity": "positive", "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "sentiment.overall.polarity": "positive", "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "sentiment.overall.polarity" => "positive", "source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sentiment.overall.polarity=positive&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/everything ``` ::: **Find sentiment in product reviews** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "review", "organization.name": "Apple", "sentiment.overall.score.min": "-1.0", "sentiment.overall.score.max": "1.0", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "review", "organization.name": "Apple", "sentiment.overall.score.min": "-1.0", "sentiment.overall.score.max": "1.0", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "review", "organization.name" => "Apple", "sentiment.overall.score.min" => "-1.0", "sentiment.overall.score.max" => "1.0", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "review") q.Set("organization.name", "Apple") q.Set("sentiment.overall.score.min", "-1.0") q.Set("sentiment.overall.score.max", "1.0") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=review&organization.name=Apple&sentiment.overall.score.min=-1.0&sentiment.overall.score.max=1.0&sort.by=sentiment.overall.score 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/everything ``` ::: **Find articles with mixed sentiment** Find articles where the title sentiment differs from body sentiment, useful for detecting clickbait or controversial framing. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.mixed=1&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.mixed": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.mixed": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.mixed" => "1", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.mixed", "1") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/everything?sentiment.mixed=1&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.mixed=1&category.id=medtop:11000000 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/everything ``` ::: **Find articles with consistent sentiment** Find articles whose title and body have the same sentiment label. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.consistent=1&has_author=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.consistent": "1", "has_author": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.consistent": "1", "has_author": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.consistent" => "1", "has_author" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.consistent", "1") q.Set("has_author", "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) } ``` ```java [Java] 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/everything?sentiment.consistent=1&has_author=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.consistent=1&has_author=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/everything ``` ::: **Find clickbait articles** Find articles whose title has strong positive or negative sentiment that differs from the body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_clickbait=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_clickbait": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_clickbait", "1") 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) } ``` ```java [Java] 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/everything?is_clickbait=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_clickbait=1&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/everything ``` ::: **Exclude clickbait and choose verified sources** Find articles with consistent headline-to-content sentiment from verified sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_clickbait=0&is_verified_source=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_clickbait": "0", "is_verified_source": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "0", "is_verified_source": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "0", "is_verified_source" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_clickbait", "0") q.Set("is_verified_source", "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) } ``` ```java [Java] 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/everything?is_clickbait=0&is_verified_source=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_clickbait=0&is_verified_source=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/everything ``` ::: **Filter by sentiment gap – find articles with significant title/body mismatch** Find articles where the sentiment score differs by at least 0.5 between title and body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment_gap.min=0.5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment_gap.min": "0.5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment_gap.min": "0.5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment_gap.min" => "0.5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment_gap.min", "0.5") 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) } ``` ```java [Java] 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/everything?sentiment_gap.min=0.5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment_gap.min=0.5 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/everything ``` ::: **Find articles with similar title and body sentiment** Find articles with minimal sentiment difference (gap < 0.2) between title and body. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment_gap.max=0.2&source.rank.opr.min=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment_gap.max": "0.2", "source.rank.opr.min": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment_gap.max": "0.2", "source.rank.opr.min": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment_gap.max" => "0.2", "source.rank.opr.min" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment_gap.max", "0.2") q.Set("source.rank.opr.min", "5") 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) } ``` ```java [Java] 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/everything?sentiment_gap.max=0.2&source.rank.opr.min=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment_gap.max=0.2&source.rank.opr.min=5 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/everything ``` ::: **Combined clickbait analysis for political news** Find political articles flagged as clickbait. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_clickbait": "1", "category.id": "medtop:11000000", "sentiment_gap.min": "0.3", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_clickbait": "1", "category.id": "medtop:11000000", "sentiment_gap.min": "0.3", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_clickbait" => "1", "category.id" => "medtop:11000000", "sentiment_gap.min" => "0.3", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_clickbait", "1") q.Set("category.id", "medtop:11000000") q.Set("sentiment_gap.min", "0.3") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_clickbait=1&category.id=medtop:11000000&sentiment_gap.min=0.3&sort.by=sentiment.overall.score 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/everything ``` ::: ### Media | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_4k_images` | boolean | No | Filter articles with 4K images (>= 3840px width). | | `has_consistent_image_sizes` | boolean | No | Filter articles with consistent image dimensions. | | `has_fullhd_images` | boolean | No | Filter articles with Full HD images (>= 1920px width). | | `has_hq_images` | boolean | No | Filter articles with high-quality images (>= 1200px width). | | `has_image` | boolean | No | Filter articles with/without images. | | `has_mixed_media` | boolean | No | Filter articles with both image and video media types. | | `has_mobile_optimized_images` | boolean | No | Filter articles with mobile-optimized images (320-800px width). | | `has_multiple_images` | boolean | No | Filter articles with 2+ images. | | `has_social_share_image` | boolean | No | Filter articles with social share images (>= 1200x630px). | | `has_thumbnail` | boolean | No | Filter articles with thumbnail images (<= 300px width). | | `has_video` | boolean | No | Filter articles with/without videos. | | `is_instagram_ready` | boolean | No | Find images at least 1080px wide with a square or 4:5 aspect ratio for Instagram. | | `is_landscape_media` | boolean | No | Filter articles with landscape-oriented media. | | `is_media_rich` | boolean | No | Filter articles with both images and videos. | | `is_portrait_media` | boolean | No | Filter articles with portrait-oriented media. | | `is_twitter_card_ready` | boolean | No | Find landscape images at least 800px wide for Twitter Cards. | | `media.images.count` | integer | No | Exact number of images. Range: min 0. | | `media.images.count.max` | integer | No | Maximum number of images. Range: min 0. | | `media.images.count.min` | integer | No | Minimum number of images. Range: min 0. | | `media.images.height.max` | integer | No | Maximum image height in pixels. Range: min 0. | | `media.images.height.min` | integer | No | Minimum image height in pixels. Range: min 0. | | `media.images.width.max` | integer | No | Maximum image width in pixels. Range: min 0. | | `media.images.width.min` | integer | No | Minimum image width in pixels. Range: min 0. | | `media.videos.count` | integer | No | Exact number of videos. Range: min 0. | | `media.videos.count.max` | integer | No | Maximum number of videos. Range: min 0. | | `media.videos.count.min` | integer | No | Minimum number of videos. Range: min 0. | **Find articles with a specific number of images and videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "media.videos.count": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "media.videos.count" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("media.videos.count", "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) } ``` ```java [Java] 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/everything?media.images.count=2&media.videos.count=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=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/everything ``` ::: **Find articles with images of a specific size** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "200", "media.images.width.max": "800", "media.images.height.min": "200", "media.images.height.max": "800", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "200", "media.images.width.max" => "800", "media.images.height.min" => "200", "media.images.height.max" => "800", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.width.min", "200") q.Set("media.images.width.max", "800") q.Set("media.images.height.min", "200") q.Set("media.images.height.max", "800") 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) } ``` ```java [Java] 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/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.width.min=200&media.images.width.max=800&media.images.height.min=200&media.images.height.max=800 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/everything ``` ::: **Find articles with multiple images and videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "3", "media.videos.count": "1", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "3", "media.videos.count": "1", "category.id": "medtop:13000000", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "3", "media.videos.count" => "1", "category.id" => "medtop:13000000", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "3") q.Set("media.videos.count", "1") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=3&media.videos.count=1&category.id=medtop:13000000&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Find news with large images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.width.min": "1200", "media.images.height.min": "800", "media.images.count": "2", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "source.rank.opr.min": "6", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.width.min": "1200", "media.images.height.min": "800", "media.images.count": "2", "sentiment.overall.polarity": "positive", "category.id": "medtop:13000000", "source.rank.opr.min": "6", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.width.min" => "1200", "media.images.height.min" => "800", "media.images.count" => "2", "sentiment.overall.polarity" => "positive", "category.id" => "medtop:13000000", "source.rank.opr.min" => "6", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.width.min", "1200") q.Set("media.images.height.min", "800") q.Set("media.images.count", "2") q.Set("sentiment.overall.polarity", "positive") q.Set("category.id", "medtop:13000000") q.Set("source.rank.opr.min", "6") 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) } ``` ```java [Java] 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/everything?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.width.min=1200&media.images.height.min=800&media.images.count=2&sentiment.overall.polarity=positive&category.id=medtop:13000000&source.rank.opr.min=6 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/everything ``` ::: **Find education articles with videos** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.videos.count": "2", "title": "education,learning,tutorial", "sort.by": "media.videos.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.videos.count": "2", "title": "education,learning,tutorial", "sort.by": "media.videos.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.videos.count" => "2", "title" => "education,learning,tutorial", "sort.by" => "media.videos.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.videos.count", "2") q.Set("title", "education,learning,tutorial") q.Set("sort.by", "media.videos.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.videos.count=2&title=education,learning,tutorial&sort.by=media.videos.count&sort.order=desc 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/everything ``` ::: **Find media-rich articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_media_rich=1&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_media_rich": "1", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_media_rich": "1", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_media_rich" => "1", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_media_rich", "1") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?is_media_rich=1&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_media_rich=1&category.id=medtop:13000000 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/everything ``` ::: **Find articles with high-quality images** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_hq_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_hq_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_hq_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_hq_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_hq_images", "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) } ``` ```java [Java] 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/everything?has_hq_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_hq_images=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/everything ``` ::: **Find multimedia-rich content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_image=1&has_video=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_image": "1", "has_video": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "has_video": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "has_video" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_image", "1") q.Set("has_video", "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) } ``` ```java [Java] 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/everything?has_image=1&has_video=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_image=1&has_video=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/everything ``` ::: **Find landscape-oriented images (ideal for headers/banners)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_landscape_media=1&has_fullhd_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_landscape_media": "1", "has_fullhd_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_landscape_media": "1", "has_fullhd_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_landscape_media" => "1", "has_fullhd_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_landscape_media", "1") q.Set("has_fullhd_images", "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) } ``` ```java [Java] 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/everything?is_landscape_media=1&has_fullhd_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_landscape_media=1&has_fullhd_images=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/everything ``` ::: **Find portrait-oriented images (ideal for mobile)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_portrait_media=1&has_mobile_optimized_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_portrait_media": "1", "has_mobile_optimized_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_portrait_media": "1", "has_mobile_optimized_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_portrait_media" => "1", "has_mobile_optimized_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_portrait_media", "1") q.Set("has_mobile_optimized_images", "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) } ``` ```java [Java] 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/everything?is_portrait_media=1&has_mobile_optimized_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_portrait_media=1&has_mobile_optimized_images=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/everything ``` ::: **Find Instagram-ready content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_instagram_ready=1&category.id=medtop:08000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_instagram_ready": "1", "category.id": "medtop:08000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_instagram_ready": "1", "category.id": "medtop:08000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_instagram_ready" => "1", "category.id" => "medtop:08000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_instagram_ready", "1") q.Set("category.id", "medtop:08000000") 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) } ``` ```java [Java] 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/everything?is_instagram_ready=1&category.id=medtop:08000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_instagram_ready=1&category.id=medtop:08000000 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/everything ``` ::: **Find Twitter Card optimized content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_twitter_card_ready=1&has_social_share_image=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_twitter_card_ready": "1", "has_social_share_image": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_twitter_card_ready": "1", "has_social_share_image": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_twitter_card_ready" => "1", "has_social_share_image" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_twitter_card_ready", "1") q.Set("has_social_share_image", "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) } ``` ```java [Java] 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/everything?is_twitter_card_ready=1&has_social_share_image=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_twitter_card_ready=1&has_social_share_image=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/everything ``` ::: **Find 4K image galleries** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_4k_images": "1", "has_multiple_images": "1", "category.id": "medtop:01000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_4k_images": "1", "has_multiple_images": "1", "category.id": "medtop:01000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_4k_images" => "1", "has_multiple_images" => "1", "category.id" => "medtop:01000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_4k_images", "1") q.Set("has_multiple_images", "1") q.Set("category.id", "medtop:01000000") 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) } ``` ```java [Java] 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/everything?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_4k_images=1&has_multiple_images=1&category.id=medtop:01000000 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/everything ``` ::: **Find images with similar dimensions** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_consistent_image_sizes=1&has_multiple_images=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_consistent_image_sizes": "1", "has_multiple_images": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_consistent_image_sizes": "1", "has_multiple_images": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_consistent_image_sizes" => "1", "has_multiple_images" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_consistent_image_sizes", "1") q.Set("has_multiple_images", "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) } ``` ```java [Java] 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/everything?has_consistent_image_sizes=1&has_multiple_images=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_consistent_image_sizes=1&has_multiple_images=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/everything ``` ::: **Find mixed media articles (images + videos)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_mixed_media=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_mixed_media": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_mixed_media": "1", "sort.by": "media.images.count", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_mixed_media" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_mixed_media", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?has_mixed_media=1&sort.by=media.images.count&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_mixed_media=1&sort.by=media.images.count&sort.order=desc 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/everything ``` ::: ### Readability | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_difficult_read` | boolean | No | Filter for difficult-to-read articles (Flesch Reading Ease < 40). | | `is_easy_read` | boolean | No | Filter for easy-to-read articles (Flesch Reading Ease >= 60). | | `readability.age` | integer | No | Exact reading age. Range: 6–22. | | `readability.age.max` | integer | No | Maximum reading age. Range: 6–22. | | `readability.age.min` | integer | No | Minimum reading age. Range: 6–22. | | `readability.ari` | number | No | Exact Automated Readability Index. Range: 0–30. | | `readability.ari.max` | number | No | Maximum Automated Readability Index. Range: 0–30. | | `readability.ari.min` | number | No | Minimum Automated Readability Index. Range: 0–30. | | `readability.audience` | string | No | Target audience. One of: `children`, `general`, `professional`, `academic`. | | `readability.difficulty` | string | No | Difficulty level. One of: `beginner`, `intermediate`, `advanced`, `expert`. | | `readability.ease` | number | No | Exact Flesch Reading Ease score. Range: 0–100. | | `readability.ease.max` | number | No | Maximum Flesch Reading Ease score. Range: 0–100. | | `readability.ease.min` | number | No | Minimum Flesch Reading Ease score. Range: 0–100. | | `readability.fk_grade` | number | No | Exact Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.max` | number | No | Maximum Flesch-Kincaid grade level. Range: 0–30. | | `readability.fk_grade.min` | number | No | Minimum Flesch-Kincaid grade level. Range: 0–30. | ### Read time | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_deep_dive` | boolean | No | Filter for deep dives (>= 10 minutes). | | `is_long_read` | boolean | No | Filter for long reads (>= 5 minutes). | | `is_medium_read` | boolean | No | Filter for medium-length reads (3-7 minutes). | | `is_quick_read` | boolean | No | Filter for quick reads (<= 2 minutes). | | `is_short_read` | boolean | No | Filter for short reads (< 3 minutes). | | `read_time` | integer | No | Exact read time in minutes. Range: 0–1000. | | `read_time.max` | integer | No | Maximum read time in minutes. Range: 0–1000. | | `read_time.min` | integer | No | Minimum read time in minutes. Range: 0–1000. | ### Geo and local | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `has_location_geo` | boolean | No | Filter articles with/without geo-location data. | | `location.bbox` | string | No | Bounding box: minLat,maxLat,minLng,maxLng. Example: `40.0,41.0,-74.5,-73.5`. | | `location.lat` | number | No | Latitude for radius search. Range: -90–90. | | `location.lng` | number | No | Longitude for radius search. Range: -180–180. | | `location.radius` | number | No | Search radius in kilometers (requires location.lat and location.lng). Range: max 20000, > 0. | | `location.radius.min` | number | No | Minimum distance from point in km. Range: 0–20000. | **Find articles from a specific location (e.g., "Tokyo")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=Tokyo&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "Tokyo", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Tokyo", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Tokyo", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "Tokyo") 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) } ``` ```java [Java] 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/everything?location.name=Tokyo&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=Tokyo 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/everything ``` ::: **Find articles from multiple locations (e.g., "London" and "Paris")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Paris&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Paris", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Paris") 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) } ``` ```java [Java] 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/everything?location.name=London,Paris&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Paris 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/everything ``` ::: **Find English news about London and exclude Ontario** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London", "language.code" => "en", "ignore.location.name" => "Ontario", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London") q.Set("language.code", "en") q.Set("ignore.location.name", "Ontario") 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) } ``` ```java [Java] 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/everything?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London&language.code=en&ignore.location.name=Ontario 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/everything ``` ::: **Search for news within 50 km of Berlin (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.lat=52.52&location.lng=13.40&location.radius=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.lat": "52.52", "location.lng": "13.40", "location.radius": "50", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "52.52", "location.lng": "13.40", "location.radius": "50", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "52.52", "location.lng" => "13.40", "location.radius" => "50", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.lat", "52.52") q.Set("location.lng", "13.40") q.Set("location.radius", "50") 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) } ``` ```java [Java] 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/everything?location.lat=52.52&location.lng=13.40&location.radius=50&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.lat=52.52&location.lng=13.40&location.radius=50 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/everything ``` ::: **Local news with positive sentiment (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.lat": "40.7128", "location.lng": "-74.0060", "location.radius": "25", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "40.7128", "location.lng": "-74.0060", "location.radius": "25", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "40.7128", "location.lng" => "-74.0060", "location.radius" => "25", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.lat", "40.7128") q.Set("location.lng", "-74.0060") q.Set("location.radius", "25") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.lat=40.7128&location.lng=-74.0060&location.radius=25&sentiment.overall.polarity=positive 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/everything ``` ::: **Regional breaking news (geo-coordinates)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.lat=51.5074&location.lng=-0.1278&location.radius=100&is_breaking=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.lat": "51.5074", "location.lng": "-0.1278", "location.radius": "100", "is_breaking": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "51.5074", "location.lng": "-0.1278", "location.radius": "100", "is_breaking": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "51.5074", "location.lng" => "-0.1278", "location.radius" => "100", "is_breaking" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.lat", "51.5074") q.Set("location.lng", "-0.1278") q.Set("location.radius", "100") 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) } ``` ```java [Java] 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/everything?location.lat=51.5074&location.lng=-0.1278&location.radius=100&is_breaking=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.lat=51.5074&location.lng=-0.1278&location.radius=100&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/everything ``` ::: **Find coverage of geopolitical events** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "France,Italy", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "France,Italy") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Find business news about several places** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Berlin,Paris", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft,Amazon", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Berlin,Paris") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft,Amazon") 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) } ``` ```java [Java] 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/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon 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/everything ``` ::: **Find natural disaster coverage** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Japan,Israel", "title" => "earthquake", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "Japan,Israel") q.Set("title", "earthquake") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc 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/everything ``` ::: **Compare tourism sentiment by location** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris,Berlin", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Paris,Berlin") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at 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/everything ``` ::: **Search within the bounding box (New York City area)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.bbox=40.4774,40.9176,-74.2591,-73.7004&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.bbox": "40.4774,40.9176,-74.2591,-73.7004", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "40.4774,40.9176,-74.2591,-73.7004", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "40.4774,40.9176,-74.2591,-73.7004", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.bbox", "40.4774,40.9176,-74.2591,-73.7004") 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) } ``` ```java [Java] 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/everything?location.bbox=40.4774,40.9176,-74.2591,-73.7004&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.bbox=40.4774,40.9176,-74.2591,-73.7004 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/everything ``` ::: **Bounding box with category filter (tech news in Silicon Valley)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.bbox": "37.0,38.0,-123.0,-121.0", "category.id": "medtop:13000000", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "37.0,38.0,-123.0,-121.0", "category.id": "medtop:13000000", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "37.0,38.0,-123.0,-121.0", "category.id" => "medtop:13000000", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.bbox", "37.0,38.0,-123.0,-121.0") q.Set("category.id", "medtop:13000000") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.bbox=37.0,38.0,-123.0,-121.0&category.id=medtop:13000000&published_at.start=2024-01-01 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/everything ``` ::: **Ring search – articles between 100 km and 500 km from Berlin** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.lat": "52.52", "location.lng": "13.40", "location.radius.min": "100", "location.radius": "500", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "52.52", "location.lng": "13.40", "location.radius.min": "100", "location.radius": "500", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "52.52", "location.lng" => "13.40", "location.radius.min" => "100", "location.radius" => "500", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.lat", "52.52") q.Set("location.lng", "13.40") q.Set("location.radius.min", "100") q.Set("location.radius", "500") 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) } ``` ```java [Java] 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/everything?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.lat=52.52&location.lng=13.40&location.radius.min=100&location.radius=500 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/everything ``` ::: **Exclude center area - articles more than 50km from Paris** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.lat=48.8566&location.lng=2.3522&location.radius.min=50&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.lat": "48.8566", "location.lng": "2.3522", "location.radius.min": "50", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.lat": "48.8566", "location.lng": "2.3522", "location.radius.min": "50", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.lat" => "48.8566", "location.lng" => "2.3522", "location.radius.min" => "50", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.lat", "48.8566") q.Set("location.lng", "2.3522") q.Set("location.radius.min", "50") 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) } ``` ```java [Java] 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/everything?location.lat=48.8566&location.lng=2.3522&location.radius.min=50&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.lat=48.8566&location.lng=2.3522&location.radius.min=50 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/everything ``` ::: **Articles with geographic coordinates only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_location_geo=1&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_location_geo": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_location_geo": "1", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_location_geo" => "1", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_location_geo", "1") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/everything?has_location_geo=1&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_location_geo=1&category.id=medtop:11000000 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/everything ``` ::: **Articles without coordinates (text-based location only)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_location_geo=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_location_geo": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_location_geo": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_location_geo" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_location_geo", "0") 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) } ``` ```java [Java] 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/everything?has_location_geo=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_location_geo=0 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/everything ``` ::: **Regional disaster tracking with a bounding box** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.bbox": "25.0,35.0,-120.0,-80.0", "title": "hurricane", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.bbox": "25.0,35.0,-120.0,-80.0", "title": "hurricane", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.bbox" => "25.0,35.0,-120.0,-80.0", "title" => "hurricane", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.bbox", "25.0,35.0,-120.0,-80.0") q.Set("title", "hurricane") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/everything?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.bbox=25.0,35.0,-120.0,-80.0&title=hurricane&published_at.start=NOW-7DAYS 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/everything ``` ::: ### Article flags | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `is_breaking` | boolean | No | Filter breaking news articles. | | `is_duplicate` | boolean | No | Filter duplicate/unique articles. | | `is_high_quality` | boolean | No | Find articles that are not duplicates, have a rank of at least 5 and include images and an author. | | `is_paywall` | boolean | No | Filter paywalled articles. | **Get easy-to-read articles for the general audience** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_easy_read=1&readability.audience=general&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_easy_read": "1", "readability.audience": "general", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_easy_read": "1", "readability.audience": "general", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_easy_read" => "1", "readability.audience" => "general", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_easy_read", "1") q.Set("readability.audience", "general") 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) } ``` ```java [Java] 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/everything?is_easy_read=1&readability.audience=general&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_easy_read=1&readability.audience=general 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/everything ``` ::: **Get beginner-level content about technology** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&topic.id=industry.technology_news&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.difficulty": "beginner", "topic.id": "industry.technology_news", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "beginner", "topic.id": "industry.technology_news", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "beginner", "topic.id" => "industry.technology_news", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.difficulty", "beginner") q.Set("topic.id", "industry.technology_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) } ``` ```java [Java] 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/everything?readability.difficulty=beginner&topic.id=industry.technology_news&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.difficulty=beginner&topic.id=industry.technology_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/everything ``` ::: **Get articles suitable for teenagers (age 12–16)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.age.min=12&readability.age.max=16&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.age.min": "12", "readability.age.max": "16", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.age.min": "12", "readability.age.max": "16", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.age.min" => "12", "readability.age.max" => "16", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.age.min", "12") q.Set("readability.age.max", "16") 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) } ``` ```java [Java] 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/everything?readability.age.min=12&readability.age.max=16&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.age.min=12&readability.age.max=16 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/everything ``` ::: **Get professional-level business news** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.audience=professional&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.audience": "professional", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.audience": "professional", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.audience" => "professional", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.audience", "professional") 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) } ``` ```java [Java] 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/everything?readability.audience=professional&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.audience=professional&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/everything ``` ::: **Find easy-to-read articles (reading ease 70–90)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.ease.min=70&readability.ease.max=90&is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.ease.min": "70", "readability.ease.max": "90", "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.ease.min": "70", "readability.ease.max": "90", "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.ease.min" => "70", "readability.ease.max" => "90", "is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.ease.min", "70") q.Set("readability.ease.max", "90") q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/everything?readability.ease.min=70&readability.ease.max=90&is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.ease.min=70&readability.ease.max=90&is_duplicate=0 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/everything ``` ::: **Get academic-level articles about science** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.difficulty": "expert", "readability.audience": "academic", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.difficulty": "expert", "readability.audience": "academic", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.difficulty" => "expert", "readability.audience" => "academic", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.difficulty", "expert") q.Set("readability.audience", "academic") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.difficulty=expert&readability.audience=academic&category.id=medtop:13000000 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/everything ``` ::: **Combine with grade level for educational content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "readability.fk_grade.min": "8", "readability.fk_grade.max": "12", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "readability.fk_grade.min": "8", "readability.fk_grade.max": "12", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["readability.fk_grade.min" => "8", "readability.fk_grade.max" => "12", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("readability.fk_grade.min", "8") q.Set("readability.fk_grade.max", "12") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?readability.fk_grade.min=8&readability.fk_grade.max=12&category.id=medtop:13000000 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/everything ``` ::: **Filter by article quality** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_duplicate": "0", "is_paywall": "0", "source.rank.opr.min": "6", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_duplicate" => "0", "is_paywall" => "0", "source.rank.opr.min" => "6", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_duplicate", "0") q.Set("is_paywall", "0") q.Set("source.rank.opr.min", "6") 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) } ``` ```java [Java] 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/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_duplicate=0&is_paywall=0&source.rank.opr.min=6&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/everything ``` ::: **Find long-read articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_long_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_long_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_long_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_long_read" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_long_read", "1") 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) } ``` ```java [Java] 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/everything?is_long_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_long_read=1&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/everything ``` ::: **Find quick-read articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_short_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_short_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_short_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_short_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_short_read", "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) } ``` ```java [Java] 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/everything?is_short_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_short_read=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/everything ``` ::: **Find quick news briefs (≤2 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_quick_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_quick_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_quick_read": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_quick_read" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_quick_read", "1") 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) } ``` ```java [Java] 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/everything?is_quick_read=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_quick_read=1&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/everything ``` ::: **Find standard-length articles (3-7 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_medium_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_medium_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_medium_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_medium_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_medium_read", "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) } ``` ```java [Java] 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/everything?is_medium_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_medium_read=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/everything ``` ::: **Find in-depth analysis articles (≥10 minutes)** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_deep_dive=1&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_deep_dive": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_deep_dive": "1", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_deep_dive" => "1", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_deep_dive", "1") 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) } ``` ```java [Java] 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/everything?is_deep_dive=1&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_deep_dive=1&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/everything ``` ::: **Combine article quality filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_high_quality=1&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_high_quality": "1", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_high_quality": "1", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_high_quality" => "1", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_high_quality", "1") 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) } ``` ```java [Java] 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/everything?is_high_quality=1&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_high_quality=1&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/everything ``` ::: **Find media-rich articles sorted by media content** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_image=1&sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_image": "1", "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "sort.by" => "media_richness", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_image", "1") q.Set("sort.by", "media_richness") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?has_image=1&sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_image=1&sort.by=media_richness&sort.order=desc 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/everything ``` ::: **Follow breaking news only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_breaking=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_breaking": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?is_breaking=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ### Sorting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `sort.by` | string | No | Field to sort results by. One of: `published_at`, `relevance`, `engagement`, `quality`, `controversy`, `trust`, `id`, `new`, `created_at`, `source.rank.opr`, `sentiment.overall.score`, `sentiment.title.score` and 18 more. Default: `published_at`. | | `sort.order` | string | No | Sort order. One of: `asc`, `desc`. Default: `desc`. | **Find articles sorted by the published date in ascending order** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=published_at&sort.order=asc 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/everything ``` ::: **Sort by sentiment score, highest first** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Get the most viral/engaging articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "engagement", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "engagement") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=engagement&sort.order=desc 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/everything ``` ::: **Get engaging breaking news with media** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_breaking": "1", "media.images.count.min": "2", "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "media.images.count.min": "2", "sort.by": "engagement", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "media.images.count.min" => "2", "sort.by" => "engagement", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_breaking", "1") q.Set("media.images.count.min", "2") q.Set("sort.by", "engagement") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_breaking=1&media.images.count.min=2&sort.by=engagement&sort.order=desc 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/everything ``` ::: **Get the most media-rich articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "media_richness", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "media_richness", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "media_richness") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sort.by=media_richness&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=media_richness&sort.order=desc 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/everything ``` ::: **Get articles from high-ranking sources sorted by source rank** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.rank.opr.min": "5", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.rank.opr.min": "5", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.rank.opr.min" => "5", "sort.by" => "source.rank.opr", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("source.rank.opr.min", "5") q.Set("sort.by", "source.rank.opr") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?source.rank.opr.min=5&sort.by=source.rank.opr&sort.order=desc 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/everything ``` ::: **Get quick-read articles sorted by read time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?read_time.max=5&sort.by=read_time&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "read_time.max": "5", "sort.by": "read_time", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "read_time.max": "5", "sort.by": "read_time", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["read_time.max" => "5", "sort.by" => "read_time", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("read_time.max", "5") q.Set("sort.by", "read_time") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?read_time.max=5&sort.by=read_time&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?read_time.max=5&sort.by=read_time&sort.order=asc 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/everything ``` ::: **Sort images by size** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count.min": "3", "sort.by": "media.images.width.max", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count.min": "3", "sort.by": "media.images.width.max", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count.min" => "3", "sort.by" => "media.images.width.max", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count.min", "3") q.Set("sort.by", "media.images.width.max") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count.min=3&sort.by=media.images.width.max&sort.order=desc 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/everything ``` ::: **Combine ranking and filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "source.rank.opr.min": "6", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "source.rank.opr.min": "6", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "source.rank.opr.min" => "6", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("source.rank.opr.min", "6") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&source.rank.opr.min=6&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: **Show articles with more media first** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "2", "media.videos.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "2", "media.videos.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "2", "media.videos.count" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "2") q.Set("media.videos.count", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000 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/everything ``` ::: **Find long analysis articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&sort.by=read_time&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "sort.by": "read_time", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "sort.by": "read_time", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "sort.by" => "read_time", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("sort.by", "read_time") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&sort.by=read_time&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&sort.by=read_time&sort.order=desc 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/everything ``` ::: **Find articles by sentiment** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "sort.by": "sentiment.title.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "sort.by": "sentiment.title.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "sort.by" => "sentiment.title.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("sort.by", "sentiment.title.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&sort.by=sentiment.title.score&sort.order=desc 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/everything ``` ::: **Find long articles from highly ranked sources** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=quality&sort.order=desc&is_long_read=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "quality", "sort.order": "desc", "is_long_read": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "quality", "sort.order": "desc", "is_long_read": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "quality", "sort.order" => "desc", "is_long_read" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "quality") q.Set("sort.order", "desc") q.Set("is_long_read", "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) } ``` ```java [Java] 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/everything?sort.by=quality&sort.order=desc&is_long_read=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=quality&sort.order=desc&is_long_read=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/everything ``` ::: **Find articles with mixed sentiment** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=controversy&sort.order=desc&category.id=medtop:11000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "controversy", "sort.order": "desc", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "controversy", "sort.order": "desc", "category.id": "medtop:11000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "controversy", "sort.order" => "desc", "category.id" => "medtop:11000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "controversy") q.Set("sort.order", "desc") q.Set("category.id", "medtop:11000000") 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) } ``` ```java [Java] 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/everything?sort.by=controversy&sort.order=desc&category.id=medtop:11000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=controversy&sort.order=desc&category.id=medtop:11000000 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/everything ``` ::: **Sort by source trust** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=trust&sort.order=desc&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "trust", "sort.order": "desc", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "trust", "sort.order": "desc", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "trust", "sort.order" => "desc", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "trust") q.Set("sort.order", "desc") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?sort.by=trust&sort.order=desc&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=trust&sort.order=desc&published_at.start=2024-01-01 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/everything ``` ::: **Combine source quality and article filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=quality&source.rank.opr.min=5&is_duplicate=0&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "quality", "source.rank.opr.min": "5", "is_duplicate": "0", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "quality", "source.rank.opr.min": "5", "is_duplicate": "0", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "quality", "source.rank.opr.min" => "5", "is_duplicate" => "0", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "quality") q.Set("source.rank.opr.min", "5") q.Set("is_duplicate", "0") 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) } ``` ```java [Java] 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/everything?sort.by=quality&source.rank.opr.min=5&is_duplicate=0&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=quality&source.rank.opr.min=5&is_duplicate=0 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/everything ``` ::: **Find articles ranked by engagement** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "engagement", "published_at.start": "2024-01-01", "media.images.count.min": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "engagement", "published_at.start": "2024-01-01", "media.images.count.min": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "engagement", "published_at.start" => "2024-01-01", "media.images.count.min" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "engagement") q.Set("published_at.start", "2024-01-01") q.Set("media.images.count.min", "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) } ``` ```java [Java] 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/everything?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=engagement&published_at.start=2024-01-01&media.images.count.min=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/everything ``` ::: **Find highly ranked sources for research** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "trust", "source.rank.opr.min": "6", "sentiment.overall.polarity": "neutral", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "trust", "source.rank.opr.min": "6", "sentiment.overall.polarity": "neutral", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "trust", "source.rank.opr.min" => "6", "sentiment.overall.polarity" => "neutral", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "trust") q.Set("source.rank.opr.min", "6") q.Set("sentiment.overall.polarity", "neutral") 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) } ``` ```java [Java] 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/everything?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=trust&source.rank.opr.min=6&sentiment.overall.polarity=neutral 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/everything ``` ::: ### Pagination | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `page` | integer | No | Page number for pagination. Range: min 1. Default: `1`. | | `per_page` | integer | No | Number of results per page (max 250; Free is capped at 10, Starter at 50, Basic at 200). Range: 1–250. Default: `100`. | **Find articles with pagination** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?per_page=10&page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["per_page" => "10", "page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("per_page", "10") q.Set("page", "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) } ``` ```java [Java] 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/everything?per_page=10&page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?per_page=10&page=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/everything ``` ::: **Fetch articles in pages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "per_page" => "100", "page" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("per_page", "100") q.Set("page", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Combine filters and pagination** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "3", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "3", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Amazon", "sentiment.overall.polarity" => "positive", "per_page" => "25", "page" => "3", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Amazon") q.Set("sentiment.overall.polarity", "positive") q.Set("per_page", "25") q.Set("page", "3") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc 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/everything ``` ::: ### Faceting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `facet` | string | No | Return article counts grouped by the fields in facet.field. One of: `0`, `1`. | | `facet.field` | string | No | Fields to count by, separated by commas (max 5). Allowed values: source.id, source.country.id, source.bias, language.id, author.id, category.id, topic.id, industry.id, entity.id, sentiment.overall.polarity, sentiment.title.polarity, sentiment.body.polarity, sentiment.strength, is\_duplicate, is\_free, is\_important, media.images.count, media.videos.count, read\_time, content.length, published.year, published.month, published.day\_of\_week, published.hour, published.weekday, published.time\_of\_day. Example: `source.id,category.id`. | | `facet.limit` | integer | No | Maximum number of facet values per field (max 100). Range: 1–100. Default: `10`. | | `facet.mincount` | integer | No | Minimum count for a facet value to be included. Range: min 1. Default: `1`. | | `facet.range` | string | No | Count articles within date or numeric intervals. One of: `0`, `1`. | | `facet.range.end` | string | No | End value for range faceting (required with facet.range). | | `facet.range.field` | string | No | Field to group into date or numeric intervals. Values: published\_at, sentiment.overall.score, sentiment.title.score, sentiment.body.score, read\_time, source.rank.opr, media.images.count, media.videos.count. | | `facet.range.gap` | string | No | Size of each interval. Use a time span for dates, such as +1DAY, or a number for numeric fields. Default: `+1DAY`. | | `facet.range.start` | string | No | Start value for range faceting (required with facet.range). | **Basic faceting by source** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "source.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=source.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id 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/everything ``` ::: **Faceting with multiple fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "source.id,language.id,sentiment.overall.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id,language.id,sentiment.overall.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id,language.id,sentiment.overall.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id,language.id,sentiment.overall.polarity") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id,language.id,sentiment.overall.polarity 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/everything ``` ::: **Faceting with custom limit** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id&facet.limit=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "source.id", "facet.limit": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.id", "facet.limit": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.id", "facet.limit" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.id") q.Set("facet.limit", "20") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=source.id&facet.limit=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.id&facet.limit=20 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/everything ``` ::: **Faceting with minimum count filter** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id&facet.mincount=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "category.id", "facet.mincount": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "category.id", "facet.mincount": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "category.id", "facet.mincount" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "category.id") q.Set("facet.mincount", "10") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=category.id&facet.mincount=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id&facet.mincount=10 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/everything ``` ::: **Faceting combined with search filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "bitcoin", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "facet" => "true", "facet.field" => "source.id,sentiment.overall.polarity", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "bitcoin") q.Set("facet", "true") q.Set("facet.field", "source.id,sentiment.overall.polarity") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/everything?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=bitcoin&facet=true&facet.field=source.id,sentiment.overall.polarity&published_at.start=NOW-7DAYS 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/everything ``` ::: **Count articles by language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "language.id,source.country.id", "facet.limit": "15", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "language.id,source.country.id", "facet.limit": "15", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "language.id,source.country.id", "facet.limit" => "15", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "language.id,source.country.id") q.Set("facet.limit", "15") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15 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/everything ``` ::: **Faceting for sentiment analysis by source** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "facet": "true", "facet.field": "source.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "facet" => "true", "facet.field" => "source.id,sentiment.overall.polarity", "facet.limit" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("facet", "true") q.Set("facet.field", "source.id,sentiment.overall.polarity") q.Set("facet.limit", "10") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&facet=true&facet.field=source.id,sentiment.overall.polarity&facet.limit=10 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/everything ``` ::: **Count articles by publisher bias** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "facet": "true", "facet.field": "source.bias,source.country.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "facet": "true", "facet.field": "source.bias,source.country.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "facet" => "true", "facet.field" => "source.bias,source.country.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("facet", "true") q.Set("facet.field", "source.bias,source.country.id") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id 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/everything ``` ::: **Faceting for category distribution in top headlines** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id,language.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "category.id,language.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "category.id,language.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "category.id,language.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "category.id,language.id") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=category.id,language.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=category.id,language.id 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/everything ``` ::: **Build a filter menu** Use counts by field to build a filter sidebar: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI", "facet": "true", "facet.field": "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "facet": "true", "facet.field": "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit": "10", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "facet" => "true", "facet.field" => "source.id,category.id,language.id,sentiment.overall.polarity", "facet.limit" => "10", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI") q.Set("facet", "true") q.Set("facet.field", "source.id,category.id,language.id,sentiment.overall.polarity") q.Set("facet.limit", "10") 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) } ``` ```java [Java] 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/everything?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10 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/everything ``` ::: **Count articles by hour of the day** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "published.hour", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.hour", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.hour", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.hour") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.hour&published_at.start=2024-01-01 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/everything ``` ::: **Count articles by day of the week** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.day_of_week&category.id=medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "published.day_of_week", "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.day_of_week", "category.id": "medtop:15000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.day_of_week", "category.id" => "medtop:15000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.day_of_week") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=published.day_of_week&category.id=medtop:15000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.day_of_week&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/everything ``` ::: **Media richness analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "media.images.count,media.videos.count", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "media.images.count,media.videos.count", "category.id": "medtop:13000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "media.images.count,media.videos.count", "category.id" => "medtop:13000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "media.images.count,media.videos.count") q.Set("category.id", "medtop:13000000") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=media.images.count,media.videos.count&category.id=medtop:13000000 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/everything ``` ::: **Source quality distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "source.rank.opr,is_duplicate", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "source.rank.opr,is_duplicate", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "source.rank.opr,is_duplicate", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "source.rank.opr,is_duplicate") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=source.rank.opr,is_duplicate&published_at.start=2024-01-01 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/everything ``` ::: **Breaking news distribution by hour** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_breaking=1&facet=true&facet.field=published.hour,category.id&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_breaking": "1", "facet": "true", "facet.field": "published.hour,category.id", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet": "true", "facet.field": "published.hour,category.id", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet" => "true", "facet.field" => "published.hour,category.id", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_breaking", "1") q.Set("facet", "true") q.Set("facet.field", "published.hour,category.id") 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) } ``` ```java [Java] 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/everything?is_breaking=1&facet=true&facet.field=published.hour,category.id&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_breaking=1&facet=true&facet.field=published.hour,category.id 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/everything ``` ::: **Content length analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=read_time&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "read_time", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "read_time", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "read_time", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "read_time") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=read_time&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=read_time&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/everything ``` ::: **Compare sentiment in titles, bodies and whole articles** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=sentiment.overall.polarity,sentiment.title.polarity,sentiment.body.polarity 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/everything ``` ::: **Yearly trend analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "facet": "true", "facet.field": "published.year,published.month", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "facet": "true", "facet.field": "published.year,published.month", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "facet" => "true", "facet.field" => "published.year,published.month", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("facet", "true") q.Set("facet.field", "published.year,published.month") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&facet=true&facet.field=published.year,published.month 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/everything ``` ::: **Content length distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=content.length&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "content.length", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "content.length", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "content.length", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "content.length") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=content.length&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=content.length&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/everything ``` ::: **Weekday vs weekend publishing patterns** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.weekday,published.time_of_day&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "published.weekday,published.time_of_day", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "published.weekday,published.time_of_day", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "published.weekday,published.time_of_day", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "published.weekday,published.time_of_day") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=published.weekday,published.time_of_day&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.weekday,published.time_of_day 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/everything ``` ::: **Sentiment strength analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.strength,sentiment.overall.polarity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet": "true", "facet.field": "sentiment.strength,sentiment.overall.polarity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet" => "true", "facet.field" => "sentiment.strength,sentiment.overall.polarity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet", "true") q.Set("facet.field", "sentiment.strength,sentiment.overall.polarity") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=sentiment.strength,sentiment.overall.polarity 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/everything ``` ::: **Most mentioned entities** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?facet=true&facet.field=entity.id&facet.limit=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "facet": "true", "facet.field": "entity.id", "facet.limit": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "facet": "true", "facet.field": "entity.id", "facet.limit": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["facet" => "true", "facet.field" => "entity.id", "facet.limit" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("facet", "true") q.Set("facet.field", "entity.id") q.Set("facet.limit", "20") 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) } ``` ```java [Java] 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/everything?facet=true&facet.field=entity.id&facet.limit=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?facet=true&facet.field=entity.id&facet.limit=20 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/everything ``` ::: **Time of day publishing analysis** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_breaking": "1", "facet": "true", "facet.field": "published.time_of_day,published.weekday", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet": "true", "facet.field": "published.time_of_day,published.weekday", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet" => "true", "facet.field" => "published.time_of_day,published.weekday", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_breaking", "1") q.Set("facet", "true") q.Set("facet.field", "published.time_of_day,published.weekday") 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) } ``` ```java [Java] 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/everything?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_breaking=1&facet=true&facet.field=published.time_of_day,published.weekday 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/everything ``` ::: **Date range faceting - articles per week** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "bitcoin", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-03-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-03-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-03-01", "facet.range.gap" => "1WEEK", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "bitcoin") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-03-01") q.Set("facet.range.gap", "1WEEK") 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) } ``` ```java [Java] 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/everything?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=bitcoin&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-03-01&facet.range.gap=1WEEK 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/everything ``` ::: **Date range faceting – articles per day** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-01-31", "facet.range.gap": "1DAY", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-01-31", "facet.range.gap": "1DAY", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-01-31", "facet.range.gap" => "1DAY", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-01-31") q.Set("facet.range.gap", "1DAY") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-01-31&facet.range.gap=1DAY 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/everything ``` ::: **Date range faceting - hourly distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "is_breaking": "1", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-15", "facet.range.end": "2024-01-16", "facet.range.gap": "1HOUR", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "is_breaking": "1", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-15", "facet.range.end": "2024-01-16", "facet.range.gap": "1HOUR", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["is_breaking" => "1", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-15", "facet.range.end" => "2024-01-16", "facet.range.gap" => "1HOUR", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("is_breaking", "1") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-15") q.Set("facet.range.end", "2024-01-16") q.Set("facet.range.gap", "1HOUR") 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) } ``` ```java [Java] 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/everything?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?is_breaking=1&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-15&facet.range.end=2024-01-16&facet.range.gap=1HOUR 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/everything ``` ::: **Count articles by sentiment score range** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "sentiment.overall.score", "facet.range.start": "-1", "facet.range.end": "1", "facet.range.gap": "0.25", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Apple", "facet.range" => "true", "facet.range.field" => "sentiment.overall.score", "facet.range.start" => "-1", "facet.range.end" => "1", "facet.range.gap" => "0.25", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Apple") q.Set("facet.range", "true") q.Set("facet.range.field", "sentiment.overall.score") q.Set("facet.range.start", "-1") q.Set("facet.range.end", "1") q.Set("facet.range.gap", "0.25") 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) } ``` ```java [Java] 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/everything?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Apple&facet.range=true&facet.range.field=sentiment.overall.score&facet.range.start=-1&facet.range.end=1&facet.range.gap=0.25 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/everything ``` ::: **Reading time distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "facet.range": "true", "facet.range.field": "read_time", "facet.range.start": "0", "facet.range.end": "30", "facet.range.gap": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "facet.range": "true", "facet.range.field": "read_time", "facet.range.start": "0", "facet.range.end": "30", "facet.range.gap": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "facet.range" => "true", "facet.range.field" => "read_time", "facet.range.start" => "0", "facet.range.end" => "30", "facet.range.gap" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("facet.range", "true") q.Set("facet.range.field", "read_time") q.Set("facet.range.start", "0") q.Set("facet.range.end", "30") q.Set("facet.range.gap", "5") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&facet.range=true&facet.range.field=read_time&facet.range.start=0&facet.range.end=30&facet.range.gap=5 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/everything ``` ::: **Source quality distribution** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "facet.range": "true", "facet.range.field": "source.rank.opr", "facet.range.start": "0.1", "facet.range.end": "0.9", "facet.range.gap": "0.1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "facet.range": "true", "facet.range.field": "source.rank.opr", "facet.range.start": "0.1", "facet.range.end": "0.9", "facet.range.gap": "0.1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "facet.range" => "true", "facet.range.field" => "source.rank.opr", "facet.range.start" => "0.1", "facet.range.end" => "0.9", "facet.range.gap" => "0.1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("facet.range", "true") q.Set("facet.range.field", "source.rank.opr") q.Set("facet.range.start", "0.1") q.Set("facet.range.end", "0.9") q.Set("facet.range.gap", "0.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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&facet.range=true&facet.range.field=source.rank.opr&facet.range.start=0.1&facet.range.end=0.9&facet.range.gap=0.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/everything ``` ::: **Combined regular and range faceting** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "climate", "facet": "true", "facet.field": "source.country.id,language.id", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1MONTH", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "climate", "facet": "true", "facet.field": "source.country.id,language.id", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1MONTH", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "climate", "facet" => "true", "facet.field" => "source.country.id,language.id", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-06-01", "facet.range.gap" => "1MONTH", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "climate") q.Set("facet", "true") q.Set("facet.field", "source.country.id,language.id") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-06-01") q.Set("facet.range.gap", "1MONTH") 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) } ``` ```java [Java] 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/everything?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=climate&facet=true&facet.field=source.country.id,language.id&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1MONTH 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/everything ``` ::: **Track image and video counts over time** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "has_image": "1", "facet.range": "true", "facet.range.field": "media.images.count", "facet.range.start": "1", "facet.range.end": "20", "facet.range.gap": "2", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "has_image": "1", "facet.range": "true", "facet.range.field": "media.images.count", "facet.range.start": "1", "facet.range.end": "20", "facet.range.gap": "2", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["has_image" => "1", "facet.range" => "true", "facet.range.field" => "media.images.count", "facet.range.start" => "1", "facet.range.end" => "20", "facet.range.gap" => "2", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("has_image", "1") q.Set("facet.range", "true") q.Set("facet.range.field", "media.images.count") q.Set("facet.range.start", "1") q.Set("facet.range.end", "20") q.Set("facet.range.gap", "2") 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) } ``` ```java [Java] 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/everything?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?has_image=1&facet.range=true&facet.range.field=media.images.count&facet.range.start=1&facet.range.end=20&facet.range.gap=2 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/everything ``` ::: **Building a sentiment timeline dashboard** Track how sentiment about a brand changes over time: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-12-31", "facet.range.gap": "1MONTH", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Apple", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-12-31", "facet.range.gap": "1MONTH", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Apple", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-12-31", "facet.range.gap" => "1MONTH", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Apple") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-12-31") q.Set("facet.range.gap", "1MONTH") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Apple&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-12-31&facet.range.gap=1MONTH&sentiment.overall.polarity=positive 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/everything ``` ::: **Compare subjects over the same period** Run multiple queries to compare different entities over the same time period: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla", "facet.range": "true", "facet.range.field": "published_at", "facet.range.start": "2024-01-01", "facet.range.end": "2024-06-01", "facet.range.gap": "1WEEK", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla", "facet.range" => "true", "facet.range.field" => "published_at", "facet.range.start" => "2024-01-01", "facet.range.end" => "2024-06-01", "facet.range.gap" => "1WEEK", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla") q.Set("facet.range", "true") q.Set("facet.range.field", "published_at") q.Set("facet.range.start", "2024-01-01") q.Set("facet.range.end", "2024-06-01") q.Set("facet.range.gap", "1WEEK") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet.range=true&facet.range.field=published_at&facet.range.start=2024-01-01&facet.range.end=2024-06-01&facet.range.gap=1WEEK 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/everything ``` ::: ### Highlighting | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `hl` | string | No | Enable highlighting. One of: `0`, `1`. | | `hl.fl` | string | No | Comma-separated fields to highlight (max 5). Values: title, description, body. Default: `title,description`. Example: `title,description`. | | `hl.fragsize` | integer | No | Size of highlighted fragment in characters (50-500). Range: 50–500. Default: `150`. | | `hl.snippets` | integer | No | Number of highlighted snippets per field (max 10). Range: 1–10. Default: `3`. | | `hl.tag.post` | string | No | Closing tag for highlighted text. Default: `
`. | | `hl.tag.pre` | string | No | Opening tag for highlighted text. Default: ``. | | `search` | string | No | List extra terms to highlight, separated by commas. Terms from `title` are included automatically. Requires `hl=1`. This parameter only changes highlighting; it does not filter articles. Example: `tesla,elon musk`. *Accepted by the API but not part of the published OpenAPI specification, so generated SDKs do not expose it.* | **Basic highlighting for search results** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=bitcoin&hl=true&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "bitcoin", "hl": "true", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "bitcoin", "hl": "true", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "bitcoin", "hl" => "true", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "bitcoin") q.Set("hl", "true") 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) } ``` ```java [Java] 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/everything?title=bitcoin&hl=true&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=bitcoin&hl=true 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/everything ``` ::: **Highlighting with custom fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=artificial%20intelligence&hl=true&hl.fl=title,description,body&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "artificial intelligence", "hl": "true", "hl.fl": "title,description,body", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "artificial intelligence", "hl": "true", "hl.fl": "title,description,body", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "artificial intelligence", "hl" => "true", "hl.fl" => "title,description,body", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "artificial intelligence") q.Set("hl", "true") q.Set("hl.fl", "title,description,body") 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) } ``` ```java [Java] 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/everything?title=artificial%20intelligence&hl=true&hl.fl=title,description,body&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=artificial%20intelligence&hl=true&hl.fl=title,description,body 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/everything ``` ::: **Highlighting with larger snippets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "climate change", "hl": "true", "hl.fragsize": "300", "hl.snippets": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "climate change", "hl": "true", "hl.fragsize": "300", "hl.snippets": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "climate change", "hl" => "true", "hl.fragsize" => "300", "hl.snippets" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "climate change") q.Set("hl", "true") q.Set("hl.fragsize", "300") q.Set("hl.snippets", "5") 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) } ``` ```java [Java] 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/everything?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5 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/everything ``` ::: **Custom highlight tags for HTML** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "Tesla", "hl": "true", "hl.tag.pre": "%3Cmark%3E", "hl.tag.post": "%3C%2Fmark%3E", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "Tesla", "hl": "true", "hl.tag.pre": "%3Cmark%3E", "hl.tag.post": "%3C%2Fmark%3E", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "Tesla", "hl" => "true", "hl.tag.pre" => "%3Cmark%3E", "hl.tag.post" => "%3C%2Fmark%3E", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "Tesla") q.Set("hl", "true") q.Set("hl.tag.pre", "%3Cmark%3E") q.Set("hl.tag.post", "%3C%2Fmark%3E") 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) } ``` ```java [Java] 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/everything?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=Tesla&hl=true&hl.tag.pre=%3Cmark%3E&hl.tag.post=%3C%2Fmark%3E 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/everything ``` ::: **Custom highlight tags for Markdown** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "SpaceX", "hl": "true", "hl.tag.pre": "%2A%2A", "hl.tag.post": "%2A%2A", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "SpaceX", "hl": "true", "hl.tag.pre": "%2A%2A", "hl.tag.post": "%2A%2A", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "SpaceX", "hl" => "true", "hl.tag.pre" => "%2A%2A", "hl.tag.post" => "%2A%2A", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "SpaceX") q.Set("hl", "true") q.Set("hl.tag.pre", "%2A%2A") q.Set("hl.tag.post", "%2A%2A") 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) } ``` ```java [Java] 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/everything?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=SpaceX&hl=true&hl.tag.pre=%2A%2A&hl.tag.post=%2A%2A 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/everything ``` ::: **Combined with other filters** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "Apple", "organization.name": "Apple", "hl": "true", "hl.fl": "title,description", "sentiment.overall.polarity": "positive", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "Apple", "organization.name": "Apple", "hl": "true", "hl.fl": "title,description", "sentiment.overall.polarity": "positive", "published_at.start": "NOW-7DAYS", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "Apple", "organization.name" => "Apple", "hl" => "true", "hl.fl" => "title,description", "sentiment.overall.polarity" => "positive", "published_at.start" => "NOW-7DAYS", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "Apple") q.Set("organization.name", "Apple") q.Set("hl", "true") q.Set("hl.fl", "title,description") q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "NOW-7DAYS") 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) } ``` ```java [Java] 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/everything?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=NOW-7DAYS 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/everything ``` ::: **Highlighting for entity search** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "hl": "true", "hl.fl": "title,body", "hl.snippets": "5", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "hl": "true", "hl.fl": "title,body", "hl.snippets": "5", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "hl" => "true", "hl.fl" => "title,body", "hl.snippets" => "5", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("hl", "true") q.Set("hl.fl", "title,body") q.Set("hl.snippets", "5") 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) } ``` ```java [Java] 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/everything?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon%20Musk&hl=true&hl.fl=title,body&hl.snippets=5 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/everything ``` ::: **Highlight synonyms and related word forms** Highlighting includes synonyms and related word forms. For example, searching for "innovation" also highlights "innovative", "innovate" and "innovator". ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=innovation&hl=true&hl.fl=title,description&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "innovation", "hl": "true", "hl.fl": "title,description", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "innovation", "hl": "true", "hl.fl": "title,description", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "innovation", "hl" => "true", "hl.fl" => "title,description", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "innovation") q.Set("hl", "true") q.Set("hl.fl", "title,description") 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) } ``` ```java [Java] 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/everything?title=innovation&hl=true&hl.fl=title,description&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=innovation&hl=true&hl.fl=title,description 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/everything ``` ::: **Building a search results page** Return highlighted text and selected fields for a search interface: ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI", "fl": "id,title,description,published_at,source.domain", "hl": "true", "hl.fl": "title,description", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "fl": "id,title,description,published_at,source.domain", "hl": "true", "hl.fl": "title,description", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "fl" => "id,title,description,published_at,source.domain", "hl" => "true", "hl.fl" => "title,description", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI") q.Set("fl", "id,title,description,published_at,source.domain") q.Set("hl", "true") q.Set("hl.fl", "title,description") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI&fl=id,title,description,published_at,source.domain&hl=true&hl.fl=title,description&per_page=20 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/everything ``` ::: ### Field selection | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `fl` | string | No | Comma-separated list of fields to include in the response. Example: `id,title,published_at,source.domain`. | **Get only ID and title** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title") 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) } ``` ```java [Java] 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/everything?fl=id,title&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title 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/everything ``` ::: **Get an article with specific source fields** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,source.domain,source.rank.opr&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,source.domain,source.rank.opr", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain,source.rank.opr", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain,source.rank.opr", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,source.domain,source.rank.opr") 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) } ``` ```java [Java] 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/everything?fl=id,title,source.domain,source.rank.opr&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,source.domain,source.rank.opr 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/everything ``` ::: **Get sentiment analysis data only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score") 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) } ``` ```java [Java] 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/everything?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,sentiment.overall.score,sentiment.title.score,sentiment.body.score 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/everything ``` ::: **Get media information** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,media.images.count,media.videos.count&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,media.images.count,media.videos.count", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,media.images.count,media.videos.count", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,media.images.count,media.videos.count", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,media.images.count,media.videos.count") 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) } ``` ```java [Java] 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/everything?fl=id,title,media.images.count,media.videos.count&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,media.images.count,media.videos.count 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/everything ``` ::: **Return fewer fields for a combined news feed** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,published_at,source.domain", "category.id": "medtop:04000000", "per_page": "100", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,published_at,source.domain", "category.id": "medtop:04000000", "per_page": "100", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,published_at,source.domain", "category.id" => "medtop:04000000", "per_page" => "100", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,published_at,source.domain") q.Set("category.id", "medtop:04000000") q.Set("per_page", "100") 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) } ``` ```java [Java] 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/everything?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,published_at,source.domain&category.id=medtop:04000000&per_page=100 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/everything ``` ::: **Sentiment monitoring with minimal data** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name": "Tesla", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name": "Tesla", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at", "organization.name" => "Tesla", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,sentiment.overall.score,sentiment.overall.polarity,published_at") q.Set("organization.name", "Tesla") 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) } ``` ```java [Java] 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/everything?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,sentiment.overall.score,sentiment.overall.polarity,published_at&organization.name=Tesla 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/everything ``` ::: **Lightweight news ticker** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,source.domain,published_at", "is_breaking": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain,published_at", "is_breaking": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain,published_at", "is_breaking" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,source.domain,published_at") q.Set("is_breaking", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,source.domain,published_at&is_breaking=1&sort.by=published_at&sort.order=desc 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/everything ``` ::: **Return fewer fields for large result sets** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "fl": "id,title,source.domain", "per_page": "100", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "fl": "id,title,source.domain", "per_page": "100", "published_at.start": "2024-01-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["fl" => "id,title,source.domain", "per_page" => "100", "published_at.start" => "2024-01-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("fl", "id,title,source.domain") q.Set("per_page", "100") q.Set("published_at.start", "2024-01-01") 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) } ``` ```java [Java] 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/everything?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01 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/everything ``` ::: ### Export | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `export` | string | No | Export format. One of: `json`, `csv`, `tsv`, `xml`, `rss`, `xlsx`, `parquet`, `jsonl`, `ndjson`. | ### Request and debug | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `debug` | string | No | Include user\_input in response for debugging. One of: `0`, `1`. | ## Related * [Search articles](/platform/news-api/everything) — endpoint, request examples, limits and errors. * [Response format](/platform/news-api/response-structure) — returned fields and pagination links. * [Usage examples](/platform/news-api/common-workflows/examples/) — complete requests grouped by task. --- --- url: 'https://docs.apitube.io/platform/news-api/common-workflows/examples.md' description: Library of News API usage examples for various scenarios --- # News API Examples Library Choose a filter below to find request code you can copy and a short explanation of the results. ## Browse examples by filter {#available-example-categories} * [Title Query Examples](./title-examples) * [Language Examples](./language-examples) * [Category Examples](./category-examples) * [Entity Examples](./entity-examples) * [Sentiment Examples](./sentiment-examples) * [Source Examples](./source-examples) * [Date and Time Examples](./date-time-examples) * [Person Query Examples](./person-examples) * [Organization Query Examples](./organization-examples) * [Brand Query Examples](./brand-examples) * [Author Query Examples](./author-examples) * [Location Query Examples](./search-by-location) * [Media Query Examples](./media-examples) * [Topic Query Examples](./topic-examples) * [Industry Query Examples](./industry-examples) * [Sorting Query Examples](./sorting-examples) * [Pagination Query Examples](./pagination-examples) * [Additional Filter Query Examples](./filter-examples) * [Export Query Examples](./export-examples) * [Article Query Examples](./article-examples) ## Get started {#getting-started} All examples assume you have a valid API key. Replace `YOUR_API_KEY` in the examples with your actual key. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=example&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "example", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "example", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "example", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "example") 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) } ``` ```java [Java] 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/everything?title=example&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=example 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/everything ``` ::: ## Combine filters {#customizing-examples} Combine filters from different examples to build your own request. ## Find parameter details {#additional-information} See [parameters](/platform/news-api/filters#parameters) for names, formats and limits. Find valid filter values in these lists: * [List of Supported Languages](/platform/news-api/list-of-languages) * [List of Supported Categories](/platform/news-api/list-of-categories) * [List of Supported Topics](/platform/news-api/list-of-topics) * [List of Supported Industries](/platform/news-api/list-of-industries) --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/typescript/node-fetch-client.md description: Call the APITube News API from TypeScript using the node-fetch package --- # node-fetch integration ```typescript import fetch from 'node-fetch'; interface NewsResponse { status: string; data: Article[]; } interface Article { title: string; description: string; url: string; published_at: string; } async function fetchNews(): Promise { const params = new URLSearchParams({ per_page: '50', api_key: 'YOUR_API_KEY' }); try { const response = await fetch( `https://api.apitube.io/v1/news/everything?${params}` ); if (!response.ok) { throw new Error(`HTTP Request Error: ${response.status}`); } const data = await response.json() as NewsResponse; console.log(JSON.stringify(data, null, 2)); } catch (error) { console.error(error); } } fetchNews(); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/objective-c/ns-url-session.md description: >- Call the APITube News API from Objective-C using the native NSURLSession API for network requests --- # NSURLSession integration ```objective-c #import int main(int argc, const char * argv[]) { @autoreleasepool { NSString *urlString = @"https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"; NSURL *url = [NSURL URLWithString:urlString]; NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"Error: %@", error); } else { NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@", result); } }]; [task resume]; [[NSRunLoop currentRunLoop] run]; // Keep the command line tool alive until the request finishes. } return 0; } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/java/ok-http-client.md' description: Call the APITube News API from Java using OkHttp --- # OkHttp integration ```java // Install: add OkHttp (com.squareup.okhttp3:okhttp) via Maven/Gradle OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") .get() .build(); Response response = client.newCall(request).execute(); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/kotlin/okhttp-client.md' description: Call the APITube News API from Kotlin using the OkHttp client library --- # OkHttp integration ```kotlin // Install: add OkHttp (com.squareup.okhttp3:okhttp) via Maven/Gradle val client = OkHttpClient() val request = Request.Builder() .url("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") .get() .build() val response = client.newCall(request).execute() ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/openapi.md' description: >- APITube News API OpenAPI 3.0 specification for code generation, documentation, and client SDK building --- # OpenAPI Specification Use the [OpenAPI 3.0](https://www.openapis.org/) specification to look up endpoints, parameters, request and response formats, and authentication. ## Specification URL :::tip The OpenAPI specification is available at: **** ::: ## What is OpenAPI? OpenAPI describes an API in a format that tools can read. Use the JSON specification to: * **Generate client SDKs** in any programming language * **Import into API tools** like Postman, Insomnia, or Bruno * **Auto-generate documentation** with Swagger UI, Redoc, or Stoplight * **Validate requests and responses** during development * **Create mock servers** for testing without hitting the production API ## Usage Examples ### Import into Postman 1. Open Postman and click **Import** 2. Select **Link** and paste `https://api-reference.apitube.io/openapi.json` 3. Click **Import** — all endpoints will be available as a collection ### Generate a Client SDK Using [OpenAPI Generator](https://openapi-generator.tech/): ```bash npx @openapitools/openapi-generator-cli generate \ -i https://api-reference.apitube.io/openapi.json \ -g python \ -o ./apitube-client ``` Supported languages: Python, TypeScript, Java, Go, Ruby, PHP, C#, Rust, and [many more](https://openapi-generator.tech/docs/generators). ### View in Swagger UI Use the hosted [Swagger Editor](https://editor.swagger.io/) — click **File → Import URL** and paste `https://api-reference.apitube.io/openapi.json`. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/organization-examples.md description: Examples of using organization parameters in News API --- # Organization Query Examples ## Find news about one organization {#search-for-news-about-a-specific-organization} Find news about Google. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") 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) } ``` ```java [Java] 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/everything?organization.name=Google&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google 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/everything ``` ::: ## Find news about several organizations {#search-for-news-about-multiple-organizations} Find news about Google and Apple. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google,Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google,Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google,Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google,Apple") 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) } ``` ```java [Java] 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/everything?organization.name=Google,Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google,Apple 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/everything ``` ::: ## Include one organization and exclude another Find Google news and exclude articles about Apple. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "ignore.organization.name": "Apple", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "ignore.organization.name" => "Apple", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("ignore.organization.name", "Apple") 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) } ``` ```java [Java] 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/everything?organization.name=Google&ignore.organization.name=Apple&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&ignore.organization.name=Apple 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/everything ``` ::: ## Compare competitor coverage {#competitive-intelligence-analysis} Compare technology coverage of Tesla, Google and Amazon. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla,Google,Amazon&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla,Google,Amazon", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla,Google,Amazon", "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla,Google,Amazon", "category.id" => "medtop:13000000", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla,Google,Amazon") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla,Google,Amazon&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla,Google,Amazon&category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Follow company sentiment in financial news {#organization-sentiment-tracking-during-financial-events} Follow sentiment in business coverage of Google. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "sort.by": "published_at", "sort.order": "asc", "category.id": "medtop:04000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "sort.by" => "published_at", "sort.order" => "asc", "category.id" => "medtop:04000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?organization.name=Google&sort.by=published_at&sort.order=asc&category.id=medtop:04000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&sort.by=published_at&sort.order=asc&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/everything ``` ::: ## Find social responsibility news {#corporate-social-responsibility-coverage} Find positive news about technology companies and sustainability. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Microsoft,Google,Amazon", "title": "sustainability,ESG,green", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Microsoft,Google,Amazon", "title" => "sustainability,ESG,green", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Microsoft,Google,Amazon") q.Set("title", "sustainability,ESG,green") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Microsoft,Google,Amazon&title=sustainability,ESG,green&sentiment.overall.polarity=positive 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/everything ``` ::: ## Follow leadership changes {#executive-leadership-transition-analysis} Follow news about leadership changes. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google", "title": "CEO", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google", "title" => "CEO", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google") q.Set("title", "CEO") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google&title=CEO&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Compare company coverage across regions {#cross-regional-organizational-reputation-analysis} Compare coverage of multinational companies by country, language and sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google,Microsoft,Amazon&source.country.code=us,gb,de&language.code=en,de&sort.by=organization.name,source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google,Microsoft,Amazon", "source.country.code": "us,gb,de", "language.code": "en,de", "sort.by": "organization.name,source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google,Microsoft,Amazon", "source.country.code": "us,gb,de", "language.code": "en,de", "sort.by": "organization.name,source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google,Microsoft,Amazon", "source.country.code" => "us,gb,de", "language.code" => "en,de", "sort.by" => "organization.name,source.country.code,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google,Microsoft,Amazon") q.Set("source.country.code", "us,gb,de") q.Set("language.code", "en,de") q.Set("sort.by", "organization.name,source.country.code,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?organization.name=Google,Microsoft,Amazon&source.country.code=us,gb,de&language.code=en,de&sort.by=organization.name,source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google,Microsoft,Amazon&source.country.code=us,gb,de&language.code=en,de&sort.by=organization.name,source.country.code,sentiment.overall.score 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/everything ``` ::: ## Follow industry changes affecting companies {#organization-industry-disruption-impact-tracking} Find news about companies and changes in financial technology. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Google,Amazon&title=fintech,blockchain,cryptocurrency&category.id=medtop:04000000&sort.by=organization.name,published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Google,Amazon", "title": "fintech,blockchain,cryptocurrency", "category.id": "medtop:04000000", "sort.by": "organization.name,published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Google,Amazon", "title": "fintech,blockchain,cryptocurrency", "category.id": "medtop:04000000", "sort.by": "organization.name,published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Google,Amazon", "title" => "fintech,blockchain,cryptocurrency", "category.id" => "medtop:04000000", "sort.by" => "organization.name,published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Google,Amazon") q.Set("title", "fintech,blockchain,cryptocurrency") q.Set("category.id", "medtop:04000000") q.Set("sort.by", "organization.name,published_at") 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) } ``` ```java [Java] 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/everything?organization.name=Google,Amazon&title=fintech,blockchain,cryptocurrency&category.id=medtop:04000000&sort.by=organization.name,published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Google,Amazon&title=fintech,blockchain,cryptocurrency&category.id=medtop:04000000&sort.by=organization.name,published_at 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/pagination-examples.md description: Examples of using pagination parameters in News API --- # Pagination Query Examples ## Get the first page {#basic-pagination} Get page 1 with 10 articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?per_page=10&page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "per_page": "10", "page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["per_page" => "10", "page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("per_page", "10") q.Set("page", "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) } ``` ```java [Java] 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/everything?per_page=10&page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?per_page=10&page=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/everything ``` ::: ## Choose a page {#retrieving-specific-pages} Get page 3 with 20 articles per page. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?per_page=20&page=3&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "per_page": "20", "page": "3", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "per_page": "20", "page": "3", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["per_page" => "20", "page" => "3", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("per_page", "20") q.Set("page", "3") 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) } ``` ```java [Java] 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/everything?per_page=20&page=3&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?per_page=20&page=3 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/everything ``` ::: ## Fetch a large result set {#efficient-large-dataset-retrieval} Get technology news with 100 articles per page. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "per_page": "100", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "per_page" => "100", "page" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("per_page", "100") q.Set("page", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&per_page=100&page=1&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Combine filters and pagination {#paginated-multi-criteria-search} Page through positive news about Amazon. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Amazon", "sentiment.overall.polarity": "positive", "per_page": "25", "page": "1", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Amazon", "sentiment.overall.polarity" => "positive", "per_page" => "25", "page" => "1", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Amazon") q.Set("sentiment.overall.polarity", "positive") q.Set("per_page", "25") q.Set("page", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=1&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Collect pages in order {#sequential-data-collection} Fetch a large result set one page at a time. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&per_page=100&page=2&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "per_page": "100", "page": "2", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "per_page": "100", "page": "2", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "per_page" => "100", "page" => "2", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("per_page", "100") q.Set("page", "2") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&per_page=100&page=2&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&per_page=100&page=2 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/everything ``` ::: ## Page through research results {#paginated-research-analysis} Page through green energy articles. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&per_page=10&page=1&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "per_page": "10", "page": "1", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "per_page": "10", "page": "1", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "per_page" => "10", "page" => "1", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("per_page", "10") q.Set("page", "1") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&per_page=10&page=1&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&per_page=10&page=1&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Browse the news archive {#exploring-news-archives} Page through political news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&per_page=30&page=1&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:11000000", "per_page": "30", "page": "1", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "per_page": "30", "page": "1", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "per_page" => "30", "page" => "1", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:11000000") q.Set("per_page", "30") q.Set("page", "1") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:11000000&per_page=30&page=1&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&per_page=30&page=1&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Compare categories one page at a time {#cross-category-comparative-analysis-with-structured-pagination} Get pages of articles from several categories for comparison. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&per_page=10&page=1&sort.by=category.id,published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "per_page": "10", "page": "1", "sort.by": "category.id,published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "per_page": "10", "page": "1", "sort.by": "category.id,published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "per_page" => "10", "page" => "1", "sort.by" => "category.id,published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("per_page", "10") q.Set("page", "1") q.Set("sort.by", "category.id,published_at") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&per_page=10&page=1&sort.by=category.id,published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&per_page=10&page=1&sort.by=category.id,published_at 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/everything ``` ::: ## Compare market sentiment one page at a time {#multi-market-sentiment-monitoring-with-pagination} Page through news from different markets to compare sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.country.code=us,de,gb,fr&category.id=medtop:04000000&title=economy,market,trade&per_page=20&page=1&sort.by=source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.country.code": "us,de,gb,fr", "category.id": "medtop:04000000", "title": "economy,market,trade", "per_page": "20", "page": "1", "sort.by": "source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.country.code": "us,de,gb,fr", "category.id": "medtop:04000000", "title": "economy,market,trade", "per_page": "20", "page": "1", "sort.by": "source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.country.code" => "us,de,gb,fr", "category.id" => "medtop:04000000", "title" => "economy,market,trade", "per_page" => "20", "page" => "1", "sort.by" => "source.country.code,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("source.country.code", "us,de,gb,fr") q.Set("category.id", "medtop:04000000") q.Set("title", "economy,market,trade") q.Set("per_page", "20") q.Set("page", "1") q.Set("sort.by", "source.country.code,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?source.country.code=us,de,gb,fr&category.id=medtop:04000000&title=economy,market,trade&per_page=20&page=1&sort.by=source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?source.country.code=us,de,gb,fr&category.id=medtop:04000000&title=economy,market,trade&per_page=20&page=1&sort.by=source.country.code,sentiment.overall.score 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/reference/people.md' description: >- Search public figure profiles with background details, recent articles and coverage summaries. --- # People Search profiles of public figures, politicians and executives. Each profile includes background details, a `coverage` summary and recent articles about the person. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ::: tip Added in 1.0.42 Full response field definitions are in [API Response Structure](/platform/news-api/response-structure#reference-endpoints-response-structure). See also the [Build a public figure profile](/platform/news-api/common-workflows/recipes/person-dossier) recipe. ::: ## Endpoints ``` GET /v1/people # list & search GET /v1/people/{id} # single person profile ``` Send your API key in the `X-API-Key` header or `api_key` URL parameter. ## List & search ``` GET /v1/people ``` ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `name` | string | No | Filter by person name (substring match). | | `wikidata_id` | string | No | Filter by Wikidata ID (e.g. `Q317521` or `317521`). | | `page` | integer | No | Page number (default `1`). | | `per_page` | integer | No | Results per page (default `100`, max `250`; the plan ceiling applies — Free 10, Starter 50, Basic 200). | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ### Example ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/people?name=Obama&per_page=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/people", params={"name": "Obama", "per_page": 5, "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ name: "Obama", per_page: "5", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/people?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["name" => "Obama", "per_page" => 5, "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/people?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/people") q := u.Query() q.Set("name", "Obama") q.Set("per_page", "5") 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) } ``` ```java [Java] 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/people?name=Obama&per_page=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/people?name=Obama&per_page=5 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/everything ``` ::: ```json { "status": "ok", "limit": 5, "page": 1, "has_next_pages": true, "results": [ { "id": 1316868, "name": "Michelle Obama", "type": "person", "links": { "self": "https://api.apitube.io/v1/people/1316868", "articles": "https://api.apitube.io/v1/news/entity/1316868", "wikipedia": "https://en.wikipedia.org/wiki/Michelle_Obama", "wikidata": "https://www.wikidata.org/wiki/Q13133" }, "profile": { "title": "attorney at law", "gender": "female", "nationality": "United States", "date_of_birth": "1964-01-17", "social_profiles": { "twitter": "https://twitter.com/MichelleObama" } } } ] } ``` ## Person profile ``` GET /v1/people/{id} ``` Get one person's full `profile`, news `coverage` and `recent_articles`. `recent_articles` contains the **5 latest** articles about the person. Each includes the full article fields from `/v1/news/everything`, including `body`, `body_html` and `entities`, so responses can be large. `coverage=false` removes only the coverage summary. ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `coverage` | string | No | Set to `false` to omit the `coverage` block (faster response). | | `api_key` | string | Yes\* | Your API key. | ### Example ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/people/1316868?api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/people/1316868", params={"api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const resp = await fetch("https://api.apitube.io/v1/people/1316868?api_key=YOUR_API_KEY"); console.log(await resp.json()); ``` ```php [PHP] $data = json_decode(file_get_contents("https://api.apitube.io/v1/people/1316868?api_key=YOUR_API_KEY"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/people/1316868") q := u.Query() 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) } ``` ```java [Java] 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/people/1316868?api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/people/1316868 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/everything ``` ::: ```json { "id": 1316868, "name": "Michelle Obama", "type": "person", "links": { "self": "...", "articles": "...", "wikipedia": "...", "wikidata": "..." }, "profile": { "title": "attorney at law", "bio_summary": "...", "social_profiles": {} }, "coverage": { "article_count": 180, "first_seen": "2017-01-06", "last_seen": "2026-03-03", "sentiment": { "positive": 47, "neutral": 95, "negative": 27 }, "momentum": { "last_30_days": 12, "previous_30_days": 8, "change_pct": 50 }, "timeline": [ { "period": "2026-02-01", "count": 13 } ], "top_sources": [ { "id": 342, "name": "cbc.ca", "domain": "cbc.ca", "count": 9 } ], "top_topics": [ { "id": "politics", "name": "Politics", "count": 70 } ], "top_countries": [ { "id": 102, "name": "United States", "code": "us", "count": 55 } ], "top_languages": [ { "id": 1, "name": "English", "code": "en", "count": 118 } ], "related_entities": [ { "id": 1316867, "name": "Barack Obama", "count": 348 } ] }, "recent_articles": [ { "id": 3074512345, "title": "...", "href": "...", "published_at": "...", "body": "...", "entities": [], "categories": [], "sentiment": {} } ] } ``` ### Coverage fields | Field | Description | |-------|-------------| | `article_count` | Total articles mentioning this person. | | `first_seen` / `last_seen` | Date range of coverage. | | `sentiment` | Article counts by overall polarity. | | `momentum` | Mentions in the last 30 days vs. the previous 30 days, with `change_pct`. | | `timeline` | Monthly mention counts (chronological, up to 24 months). | | `top_sources` | Sources covering this person most. | | `top_topics` | Most associated topics. | | `top_countries` / `top_languages` | Geographic and language spread of coverage. | | `related_entities` | Entities most often mentioned in the same articles as this person. | | `recent_articles` | Latest articles mentioning this person (same fields as `/v1/news/everything`). | ## Pricing Each request costs **1 point**, charged only when the response contains at least one result. A search returning zero results is free. Requests with no remaining credits return `402`. ## Errors A request for a non-existent person returns: ```json { "errors": [ { "status": 404, "code": "ER0151", "message": "Person not found." } ] } ``` --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/person-examples.md description: Examples of using person parameters in News API --- # Person Query Examples ## Find news about one person {#search-for-news-about-a-specific-person} Find news about Elon Musk. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk 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/everything ``` ::: ## Find news about several people {#search-for-news-about-multiple-people} Find news about Elon Musk and Donald Trump. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk,Donald Trump&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk,Donald Trump", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk,Donald Trump", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk,Donald Trump") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk,Donald Trump&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk,Donald Trump 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/everything ``` ::: ## Compare sentiment about a person across sources {#person-sentiment-analysis-across-different-news-sources} Compare sentiment in coverage of Elon Musk across sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "source.domain" => "theguardian.com,foxnews.com,nytimes.com", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("source.domain", "theguardian.com,foxnews.com,nytimes.com") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Find a person and company together {#cross-reference-person-with-organizations} Find articles mentioning both Elon Musk and Tesla. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "organization.name": "Tesla", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "organization.name" => "Tesla", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("organization.name", "Tesla") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk&organization.name=Tesla&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Follow negative coverage over time {#public-figure-controversy-timeline} Get negative news about Elon Musk in date order. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk", "sentiment.overall.polarity": "negative", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk", "sentiment.overall.polarity" => "negative", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk") q.Set("sentiment.overall.polarity", "negative") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk&sentiment.overall.polarity=negative&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Find mentions of a person {#person-mention-in-news} Find articles mentioning Donald Trump. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Donald Trump&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Donald Trump", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Donald Trump", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Donald Trump", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Donald Trump") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?person.name=Donald Trump&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Donald Trump&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Follow coverage of a politician {#tracking-a-politician-s-media-coverage} Follow coverage of a politician. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Donald Trump", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Donald Trump", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Donald Trump", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Donald Trump") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Donald Trump&category.id=medtop:11000000&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Compare coverage of several people {#multiple-person-comparative-media-analysis} Compare coverage of technology leaders by region and language, with image filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Elon Musk,Donald Trump&language.code=en,de&source.country.code=us,gb,de&sort.by=person.name,source.country.code&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Elon Musk,Donald Trump", "language.code": "en,de", "source.country.code": "us,gb,de", "sort.by": "person.name,source.country.code", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Elon Musk,Donald Trump", "language.code": "en,de", "source.country.code": "us,gb,de", "sort.by": "person.name,source.country.code", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Elon Musk,Donald Trump", "language.code" => "en,de", "source.country.code" => "us,gb,de", "sort.by" => "person.name,source.country.code", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Elon Musk,Donald Trump") q.Set("language.code", "en,de") q.Set("source.country.code", "us,gb,de") q.Set("sort.by", "person.name,source.country.code") 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) } ``` ```java [Java] 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/everything?person.name=Elon Musk,Donald Trump&language.code=en,de&source.country.code=us,gb,de&sort.by=person.name,source.country.code&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Elon Musk,Donald Trump&language.code=en,de&source.country.code=us,gb,de&sort.by=person.name,source.country.code 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/everything ``` ::: ## Find a person and location together {#person-and-location-context-analysis} Find articles mentioning a person and selected locations. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?person.name=Donald Trump&title=economy,trade,tariff&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "person.name": "Donald Trump", "title": "economy,trade,tariff", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "person.name": "Donald Trump", "title": "economy,trade,tariff", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["person.name" => "Donald Trump", "title" => "economy,trade,tariff", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("person.name", "Donald Trump") q.Set("title", "economy,trade,tariff") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?person.name=Donald Trump&title=economy,trade,tariff&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?person.name=Donald Trump&title=economy,trade,tariff&sort.by=sentiment.overall.score 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/node-js/rapidql-client.md description: >- Call the APITube News API from Node.js using the RapidQL library for unified API queries --- # RapidQL integration ```javascript // For more information about RapidQL, checkout docs.rapidql.com! // Install: npm install rapidql const RapidQL = require('RapidQL'); let rql = new RapidQL({ }); rql.query(`{ Http.get( url:"https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY" body : undefined ) { } }`) .then((res) => console.log(res)) .catch((err) => console.log(err)); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/rate-limits.md' description: Learn about the rate limits and quotas for the APITube News API. --- # Rate Limits and Quotas Your rate limit is the number of requests you can send per minute. If you exceed it, the API returns `429 Too Many Requests`. :::tip Your plan sets your request limit. Check the table below. ::: ## Rate limits Limits apply **per account** to requests sent in the previous **minute**. All live keys share this limit; creating more keys does not increase it. Test keys (`api_test_`) have a separate limit. | Plan | Rate limit | |-----------------------------------|----------------------------------------------------------------| | Free | 10 requests per minute, results limited to the first 5 pages | | Starter / Basic / Professional | 50 requests per minute | | Corporate | 200 requests per minute | Starter, Basic and Professional allow **50 requests per minute**. Their quotas and features differ. Corporate allows **200 requests per minute**. On Free, requesting page 6 or later returns `400 ER0173`. Exceeding the limit returns `429 ER0203`. Repeated violations can temporarily block your key. While blocked, requests return `429 ER0204`. ## Results per page Your plan also limits `per_page`, the number of results per page. The default is `100` or your plan's maximum, whichever is lower. Without `per_page`, Free returns 10 articles and Starter returns 50. | Plan | Max `per_page` | |--------------|----------------| | Free | 10 | | Starter | 50 | | Basic | 200 | | Professional | 250 | | Corporate | 250 | If `per_page` exceeds your plan's maximum, the API returns `400 ER0171`. The error message states the allowed value (`Limit is out of range. Your plan allows up to 10 results per page.`). On **Free**, you can access 5 pages of 10 articles: at most **50 articles** per search. ## Title search window Title searches can cover at most **31 days** of `published_at` per request. This limit applies to all plans and endpoints, including exports, SSE and WebSocket. It covers `title`, `title_starts_with`, `title_ends_with`, `title_pattern` and `query`. | Request | Result | |---------|--------| | Title search without `published_at.start` / `published_at.end` | Last 31 days are searched. `200` with an `ER0366` warning in `meta.warnings` and an `x-query-window-clamped: 31` header | | Title search with a range wider than 31 days | `400` with code `ER0110` | | Title search with a range of 31 days or less | Runs as requested | | Any request without a title search | No range limit | To search a longer period, split it into ranges of 31 days or less and send a separate request for each range. See [Search window limit](/platform/news-api/everything#limits) for examples. ## Free plan delay On Free, articles become available **12 hours after publication**. The delay applies to searches, counts, trends, [SSE](/platform/news-api/sse-stream), [WebSocket](/platform/news-api/websocket-stream) and [webhook](/platform/news-api/webhooks) delivery. Starter and higher plans have no added delay. On Free, [exports](/platform/news-api/response-structure) other than JSON and the [Trends](/platform/news-api/trends) endpoint return `403 ER0706`. See [Plan gates](/platform/news-api/http-response-codes#plan-gates) for all features that require a paid plan. ## Fact Check [Fact Check](/platform/news-api/fact-check) (`/v1/fact-check`) requires a paid plan and allows **10 requests per minute**. This limit applies in addition to your plan's overall rate limit. Exceeding it returns `429 ER0203`. ## Natural language prompt The [`prompt`](/platform/news-api/ai/natural-language-search) parameter is available on **Basic and above**. On Free and Starter it returns `403 ER0706` before the translation runs, so no points are spent. | Plan | `prompt` | |--------------|----------| | Free | No | | Starter | No | | Basic | Yes | | Professional | Yes | | Corporate | Yes | The `prompt` parameter writes filters for you. You can also send those filters directly, including the boolean `query` parameter, without using `prompt`. ## SSE Stream Connections Each plan has a limit on the number of concurrent SSE stream connections: | Plan | Max SSE Connections | |--------------|---------------------| | Free | 0 | | Starter | 2 | | Basic | 2 | | Professional | 10 | | Corporate | 50 | If you exceed the limit, the API will return a `429` error with code `ER0360`. ## Monitoring Rate Limits Read these response headers to track your request limit: | Header | Description | |--------|-------------| | `X-RateLimit-Limit` | The maximum number of requests you can make in the current time window | | `X-RateLimit-Remaining` | The number of requests remaining in the current time window | | `X-RateLimit-Reset` | The number of seconds remaining until the rate limit resets | Example (a paid plan with a 50 requests-per-minute limit): ``` X-RateLimit-Limit: 50 X-RateLimit-Remaining: 49 X-RateLimit-Reset: 32 ``` ### Account and quota headers These response headers show your plan, remaining points and balance. You can read them without a separate [`/v1/balance`](/platform/news-api/balance) request: | Header | Description | |--------|-------------| | `X-Subscription-Plan` | The key's plan (`free`, `starter`, `basic`, `professional`, `corporate`) | | `X-Points-Remaining` | Points left in the current quota period | | `X-Balance-Remaining` | Prepaid pay-as-you-go balance left, in cents | | `X-Budget-Remaining` | Cents left in this month's PAYG spending limit — **only present when a limit is set** | | `X-Apitube-Mode` | `live` or `test`, so an SDK never has to parse the test marker out of the content | | `X-Request-ID` | Unique id of the request — quote it when contacting support | When `X-Points-Remaining` reaches `0`, the next request returns `402 ER0176`. When `X-Budget-Remaining` reaches `0`, requests billed to your balance return `402 ER0177`. Check these headers to stop requests before a limit is reached. ``` X-Subscription-Plan: basic X-Points-Remaining: 48500 X-Balance-Remaining: 0 X-Apitube-Mode: live X-Request-ID: e5efb02a-d9bd-45e7-8264-829167dd4842 ``` ## Spending your pay-as-you-go balance To pay for requests beyond your plan quota, turn on balance spending in the dashboard. The switch is on the **Pay as you go** page and under **Account → Plan & usage**. It is **off by default**. Only the workspace owner can change it. With balance spending off, requests beyond your quota return `402 ER0176`. This applies to REST, SSE, WebSocket and webhooks. With it on, requests use your plan quota first, then your balance at $0.01 per request. `X-Balance-Remaining` shows the money in your account even when balance spending is off. A positive balance also removes Free plan restrictions. The switch only controls whether requests can spend that money. ## Pay-as-you-go spending limit Set a **monthly spending limit** in the dashboard to cap spending from your prepaid balance. It resets at the start of each calendar month in UTC. When a limit is configured, every response includes the remaining budget for the current month: | Header | Description | |--------|-------------| | `X-Budget-Remaining` | Remaining monthly pay-as-you-go budget, in cents. Present only when a limit is set. | Example (`50000` cents = $500 left this month): ``` X-Budget-Remaining: 50000 ``` When you reach the monthly limit, requests charged to your balance return `402 ER0177`. You can wait until the next month or raise or remove the limit in the dashboard. Requests covered by your plan quota still work. --- --- url: 'https://docs.apitube.io/platform/news-api/raw.md' description: >- Get the earliest available articles in a basic format, without detected language, entities, categories or sentiment. --- # Raw Articles Use `/v1/news/raw` for the earliest available articles in a basic format. Choose it if you want to process and analyse article content yourself. Raw articles include a title, link, body, author, original categories and publisher details when available. They do not include detected language, APITube categories, topics, entities, industries or sentiment. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ::: warning Only the last ~24 hours are available This endpoint only returns articles from roughly the **last 24 hours**. Use [`/v1/news/everything`](/platform/news-api/everything) to search the full archive. ::: ## Endpoint ``` GET /v1/news/raw POST /v1/news/raw ``` GET and POST return the same results. Send filters in the URL with `GET` or as JSON in the request body with `POST`. ## Query Parameters Only the parameters below are supported by this endpoint. For the full search filter set, use [Search articles](/platform/news-api/everything) with [Filters](/platform/news-api/filters). | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prompt` | string | No | Describe the news you want. On this endpoint, the prompt can only set `published_at.start`, `published_at.end`, `sort.order` and `per_page`. Other filters appear in `meta.prompt.ignored` with reason `unsupported_on_endpoint`. A new translation costs 2 extra points. Requires Basic or above; Free and Starter return `403 ER0706`. Range: 3–500 characters. | | `published_at` | string | No | Search one day (a 24-hour range). Accepts ISO 8601, YYYY-MM-DD or relative dates. Example: `2026-05-27`. | | `published_at.end` | string | No | End of the publication date range. Example: `2026-05-27`. | | `published_at.start` | string | No | Start of the publication date range. Example: `2026-05-26`. | | `ignore.source.id` | string | No | Comma-separated source IDs to exclude (max 3). Example: `789`. | | `source.id` | string | No | Source IDs, separated by commas (max 3). Example: `123`. | | `sort.by` | string | No | Sort field (default id). One of: `id`, `published_at`, `created_at`. Example: `id`. | | `sort.order` | string | No | Sort direction (default desc). One of: `asc`, `desc`. Example: `desc`. | | `page` | integer | No | Page number (default 1). Example: `1`. | | `per_page` | integer | No | Results per page (default 100, max 250; Free is capped at 10, Starter at 50, Basic at 200). Example: `100`. | > **`prompt` supports only some filters here.** On Basic and above, [`prompt`](/platform/news-api/filters#prompt) can set `published_at.start`, `published_at.end`, `sort.order` and `per_page`. Free and Starter return `403 ER0706`. Other generated filters appear in `meta.prompt.ignored` with `reason: unsupported_on_endpoint`. An uncached translation still costs 2 points. To avoid this charge, send the date range directly. > **Most search filters are unavailable here.** This includes `title`, `language.code`, `category.*`, `topic.*`, `entity.*`, `industry.*`, `sentiment.*` and media filters. Use [`/v1/news/everything`](/platform/news-api/everything) if you need these filters. > Each request costs **1 point** (charged only when the response contains at least one article). ## Response Format ```json { "status": "ok", "limit": 100, "path": "https://api.apitube.io/v1/news/raw?page=1&per_page=100", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/raw?page=2&per_page=100", "has_previous_page": false, "previous_page": "", "request_id": "string", "results": [ { "id": 0, "title": "string", "href": "string", "created_at": "string", "description": "string", "body": "string", "body_html": "string", "author": "string", "keywords": ["string"], "source": { "id": 0, "domain": "string", "home_page_url": "string", "type": "string", "bias": "string", "rankings": { "opr": 0 }, "location": { "country_name": "string", "country_code": "string" }, "favicon": "string" } } ] } ``` Unlike `/v1/news/everything`, the raw response has **no `export` block** — bulk export formats are not available for this endpoint. ### Response Fields | Field | Type | Description | |-------|------|-------------| | `status` | string | Always `ok` on success. | | `limit` | integer | Number of results per page. | | `page` | integer | Current page number. | | `has_next_pages` | boolean | Whether more pages exist. | | `next_page` | string | URL for the next page (empty if none). | | `has_previous_page` | boolean | Whether a previous page exists. | | `previous_page` | string | URL for the previous page (empty if none). | | `request_id` | string | Unique identifier for the request. | | `results` | array | Array of raw article objects (see below). | Each item in `results`: | Field | Type | Description | |-------|------|-------------| | `id` | integer | Raw article id. | | `title` | string | null | Article title. | | `href` | string | null | Article URL. | | `created_at` | string | null | Publication date (may be `null`). | | `description` | string | null | Short description. | | `body` | string | Article body with HTML stripped (plain text). | | `body_html` | string | Article body as received from the feed (HTML preserved). | | `author` | string | null | Author. | | `keywords` | array | null | Raw categories/keywords. | | `source` | object | Publisher details. | | `source.id` | integer | null | Source ID. | | `source.domain` | string | Source domain. | | `source.home_page_url` | string | Source home page URL. | | `source.type` | string | Source resource type. | | `source.bias` | string | Political bias (`left` / `center` / `right`). | | `source.rankings.opr` | number | null | Open PageRank score. | | `source.location.country_name` | string | Source country name. | | `source.location.country_code` | string | Source country ISO code. | | `source.favicon` | string | Favicon URL. | The `body` / `body_html` pair mirrors `/v1/news/everything`: `body` is the plain-text version (HTML removed and whitespace collapsed), while `body_html` keeps the original HTML markup. ## Request Examples ### GET with query filters ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/raw?source.id=1024&per_page=5&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/news/raw", params={"source.id": 1024, "per_page": 5, "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.id": "1024", per_page: "5", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/news/raw?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["source.id" => 1024, "per_page" => 5, "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/raw?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/raw") q := u.Query() q.Set("source.id", "1024") q.Set("per_page", "5") 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) } ``` ```java [Java] 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/raw?source.id=1024&per_page=5&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/raw?source.id=1024&per_page=5 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/everything ``` ::: ### POST with JSON body ::: code-group ```bash [cURL] curl -X POST "https://api.apitube.io/v1/news/raw" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "published_at.start": "NOW-1DAY", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "desc", "per_page": 5 }' ``` ```python [Python] import requests resp = requests.post( "https://api.apitube.io/v1/news/raw", headers={"X-API-Key": "YOUR_API_KEY"}, json={ "published_at.start": "NOW-1DAY", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "desc", "per_page": 5, }, ) print(resp.json()) ``` ```javascript [Node.js] const resp = await fetch("https://api.apitube.io/v1/news/raw", { method: "POST", headers: { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "published_at.start": "NOW-1DAY", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "desc", per_page: 5, }), }); console.log(await resp.json()); ``` ```php [PHP] $ch = curl_init("https://api.apitube.io/v1/news/raw"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode([ "published_at.start" => "NOW-1DAY", "published_at.end" => "NOW", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => 5, ]), ]); $data = json_decode(curl_exec($ch), true); print_r($data); ``` ```go [Go] package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { payload, _ := json.Marshal(map[string]any{ "published_at.start": "NOW-1DAY", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "desc", "per_page": 5, }) req, _ := http.NewRequest("POST", "https://api.apitube.io/v1/news/raw", bytes.NewBuffer(payload)) req.Header.Set("X-API-Key", "YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) var data map[string]any json.Unmarshal(body, &data) fmt.Println(data) } ``` ```java [Java] 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 { String payload = "{\"published_at.start\": \"NOW-1DAY\", \"published_at.end\": \"NOW\", \"sort.by\": \"published_at\", \"sort.order\": \"desc\", \"per_page\": 5}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.apitube.io/v1/news/raw")) .header("X-API-Key", "YOUR_API_KEY") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: POST https://api.apitube.io/v1/news/raw Body (JSON): { "published_at.start": "NOW-1DAY", "published_at.end": "NOW", "sort.by": "published_at", "sort.order": "desc", "per_page": 5 } 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/everything ``` ::: ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/news/raw?source.id=1024" ``` ## Response Example ```json { "status": "ok", "limit": 2, "path": "https://api.apitube.io/v1/news/raw?per_page=2", "page": 1, "has_next_pages": true, "next_page": "https://api.apitube.io/v1/news/raw?page=2&per_page=2", "has_previous_page": false, "previous_page": "", "request_id": "req_def456ghi789", "results": [ { "id": 84512377, "title": "AI advances reshape the chip industry in 2026", "href": "https://example.com/ai-advances-2026", "created_at": "2026-05-27 08:00:00", "description": "A look at how new accelerators are changing the market.", "body": "The field of artificial intelligence continues to move quickly...", "body_html": "

The field of artificial intelligence continues to move quickly...

", "author": "Jane Doe", "keywords": ["technology", "ai", "semiconductors"], "source": { "id": 1024, "domain": "example.com", "home_page_url": "https://example.com", "type": "news", "bias": "center", "rankings": { "opr": 6 }, "location": { "country_name": "United States", "country_code": "us" }, "favicon": "https://www.google.com/s2/favicons?domain=https://example.com" } }, { "id": 84512376, "title": "Tech company announces AI partnership", "href": "https://news.example.org/ai-partnership", "created_at": "2026-05-27 07:15:00", "description": "Two firms join forces on model infrastructure.", "body": "A major technology company announced today...", "body_html": "

A major technology company announced today...

", "author": null, "keywords": ["business", "ai"], "source": { "id": 2048, "domain": "news.example.org", "home_page_url": "https://news.example.org", "type": "news", "bias": "left", "rankings": { "opr": 4 }, "location": { "country_name": "United Kingdom", "country_code": "gb" }, "favicon": "https://www.google.com/s2/favicons?domain=https://news.example.org" } } ] } ``` ## Error Responses ### Invalid or Missing API Key ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 401, "code": "ER0175", "message": "API key is invalid or missing.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-27T14:30:00Z" } ] } ``` **Status Code:** 401 ### No Points on Account ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 402, "code": "ER0176", "message": "You have no points on your account.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-27T14:30:00Z" } ] } ``` **Status Code:** 402 ### Rate Limit Exceeded ```json { "status": "not_ok", "request_id": "req_abc123def456", "errors": [ { "status": 429, "code": "ER0203", "message": "Rate limit exceeded.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2026-05-27T14:30:00Z" } ] } ``` **Status Code:** 429 ### Invalid Parameters Invalid parameter values return HTTP `400` with a specific error code: | Code | Parameter | Condition | |------|-----------|-----------| | `ER0050` / `ER0051` / `ER0052` | `source.id` | Not an integer / negative / wrong length (1–20 chars). | | `ER0053` / `ER0054` / `ER0055` | `ignore.source.id` | Not an integer / negative / wrong length (1–20 chars). | | `ER0104` / `ER0105` | `published_at.start` | Invalid value / wrong length (1–30 chars). | | `ER0106` / `ER0107` | `published_at.end` | Invalid value / wrong length (1–30 chars). | | `ER0108` / `ER0109` | `published_at` | Wrong length (1–30 chars) / invalid value. | | `ER0170` / `ER0171` | `per_page` | Not an integer / greater than 250. | | `ER0172` | `page` | Not an integer. | --- --- url: 'https://docs.apitube.io/platform/news-api/real-time.md' description: >- Three ways to receive APITube articles as they are indexed instead of polling — the SSE stream, the WebSocket stream, and webhooks — and how to choose between them. --- # Real-time delivery Receive new articles as they become available, without sending repeated search requests. SSE, WebSocket and webhooks support the same filters as [`/v1/news/everything`](/platform/news-api/filters#parameters), including language, category, source, sentiment, entities and dates. ## Which one do I need? | You want | Use | Guide | |:---------|:----|:------| | The simplest live feed, one-way over HTTP | `GET https://api.apitube.io/v1/news/stream` | [SSE stream](/platform/news-api/sse-stream) | | A socket you can also send messages on | `wss://api.apitube.io/v1/news/ws` | [WebSocket stream](/platform/news-api/websocket-stream) | | Articles posted to your own URL, no connection to hold | Webhooks | [Webhooks](/platform/news-api/webhooks) | ## Pull the stream (SSE) With [Server-Sent Events](/platform/news-api/sse-stream), the API sends articles over an open HTTP connection. Use `curl -N`, a browser's `EventSource`, or a streaming HTTP library. Most SSE clients reconnect automatically: ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en" ``` SSE works well for live dashboards and applications that can keep a connection open. ## Pull the stream (WebSocket) The [WebSocket stream](/platform/news-api/websocket-stream) lets your application receive articles and send messages over the same connection. Use it if your application already uses WebSocket or needs connection acknowledgements and ping messages. ## Let APITube push (Webhooks) With a [webhook](/platform/news-api/webhooks), you register a URL and choose your filters. The API sends each new matching article to that URL as an HTTP `POST`. Use the HMAC-SHA256 signature in `X-Webhook-Signature` to verify the request. The API retries failed deliveries, waiting longer between attempts. Use webhooks for serverless functions, Zapier/Make/n8n workflows, and Slack or Telegram alerts when you cannot keep a connection open. ## Choosing in one line Choose **SSE** to receive articles over an open connection. Choose **WebSocket** to also send messages and update filters. Choose **webhooks** to receive articles at your own URL. ## Next steps * Collect articles in a basic format: [Raw articles](/platform/news-api/raw) * Automate without code: [n8n](/platform/news-api/integrations/n8n), [Zapier](/platform/news-api/integrations/zapier), [Make](/platform/news-api/integrations/make) * Narrow what you receive: [Parameters](/platform/news-api/filters#parameters) --- --- url: 'https://docs.apitube.io/platform/news-api/common-workflows/recipes.md' description: >- Use APITube to build profiles and dashboards, monitor companies and events, find journalists, filter news by reading level and collect raw articles. --- # Recipes Each recipe walks through a complete task, from the first request to reading the result. For a short example of one filter, use the [examples library](/platform/news-api/common-workflows/examples/). ## Profile people and organizations * **[Build a public figure profile](/platform/news-api/common-workflows/recipes/person-dossier)** — use the [People](/platform/news-api/reference/people) directory to get background details, news coverage, related people and organisations, and recent articles in one response. * **[Monitor a company](/platform/news-api/common-workflows/recipes/company-monitoring)** — volume, sentiment, momentum, and which outlets and topics drive the conversation, from the [Companies](/platform/news-api/reference/companies) directory. * **[Find journalists by topic](/platform/news-api/common-workflows/recipes/journalists-by-beat)** — find writers who cover a subject and see where they publish. ## Track a sector or an event * **[Track data breaches and lawsuits](/platform/news-api/common-workflows/recipes/breach-feed)** — chain `event.type` values (`data-breach` → `lawsuit` → `regulatory-action`) into a security incident timeline. * **[Monitor automotive and EV news](/platform/news-api/common-workflows/recipes/automotive-ev-monitor)** — combine three industry IDs into one feed, then filter by event type and sentiment. * **[Track the real estate market](/platform/news-api/common-workflows/recipes/real-estate-market)** — construction, development and REIT coverage in a single feed, with facets showing which countries drive it. ## Build an interface * **[Build a news dashboard with article counts](/platform/news-api/common-workflows/recipes/faceted-dashboard)** — get counts for charts grouped by category, country, publication date or sentiment. * **[Build an autocomplete search box](/platform/news-api/common-workflows/recipes/autocomplete-search)** — search-as-you-type over the [Suggest](/platform/news-api/suggest/entities) endpoints, then follow the selection into its news feed. * **[Filter news by reading level](/platform/news-api/common-workflows/recipes/reading-level-feed)** — readability scores turn into a feed for language learners, a children's news app, or dense expert analysis. ## Collect raw articles {#ingest-at-scale} * **[Collect raw articles](/platform/news-api/common-workflows/recipes/raw-ingestion)** — pull from [`/v1/news/raw`](/platform/news-api/raw) to get articles in a basic format and process them yourself. ## Next steps * Shorter, filter-by-filter snippets: [Examples library](/platform/news-api/common-workflows/examples/) * The full parameter set behind every recipe: [Parameters](/platform/news-api/filters#parameters) * Push instead of poll: [Real-time delivery](/platform/news-api/real-time) --- --- url: 'https://docs.apitube.io/platform/news-api/reference-data.md' description: >- The allowed values behind APITube filters — country, language, category, topic and industry lists, event types, and the autocomplete endpoints that resolve a name to an ID. --- # Reference data Use these lists and search endpoints to find valid filter values. For example, `category.id=medtop:20001126` selects a category, `source.country.code=us` selects a country, and `industry.id=…` selects an industry. ## Browsable lists Browse the lists below to choose values for your filters or search interface: | List | Feeds the filter | |:-----|:-----------------| | [List of Countries](/platform/news-api/list-of-countries) | `source.country.code` | | [List of Languages](/platform/news-api/list-of-languages) | `language.code` | | [List of Categories](/platform/news-api/list-of-categories) | `category.id` — IPTC Media Topics | | [List of Topics](/platform/news-api/list-of-topics) | `topic.id` — specific news subjects | | [List of Industries](/platform/news-api/list-of-industries) | `industry.id` — business sectors | Language coverage varies. Use a [count request](/platform/news-api/count) to check coverage for the language you need. ## Get the current list from the API {#fetched-at-runtime} [`GET /v1/news/event-types`](/platform/news-api/reference/event-types) returns every valid value for the `event.type` and `event.category` filters. Call it to populate a filter UI or to validate input, instead of copying codes by hand. ## Autocomplete (Suggest) To search for an entity, category, topic or industry, send the beginning of its name to a Suggest endpoint. Use the returned ID in your filter: | Endpoint | Resolves to | Guide | |:---------|:------------|:------| | `GET /v1/suggest/entities?prefix=` | `entity.id` — people, companies, brands, places, products | [Suggest entities](/platform/news-api/suggest/entities) | | `GET /v1/suggest/categories?prefix=` | `category.id` | [Suggest categories](/platform/news-api/suggest/categories) | | `GET /v1/suggest/topics?prefix=` | `topic.id` | [Suggest topics](/platform/news-api/suggest/topics) | | `GET /v1/suggest/industries?prefix=` | `industry.id` | [Suggest industries](/platform/news-api/suggest/industries) | ```bash curl "https://api.apitube.io/v1/suggest/entities?prefix=elon&api_key=YOUR_API_KEY" ``` Entity results carry Wikipedia and Wikidata links alongside the ID, which makes them usable directly in a search UI. ## Why IDs matter An unknown parameter or invalid value may be ignored while the API returns `200 ok`. Use the values from these lists and endpoints to avoid typos. See [Debugging API requests](/platform/news-api/debugging) to check which filters the API accepted. ## Next steps * Build a search-as-you-type UI: [Build an autocomplete search box](/platform/news-api/common-workflows/recipes/autocomplete-search) * See every filter these values plug into: [Parameters](/platform/news-api/filters#parameters) * Look up a term: [Glossary](/platform/news-api/glossary) --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/node-js/request-client.md description: Call the APITube News API from Node.js using the Request library --- # Request integration ```javascript // Install: npm install request const request = require('request'); const options = { method: 'GET', url: 'https://api.apitube.io/v1/news/everything', qs: { per_page: 10, api_key: 'YOUR_API_KEY' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/python/requests-client.md description: Call the APITube News API from Python using the Requests HTTP library --- # Requests integration ```python # Install: pip install requests import requests url = "https://api.apitube.io/v1/news/everything" querystring = {"per_page": 10, "api_key": "YOUR_API_KEY"} response = requests.request("GET", url, params=querystring) print(response.text) ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/rust/reqwest-client.md' description: >- Call the APITube News API from Rust using the reqwest crate for asynchronous HTTP requests --- # Reqwest integration ```rust [dependencies] reqwest = "0.11" tokio = { version = "1", features = ["full"] } ``` ```rust use reqwest; #[tokio::main] async fn main() -> Result<(), reqwest::Error> { make_request().await?; Ok(()) } async fn make_request() -> Result<(), reqwest::Error> { let url = "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"; let response = reqwest::get(url).await?; match response.status().as_u16() { 200..=299 => { let body = response.text().await?; println!("Response: {}", body); } 400..=499 => { println!("Client Error: {}", response.status()); } 500..=599 => { println!("Server Error: {}", response.status()); } _ => { println!("HTTP Request Error: Unexpected status code: {}", response.status()); } } Ok(()) } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/groovy/rest-client.md' description: Call the APITube News API from Groovy using the HTTPBuilder RESTClient --- # RESTClient integration ```groovy @Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7.1') import groovyx.net.http.RESTClient import static groovyx.net.http.ContentType.JSON def client = new RESTClient("https://api.apitube.io") def response = client.get( path: "/v1/news/everything", query: [per_page: "50", api_key: "YOUR_API_KEY"], contentType: JSON ) println response.data ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/csharp/rest-client.md' description: Call the APITube News API from C# using RestSharp --- # RestClient integration ```cs // Install: dotnet add package RestSharp var client = new RestClient("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/everything.md' description: >- Search the APITube news archive with GET or POST /v1/news/everything. Find endpoint details, request examples, response format, limits and errors. --- # Search articles with `/v1/news/everything` Use `/v1/news/everything` to search the news archive. Filter by title, language, date, source, category, topic, industry, entity, sentiment, media, readability or location. You can sort results, browse pages, get counts by field, highlight matches and export data. Other article endpoints search a specific part of the same archive. 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/everything POST /v1/news/everything ``` Base URL: `https://api.apitube.io`. GET and POST return the same results. With `GET`, put filters in the URL. With `POST`, send them as JSON in the request body. Use POST for long values, such as a boolean `query` or a list of source IDs, to avoid URL length limits. Authenticate with the `X-API-Key` header, an `Authorization: Bearer` header, or the `api_key` query parameter — see [Authentication](/platform/news-api/authentication). ## Parameters All query and body parameters are optional. Without any filters the endpoint returns the most recent articles across all sources. See [Filters](/platform/news-api/filters) for the complete parameter reference: search filters, sorting, pagination, faceting, highlighting, field selection and export, with types, accepted values and examples. ## Response format Read articles from `results` and original article links from `href`. Use `next_page` and `previous_page` to navigate the results. [Response format](/platform/news-api/response-structure) describes the response envelope, article fields, facets, highlighting and export links. ## Request examples ### GET with query filters ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=bitcoin&language.code=en&published_at.start=NOW-7DAYS&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "bitcoin", "language.code": "en", "published_at.start": "NOW-7DAYS", "per_page": 10, }, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["published_at"], article["title"], article["href"]) ``` ```javascript [Node.js] const params = new URLSearchParams({ title: 'bitcoin', 'language.code': 'en', 'published_at.start': 'NOW-7DAYS', per_page: '10' }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); const data = await response.json(); for (const article of data.results) { console.log(article.published_at, article.title, article.href); } ``` ```php [PHP] $query = http_build_query([ 'title' => 'bitcoin', 'language.code' => 'en', 'published_at.start' => 'NOW-7DAYS', 'per_page' => 10, 'api_key' => 'YOUR_API_KEY', ]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/everything?$query"), true); foreach ($data['results'] as $article) { echo $article['published_at'], ' ', $article['title'], PHP_EOL; } ``` ```go [Go] package main import ( "encoding/json" "fmt" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "bitcoin") q.Set("language.code", "en") q.Set("published_at.start", "NOW-7DAYS") q.Set("per_page", "10") u.RawQuery = q.Encode() req, _ := http.NewRequest("GET", u.String(), nil) req.Header.Set("X-API-Key", "YOUR_API_KEY") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() var data map[string]any json.NewDecoder(resp.Body).Decode(&data) fmt.Println(data["results"]) } ``` ::: ### POST with a JSON body ```bash curl -X POST "https://api.apitube.io/v1/news/everything" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "bitcoin AND NOT (etf OR futures)", "language.code": "en", "published_at.start": "NOW-7DAYS", "sort.by": "published_at", "per_page": 50 }' ``` ### Excluding values 21 filters have an `ignore.*` version for excluding values. These cover titles, languages, sources, authors, categories, topics, industries, entity IDs and names, and event types. Combine them with other filters to include and exclude values in one request: ```bash curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&ignore.source.domain=example.com&api_key=YOUR_API_KEY" ``` ## Limits * `per_page` is capped by plan (Free 10, Starter 50, Basic 200, Professional and Corporate 250) and the Free plan cannot go past page 5 — see [Rate limits and quotas](/platform/news-api/rate-limits). * **Limits on lists of values:** most filters accept the first **3** values, including `source.domain`, `language.code`, `category.id`, `topic.id`, `industry.id`, `entity.id`, the `*.name` entity filters and their `ignore.*` versions. `event.type` and `article.id` accept **5**. Extra values are ignored without an error. For example, `source.domain=a.com,b.com,c.com,d.com` searches only the first three domains. Send another request for the rest. * The [`prompt`](/platform/news-api/ai/natural-language-search) parameter requires **Basic or above**; on Free and Starter it returns `403 ER0706`. Every other filter on this page works on every plan. * A title search (`title`, `title_starts_with`, `title_ends_with`, `title_pattern`, `query`) is limited to a **31-day** `published_at` window on every plan. A wider explicit range returns `400 ER0110`; no range at all searches the last 31 days and reports `ER0366` in `meta.warnings`. ## Errors Errors follow the shared format and codes documented in [HTTP response codes](/platform/news-api/http-response-codes). The ones you are most likely to hit here: | Code | Status | Meaning | |------|--------|---------| | `ER0110` | 400 | Title search requested over a window wider than 31 days | | `ER0171` | 400 | `per_page` above the plan ceiling | | `ER0173` | 400 | Page 6 or beyond on the Free plan | | `ER0179` | 400 | The same parameter passed twice | | `ER0175` | 401 | API key is missing or invalid | | `ER0176` | 402 | No points left on the account | | `ER0203` | 429 | Rate limit exceeded | | `ER0706` | 403 | `prompt` used on a plan below Basic | | `ER0701`–`ER0712` | 400 | Boolean `query` failed to parse | ## Related * [Count articles](/platform/news-api/count) — the same filters, returning only the total. * [Top headlines](/platform/news-api/top-headlines) — the same filters, narrowed to current headlines. * [Parameters reference](/platform/news-api/filters#parameters) — syntax, edge cases and workflow examples for every filter family. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/search-by-location.md description: Search for news articles by location. --- # Searching by Location ## Find news about one place {#search-articles-in-a-specific-location} Find news about Paris. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=Paris&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "Paris", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Paris", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Paris", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "Paris") 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) } ``` ```java [Java] 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/everything?location.name=Paris&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=Paris 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/everything ``` ::: ## Find news about several places {#search-articles-in-multiple-locations} Find news about London and Paris. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Paris&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Paris", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Paris") 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) } ``` ```java [Java] 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/everything?location.name=London,Paris&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Paris 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/everything ``` ::: ## Choose a location and language {#filter-by-location-and-language} Find English news about London and exclude Ontario. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London", "language.code": "en", "ignore.location.name": "Ontario", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London", "language.code" => "en", "ignore.location.name" => "Ontario", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London") q.Set("language.code", "en") q.Set("ignore.location.name", "Ontario") 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) } ``` ```java [Java] 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/everything?location.name=London&language.code=en&ignore.location.name=Ontario&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London&language.code=en&ignore.location.name=Ontario 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/everything ``` ::: ## Find geopolitical coverage {#geopolitical-event-analysis} Find geopolitical coverage about France and Italy. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "France,Italy", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "France,Italy", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "France,Italy") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=France,Italy&category.id=medtop:11000000&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Find business news about several places {#business-impact-analysis-across-multiple-locations} Find news about technology companies in London, Berlin and Paris. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Berlin,Paris", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft,Amazon", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Berlin,Paris", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft,Amazon", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Berlin,Paris") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft,Amazon") 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) } ``` ```java [Java] 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/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Berlin,Paris&category.id=medtop:04000000&organization.name=Google,Microsoft,Amazon 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/everything ``` ::: ## Find natural disaster coverage {#natural-disaster-coverage-analysis} Follow earthquake coverage in Japan and Israel. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Japan,Israel", "title": "earthquake", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Japan,Israel", "title" => "earthquake", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "Japan,Israel") q.Set("title", "earthquake") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=Japan,Israel&title=earthquake&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Find positive tourism coverage {#tourism-sentiment-analysis-by-location} Find positive tourism coverage about selected destinations. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "London,Paris,Berlin", "sentiment.overall.polarity": "positive", "sort.by": "published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "London,Paris,Berlin", "sentiment.overall.polarity" => "positive", "sort.by" => "published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "London,Paris,Berlin") q.Set("sentiment.overall.polarity", "positive") q.Set("sort.by", "published_at") 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) } ``` ```java [Java] 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/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=London,Paris,Berlin&sentiment.overall.polarity=positive&sort.by=published_at 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/everything ``` ::: ## Follow infrastructure development {#global-infrastructure-development-tracking} Follow infrastructure news in selected markets and industries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=India,Brazil&title=infrastructure,development,investment&category.id=medtop:04000000&sort.by=location.name,published_at&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "India,Brazil", "title": "infrastructure,development,investment", "category.id": "medtop:04000000", "sort.by": "location.name,published_at", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "India,Brazil", "title": "infrastructure,development,investment", "category.id": "medtop:04000000", "sort.by": "location.name,published_at", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "India,Brazil", "title" => "infrastructure,development,investment", "category.id" => "medtop:04000000", "sort.by" => "location.name,published_at", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "India,Brazil") q.Set("title", "infrastructure,development,investment") q.Set("category.id", "medtop:04000000") q.Set("sort.by", "location.name,published_at") 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) } ``` ```java [Java] 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/everything?location.name=India,Brazil&title=infrastructure,development,investment&category.id=medtop:04000000&sort.by=location.name,published_at&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=India,Brazil&title=infrastructure,development,investment&category.id=medtop:04000000&sort.by=location.name,published_at 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/everything ``` ::: ## Compare regional conflict coverage {#regional-conflict-media-coverage-analysis} Compare coverage of regional conflicts by source, language and sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?location.name=Ukraine,Israel&category.id=medtop:11000000&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "location.name": "Ukraine,Israel", "category.id": "medtop:11000000", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "location.name": "Ukraine,Israel", "category.id": "medtop:11000000", "language.code": "en", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["location.name" => "Ukraine,Israel", "category.id" => "medtop:11000000", "language.code" => "en", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("location.name", "Ukraine,Israel") q.Set("category.id", "medtop:11000000") q.Set("language.code", "en") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?location.name=Ukraine,Israel&category.id=medtop:11000000&language.code=en&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?location.name=Ukraine,Israel&category.id=medtop:11000000&language.code=en&sort.by=sentiment.overall.score 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/sentiment-examples.md description: Examples of using sentiment in News API --- # Sentiment Query Examples ## Find positive news {#getting-news-with-positive-sentiment} Find positive news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive 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/everything ``` ::: ## Find positive news by publisher country {#news-with-positive-sentiment-from-a-specific-country} Find positive news from publishers in Japan. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "source.country.code": "jp", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "source.country.code" => "jp", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("source.country.code", "jp") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&source.country.code=jp&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&source.country.code=jp 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/everything ``` ::: ## Find positive news by date {#positive-news-from-a-specific-date} Find positive news from a selected date. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&published_at.start=2026-03-07&published_at.end=2026-03-08&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "published_at.start": "2026-03-07", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "published_at.start": "2026-03-07", "published_at.end": "2026-03-08", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "published_at.start" => "2026-03-07", "published_at.end" => "2026-03-08", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("published_at.start", "2026-03-07") q.Set("published_at.end", "2026-03-08") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&published_at.start=2026-03-07&published_at.end=2026-03-08&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&published_at.start=2026-03-07&published_at.end=2026-03-08 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/everything ``` ::: ## Combine sentiment and title search {#articles-with-positive-sentiment-and-a-specific-topic} Find positive articles with "technology" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("title", "technology") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&title=technology 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/everything ``` ::: ## Filter several sentiment fields {#multidimensional-sentiment-analysis} Find strongly positive articles about selected organizations and categories. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "positive", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "positive", "category.id": "medtop:04000000", "organization.name": "Google,Microsoft", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "positive", "category.id" => "medtop:04000000", "organization.name" => "Google,Microsoft", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "positive") q.Set("category.id", "medtop:04000000") q.Set("organization.name", "Google,Microsoft") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=positive&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=positive&category.id=medtop:04000000&organization.name=Google,Microsoft&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Compare sentiment across markets {#comparative-sentiment-analysis-across-markets} Find negative health news from selected countries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sentiment.overall.polarity": "negative", "source.country.code": "us,gb,de", "category.id": "medtop:07000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sentiment.overall.polarity" => "negative", "source.country.code" => "us,gb,de", "category.id" => "medtop:07000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sentiment.overall.polarity", "negative") q.Set("source.country.code", "us,gb,de") q.Set("category.id", "medtop:07000000") 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) } ``` ```java [Java] 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/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sentiment.overall.polarity=negative&source.country.code=us,gb,de&category.id=medtop:07000000 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/everything ``` ::: ## Compare sentiment across sources {#analysis-of-sentiment-divergence-by-source-types} Compare sentiment in green energy coverage across sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Find sentiment in product reviews {#sentiment-analysis-in-product-reviews} Find sentiment in Apple product reviews. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=review&organization.name=Apple&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "review", "organization.name": "Apple", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "review", "organization.name": "Apple", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "review", "organization.name" => "Apple", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "review") q.Set("organization.name", "Apple") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?title=review&organization.name=Apple&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=review&organization.name=Apple&sort.by=sentiment.overall.score 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/everything ``` ::: ## Follow sentiment around market events {#sentiment-timeline-analysis-for-market-events} Follow changes in sentiment around financial news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=market,recession,financial&sort.by=published_at,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:04000000", "title": "market,recession,financial", "sort.by": "published_at,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:04000000", "title": "market,recession,financial", "sort.by": "published_at,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:04000000", "title" => "market,recession,financial", "sort.by" => "published_at,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:04000000") q.Set("title", "market,recession,financial") q.Set("sort.by", "published_at,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?category.id=medtop:04000000&title=market,recession,financial&sort.by=published_at,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&title=market,recession,financial&sort.by=published_at,sentiment.overall.score 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/ai/code-editors.md' description: >- Step-by-step MCP setup for Cursor, Claude Desktop, Claude Code, VS Code, and Windsurf using the hosted APITube MCP server. --- # Code Editors Setup Connect your editor to the [MCP Server](/platform/news-api/ai/mcp-server) to search news in your AI assistant. Use `https://mcp.apitube.io/` with an `Authorization: Bearer` header. The server supports HTTP JSON-RPC. ## Install in one click Paste your API key and choose your editor. For Cursor and VS Code, the button opens a link that adds the server configuration. For Claude Code, copy and run the terminal command. Cursor saves `apitube-news` in `~/.cursor/mcp.json`. VS Code saves it in your user `mcp.json`. For Claude Desktop and Windsurf, use the manual setup instructions below. ## Before you start 1. Get an API key at [apitube.io](https://apitube.io). 2. Replace `YOUR_API_KEY` in every config below with your key. 3. Restart the editor after saving the config. ::: tip The configs below use the hosted server directly. For clients that can only launch local (stdio) servers — like Claude Desktop — bridge the remote server with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote), as shown in that tab. ::: ## Configuration by editor ::: tabs \== Cursor Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (per project): ```json { "mcpServers": { "apitube-news": { "url": "https://mcp.apitube.io/", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Open **Settings → MCP** to confirm `apitube-news` is connected. \== Claude Code Add the server from the terminal: ```bash claude mcp add --transport http apitube-news https://mcp.apitube.io/ \ --header "Authorization: Bearer YOUR_API_KEY" ``` Or commit it to a project by adding `.mcp.json` to the repo root: ```json { "mcpServers": { "apitube-news": { "type": "http", "url": "https://mcp.apitube.io/", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Run `/mcp` inside Claude Code to check the connection. \== Claude Desktop Claude Desktop launches MCP servers as local processes, so bridge the remote server with `mcp-remote`. Edit `claude_desktop_config.json` (`~/Library/Application Support/Claude/` on macOS, `%APPDATA%\Claude\` on Windows): ```json { "mcpServers": { "apitube-news": { "command": "npx", "args": [ "-y", "mcp-remote", "https://mcp.apitube.io/", "--header", "Authorization: Bearer YOUR_API_KEY" ] } } } ``` Restart Claude Desktop; `apitube-news` appears under the tools (slider) icon. \== VS Code GitHub Copilot reads `.vscode/mcp.json` (per workspace). Use an input so the key is not stored in plain text: ```json { "inputs": [ { "type": "promptString", "id": "apitube-key", "description": "APITube API Key", "password": true } ], "servers": { "apitube-news": { "type": "http", "url": "https://mcp.apitube.io/", "headers": { "Authorization": "Bearer ${input:apitube-key}" } } } } ``` Open Copilot Chat in **Agent** mode and select the `apitube-news` tools. \== Windsurf Edit `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "apitube-news": { "serverUrl": "https://mcp.apitube.io/", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Open **Windsurf Settings → Cascade → MCP Servers** and refresh. ::: ## Verify it works After connecting, ask your assistant for news: ```text Find positive breaking news about Tesla in English from the last week ``` The assistant calls the `search_news` tool and returns matching articles. For the full filter set and troubleshooting, see the [MCP Server](/platform/news-api/ai/mcp-server) reference. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/sorting-examples.md description: Examples of using sorting parameters in News API --- # Sorting Query Examples ## Show oldest articles first {#sort-by-publication-date-in-ascending-order} Sort articles by publication date, oldest first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Show most positive articles first {#sort-by-sentiment-score-in-descending-order} Sort articles by sentiment score, most positive first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Combine source rank and sentiment {#multi-dimensional-content-ranking} Sort technology articles from highly ranked sources by sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: ## Show articles with the most images first {#media-rich-content-prioritization} Show technology and sports articles with the most images first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?media.images.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000,medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "media.images.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000,medtop:15000000", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "media.images.count": "1", "sort.by": "media.images.count", "sort.order": "desc", "category.id": "medtop:13000000,medtop:15000000", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["media.images.count" => "1", "sort.by" => "media.images.count", "sort.order" => "desc", "category.id" => "medtop:13000000,medtop:15000000", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("media.images.count", "1") q.Set("sort.by", "media.images.count") q.Set("sort.order", "desc") q.Set("category.id", "medtop:13000000,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) } ``` ```java [Java] 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/everything?media.images.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000,medtop:15000000&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?media.images.count=1&sort.by=media.images.count&sort.order=desc&category.id=medtop:13000000,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/everything ``` ::: ## Get event coverage in date order {#chronological-event-analysis} Get election coverage in date order. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=election&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "election", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "election", "category.id": "medtop:11000000", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "election", "category.id" => "medtop:11000000", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "election") q.Set("category.id", "medtop:11000000") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?title=election&category.id=medtop:11000000&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=election&category.id=medtop:11000000&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Sort by source rank {#source-quality-ranking} Sort AI articles by source rank. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=artificial intelligence&category.id=medtop:13000000&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "artificial intelligence", "category.id": "medtop:13000000", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "artificial intelligence", "category.id": "medtop:13000000", "sort.by": "source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "artificial intelligence", "category.id" => "medtop:13000000", "sort.by" => "source.rank.opr", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "artificial intelligence") q.Set("category.id", "medtop:13000000") q.Set("sort.by", "source.rank.opr") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?title=artificial intelligence&category.id=medtop:13000000&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=artificial intelligence&category.id=medtop:13000000&sort.by=source.rank.opr&sort.order=desc 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/everything ``` ::: ## Track sentiment over time {#sentiment-evolution-tracking} Get green energy articles in date order to track sentiment. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Sort company coverage by several fields {#multi-faceted-organization-perception-sorting} Sort articles about competing organizations using several fields. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?organization.name=Tesla,Google,Microsoft,Amazon&category.id=medtop:04000000&sort.by=organization.name,sentiment.overall.score,source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "organization.name": "Tesla,Google,Microsoft,Amazon", "category.id": "medtop:04000000", "sort.by": "organization.name,sentiment.overall.score,source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "organization.name": "Tesla,Google,Microsoft,Amazon", "category.id": "medtop:04000000", "sort.by": "organization.name,sentiment.overall.score,source.rank.opr", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["organization.name" => "Tesla,Google,Microsoft,Amazon", "category.id" => "medtop:04000000", "sort.by" => "organization.name,sentiment.overall.score,source.rank.opr", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("organization.name", "Tesla,Google,Microsoft,Amazon") q.Set("category.id", "medtop:04000000") q.Set("sort.by", "organization.name,sentiment.overall.score,source.rank.opr") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?organization.name=Tesla,Google,Microsoft,Amazon&category.id=medtop:04000000&sort.by=organization.name,sentiment.overall.score,source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?organization.name=Tesla,Google,Microsoft,Amazon&category.id=medtop:04000000&sort.by=organization.name,sentiment.overall.score,source.rank.opr&sort.order=desc 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/everything ``` ::: ## Sort regional coverage by several fields {#hierarchical-regional-news-prioritization} Sort news by region, topic and publication date. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.country.code=us,gb,de,fr&category.id=medtop:11000000&title=climate,energy,sustainability&sort.by=source.country.code,category.id,published_at&sort.order=asc,desc,desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.country.code": "us,gb,de,fr", "category.id": "medtop:11000000", "title": "climate,energy,sustainability", "sort.by": "source.country.code,category.id,published_at", "sort.order": "asc,desc,desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.country.code": "us,gb,de,fr", "category.id": "medtop:11000000", "title": "climate,energy,sustainability", "sort.by": "source.country.code,category.id,published_at", "sort.order": "asc,desc,desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.country.code" => "us,gb,de,fr", "category.id" => "medtop:11000000", "title" => "climate,energy,sustainability", "sort.by" => "source.country.code,category.id,published_at", "sort.order" => "asc,desc,desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("source.country.code", "us,gb,de,fr") q.Set("category.id", "medtop:11000000") q.Set("title", "climate,energy,sustainability") q.Set("sort.by", "source.country.code,category.id,published_at") q.Set("sort.order", "asc,desc,desc") 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) } ``` ```java [Java] 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/everything?source.country.code=us,gb,de,fr&category.id=medtop:11000000&title=climate,energy,sustainability&sort.by=source.country.code,category.id,published_at&sort.order=asc,desc,desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?source.country.code=us,gb,de,fr&category.id=medtop:11000000&title=climate,energy,sustainability&sort.by=source.country.code,category.id,published_at&sort.order=asc,desc,desc 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/source-examples.md description: Examples of using sources in News API --- # Source Query Examples ## Choose one source {#getting-news-from-a-specific-source} Find articles from The Guardian. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Choose several sources {#news-from-multiple-sources} Find articles from The Guardian and The New York Times. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Choose a source and language {#filtering-by-source-and-language} Find Fox News articles in English. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.domain=foxnews.com&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.domain": "foxnews.com", "language.code": "en", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.domain": "foxnews.com", "language.code": "en", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.domain" => "foxnews.com", "language.code" => "en", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("source.domain", "foxnews.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) } ``` ```java [Java] 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/everything?source.domain=foxnews.com&language.code=en&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?source.domain=foxnews.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/everything ``` ::: ## Filter by source rank {#filtering-by-source-rating} Set minimum and maximum source-rank filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.9&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "source.rank.opr.min": "0.5", "source.rank.opr.max": "0.9", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "source.rank.opr.min": "0.5", "source.rank.opr.max": "0.9", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["source.rank.opr.min" => "0.5", "source.rank.opr.max" => "0.9", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("source.rank.opr.min", "0.5") q.Set("source.rank.opr.max", "0.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) } ``` ```java [Java] 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/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.9&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.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/everything ``` ::: ## Compare coverage across regions {#cross-regional-media-bias-analysis} Compare green energy coverage across publisher countries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us,de,gb&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news", "source.country.code" => "us,de,gb", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news") q.Set("source.country.code", "us,de,gb") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news&source.country.code=us,de,gb&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us,de,gb&sort.by=sentiment.overall.score 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/everything ``` ::: ## Compare political coverage by source bias {#political-news-comparison-across-ideological-spectrums} Compare political coverage from left- and right-leaning sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&source.domain=nytimes.com,foxnews.com,theguardian.com&title=election,president,congress&sort.by=source.domain&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:11000000", "source.domain": "nytimes.com,foxnews.com,theguardian.com", "title": "election,president,congress", "sort.by": "source.domain", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:11000000", "source.domain": "nytimes.com,foxnews.com,theguardian.com", "title": "election,president,congress", "sort.by": "source.domain", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:11000000", "source.domain" => "nytimes.com,foxnews.com,theguardian.com", "title" => "election,president,congress", "sort.by" => "source.domain", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:11000000") q.Set("source.domain", "nytimes.com,foxnews.com,theguardian.com") q.Set("title", "election,president,congress") q.Set("sort.by", "source.domain") 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) } ``` ```java [Java] 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/everything?category.id=medtop:11000000&source.domain=nytimes.com,foxnews.com,theguardian.com&title=election,president,congress&sort.by=source.domain&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:11000000&source.domain=nytimes.com,foxnews.com,theguardian.com&title=election,president,congress&sort.by=source.domain 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/everything ``` ::: ## Compare regional technology coverage {#regional-technology-coverage-comparison} Compare technology coverage across publisher regions. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&source.country.code=us,gb,in,de&title=artificial intelligence,machine learning,robotics&sort.by=source.country.code&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "category.id": "medtop:13000000", "source.country.code": "us,gb,in,de", "title": "artificial intelligence,machine learning,robotics", "sort.by": "source.country.code", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "category.id": "medtop:13000000", "source.country.code": "us,gb,in,de", "title": "artificial intelligence,machine learning,robotics", "sort.by": "source.country.code", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["category.id" => "medtop:13000000", "source.country.code" => "us,gb,in,de", "title" => "artificial intelligence,machine learning,robotics", "sort.by" => "source.country.code", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("category.id", "medtop:13000000") q.Set("source.country.code", "us,gb,in,de") q.Set("title", "artificial intelligence,machine learning,robotics") q.Set("sort.by", "source.country.code") 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) } ``` ```java [Java] 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/everything?category.id=medtop:13000000&source.country.code=us,gb,in,de&title=artificial intelligence,machine learning,robotics&sort.by=source.country.code&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&source.country.code=us,gb,in,de&title=artificial intelligence,machine learning,robotics&sort.by=source.country.code 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/everything ``` ::: ## Choose sources for industry news {#specialized-industry-source-analysis} Find cryptocurrency news from selected sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum,blockchain&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.crypto_news", "title": "Bitcoin,Ethereum,blockchain", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "title": "Bitcoin,Ethereum,blockchain", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "title" => "Bitcoin,Ethereum,blockchain", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.crypto_news") q.Set("title", "Bitcoin,Ethereum,blockchain") q.Set("sort.by", "sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum,blockchain&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum,blockchain&sort.by=sentiment.overall.score&sort.order=desc 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/sse-stream.md' description: >- Receive matching news articles over one open HTTP connection with Server-Sent Events (SSE). --- # SSE Stream Open one HTTP connection to receive new matching articles with SSE (Server-Sent Events). The API sends articles as they become available, so you do not need to check for updates repeatedly. > Articles arrive when they become available in APITube. They may have been published earlier. See [Delivery Order and Freshness](#delivery-order-and-freshness) to receive only recent articles. ## What is SSE Stream? [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) keep an HTTP connection open so a server can send updates. Each update on this stream contains a news article. **Use cases:** * Live news feeds and dashboards * Real-time monitoring for specific topics, entities, or sentiment * Breaking news alerts * Applications that process incoming articles **Benefits:** * Receive articles as soon as they become available, without repeated search requests * Uses standard SSE protocol — works in any language * Reconnect with `Last-Event-ID` to receive articles missed during a disconnection * All `/everything` filters supported — language, category, sentiment, entities, and more * Field selection with `fl` parameter to keep responses smaller ## Endpoint ```http GET https://api.apitube.io/v1/news/stream ``` ## Authentication Pass your API key in one of two ways: * **Header** (recommended): `X-API-Key: YOUR_API_KEY` * **Query parameter**: `?api_key=YOUR_API_KEY` Without a valid API key the server returns HTTP `401`. ## Quick Start ### cURL ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en" ``` The `-N` flag disables buffering so events appear in real time. ### JavaScript (Browser) ```javascript const es = new EventSource( 'https://api.apitube.io/v1/news/stream?api_key=YOUR_API_KEY&language.code=en' ); es.addEventListener('article', (e) => { const article = JSON.parse(e.data); console.log(`[${e.lastEventId}]`, article.title); }); es.addEventListener('error', (e) => { if (e.data) { console.error('Server error:', JSON.parse(e.data)); } }); // To disconnect: // es.close(); ``` ### Node.js ```javascript import EventSource from 'eventsource'; const es = new EventSource( 'https://api.apitube.io/v1/news/stream?language.code=en', { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); es.addEventListener('article', (e) => { const article = JSON.parse(e.data); console.log(`[${e.lastEventId}]`, article.title); }); es.addEventListener('error', (e) => { if (e.data) { console.error('Server error:', JSON.parse(e.data)); } }); ``` :::tip The `eventsource` npm package supports custom headers, which makes it the recommended choice for Node.js. ::: ### Python ```python import requests url = 'https://api.apitube.io/v1/news/stream' headers = {'X-API-Key': 'YOUR_API_KEY'} params = {'language.code': 'en'} with requests.get(url, headers=headers, params=params, stream=True) as r: for line in r.iter_lines(decode_unicode=True): if line: print(line) ``` ## SSE Event Format The stream uses standard SSE format with three event types: ### `article` — New Article ```text event: article id: 123456 data: {"id":123456,"title":"...","source":{...},...} ``` * `event: article` — event type * `id:` — article ID (used for reconnection) * `data:` — full article JSON in the same format as the [/everything](/platform/news-api/endpoints) endpoint ### `error` — Server Error ```text event: error data: {"code":"ER0301","message":"Balance exhausted"} ``` The API sends an error event when a problem occurs, such as an exhausted balance, then closes the connection. Possible error codes: | Code | Meaning | |------|---------| | `ER0301` | Streaming credits and pay-as-you-go balance are both exhausted. | | `ER0177` | The monthly [pay-as-you-go spending limit](/platform/news-api/rate-limits#pay-as-you-go-spending-limit) was reached while the stream was billing to your balance. | | `ER0361` | The API key was revoked while the stream was open. | | `ER0362` | The 6-hour connection lifetime was reached — reconnect (with `Last-Event-ID` to resume). | | `ER0364` | The session was force-closed through the [terminate endpoint](#managing-active-sessions). | ### Heartbeat ```text : heartbeat ``` The server sends an SSE comment every 30 seconds to keep the connection open. This message has no event name. ## Filtering All filters available on the [/everything](/platform/news-api/endpoints) endpoint work with SSE Stream: **By language:** ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en" ``` **By category:** ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?category.id=medtop:13000000" ``` **By source:** ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?source.domain=theverge.com" ``` **Multiple filters:** ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en&category.id=medtop:13000000&sentiment.overall.polarity=positive" ``` **In plain language:** ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?prompt=breaking%20technology%20news%20in%20English" ``` Use [`prompt`](/platform/news-api/filters#prompt) to describe your filters in plain language. It requires **Basic or above**; Free and Starter return `403 ER0706`. An invalid prompt returns `400 ER0800`/`ER0802` before the stream opens. To inspect the chosen filters, try the prompt on `/v1/news/everything` first: SSE does not return `meta.prompt`. A new translation costs 2 points per connection; cached translations are free. For the full list of available filters, see [Parameters](/platform/news-api/filters#parameters). ## Field Selection Use `fl` to receive only the fields you need and keep responses smaller: ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en&fl=id,title,source.domain" ``` The `data:` object contains only the fields you selected. ## Delivery Order and Freshness Articles arrive as they become available in the API. Within each batch, they are ordered by `published_at`, oldest first. Some may have been published earlier; use date or age filters to receive only recent news. * **`published_at`** is the original publication time when available. Otherwise, it shows when the article became available in APITube. * **Delivery time** varies by article and publisher. An article may reach the stream after its original publication time. ### Skip older articles {#dropping-stale-backfill-articles} Use either of these filters to exclude older articles from delivery and billing: * **`stream.max_age`** sets the maximum article age in **minutes**. At each check, the stream sends only articles published in the last N minutes. Older articles are excluded before delivery and billing. Use this for a feed of recent news: ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en&stream.max_age=15" ``` An invalid value (non-integer or less than 1) is rejected on connect with `400 ER0363`. * **`published_at.start`** excludes articles published before the date and time you set: ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream?language.code=en&published_at.start=2026-07-03T10:00:00" ``` Use `source.rank.opr.min` (Open PageRank) or `is_premium_source` to select sources. These filters do not sort the stream by source priority. See [Parameters](/platform/news-api/filters#parameters). ## Reconnection with Last-Event-ID SSE has built-in reconnection support. If the connection drops, the client can resume from where it left off using the `Last-Event-ID` header: 1. Connect and receive articles — each has a unique `id:` 2. Connection drops (network issue, server restart, etc.) 3. Reconnect with the last received ID: ```bash curl -N -H "X-API-Key: YOUR_API_KEY" \ -H "Last-Event-ID: 123456" \ "https://api.apitube.io/v1/news/stream?language.code=en" ``` The server will immediately deliver any articles indexed after ID `123456`, then continue streaming new ones. :::tip The browser's `EventSource` reconnects automatically and sends `Last-Event-ID` to resume after the last received event. ::: ## Parameters | Parameter | Description | |-----------|-------------| | `api_key` | API key (alternative to `X-API-Key` header) | | `fl` | Field selection (e.g., `id,title,source.domain`) | | `stream.max_age` | Maximum article age in **minutes**. Only articles published within the last N minutes are delivered and billed. An invalid value returns `400 ER0363`. | | All `/everything` filters | `language.code`, `category.id`, `source.domain`, `sentiment.overall.polarity`, `title`, `organization.name`, and [more](/platform/news-api/everything) | ## Technical Details | Property | Value | |----------|-------| | Poll interval | Every 30 seconds | | Heartbeat interval | Every 30 seconds | | Articles per poll cycle | Up to 50 | | Delivery order | Within each batch, articles arrive in `published_at` order, oldest first. Articles are tracked by ID to avoid missing or repeating deliveries. | | Maximum article age | Set `stream.max_age` in minutes to exclude older articles before delivery and billing. | | Billing | 1 credit per delivered article | | Reconnection | Via `Last-Event-ID` header | | Response header | `X-Accel-Buffering: no` | ## Concurrent Connections Your plan limits how many SSE connections you can keep open at the same time: | Plan | Max concurrent SSE connections | |------|-------------------------------| | Free | 1 | | Starter | 2 | | Basic | 2 | | Professional | 10 | | Corporate | 50 | On **Free**, you can open **1** SSE connection with 1,000 deliveries per day. Article text is a preview; links, images, descriptions and other fields are full. Articles arrive with a **12-hour delay**. Paid plans include full text and more connections: Starter 2, Basic 2, Professional 10 and Corporate 50. Opening more connections than your plan allows returns HTTP `429` with error code `ER0360`: ```json { "status": "not_ok", "errors": [ { "status": 429, "code": "ER0360", "message": "Maximum SSE connections (10) reached for your plan." } ] } ``` Closing a connection frees one of your allowed sessions. After a crash or forced shutdown, the API may still count the session for a while. If a restart returns `ER0360`, close the old session with the [session-management endpoint](#managing-active-sessions) or replace your API key to close its sessions. ### Connections left open after a client stops {#zombie-connections} SSE does not exchange ping/pong messages with your application. The API may therefore take time to detect that a client has disconnected: * On an active feed, the API closes the connection if the client stops reading articles. * On a quiet feed, the API may keep counting the session until it detects the disconnect or the 6-hour limit ends (`ER0362`). Revoking the key (`ER0361`) or closing the session with the [terminate endpoint](#managing-active-sessions) (`ER0364`) also frees the connection. To free the session immediately, call `DELETE /v1/news/stream/sessions` or replace the API key to close its sessions. ## Managing Active Sessions Use these two free endpoints to list active SSE sessions and close any you no longer need, without replacing your API key. ### List active sessions ```http GET https://api.apitube.io/v1/news/stream/sessions ``` Returns every SSE session currently open under your account: ```json { "count": 2, "sessions": [ { "session_id": "req-a1b2c3", "api_key_id": 42, "started_at": "2026-07-03T10:11:04.512Z" }, { "session_id": "req-d4e5f6", "api_key_id": 42, "started_at": "2026-07-03T10:11:05.973Z" } ] } ``` ### Terminate sessions ```http DELETE https://api.apitube.io/v1/news/stream/sessions ``` Force-closes your active SSE sessions and returns the number closed. Each closed client receives an `error` event with code `ER0364` and the connection ends: ```json { "terminated": 2 } ``` Use optional query parameters to choose which sessions to close: * `?session_id=` — close only that one session (id from the list endpoint) * `?api_key_id=` — close only sessions opened by that specific key ```bash # Before a scheduled restart: drop every open SSE session for the account curl -X DELETE -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/news/stream/sessions" ``` Authenticate both endpoints with your API key. If the key has endpoint restrictions, it must allow `stream`. You can manage only sessions belonging to that key's account. ## Billing Each article delivered through the stream costs **1 credit**. Credits are deducted in real time as articles arrive — not when you open the connection. **How it works:** 1. When you connect, the server checks your balance. If you have no credits and no paid balance, the connection is rejected with HTTP `402` and error code `ER0176`. 2. While the stream is active, 1 credit is deducted per article sent to you. 3. If your balance runs out mid-stream, the server sends an `error` event with code `ER0301` ("Balance exhausted") and closes the connection. **Credit source priority:** * If you have available plan credits (points), they are used first. * If plan credits are exhausted and you have a positive paid balance, the paid balance is used instead. The stream connection responds with the standard SSE headers only (`Content-Type: text/event-stream`, `Cache-Control: no-cache`, `Connection: keep-alive`, `X-Accel-Buffering: no`). It does **not** return billing state in response headers. To check your remaining plan credits and paid balance, call [`GET /v1/balance`](/platform/news-api/endpoints) separately. :::tip The stream does not charge for heartbeats or the connection itself — only for actual articles delivered. If no articles match your filters, no credits are spent. ::: ### Deduplication and parallel streams Each connection is billed separately. If the same article matches several of your streams, you pay for each delivery. Removing duplicates in your application does not change those charges. Reprints from different publishers may arrive as separate articles and are billed separately. Use one stream where possible, or choose filters that do not overlap. In your application, use article `id` or `href` to identify duplicates. ## Error Handling ### Insufficient Balance If your account has no credits and no paid balance, the server rejects the connection with HTTP `402`: ```json { "status": "not_ok", "request_id": "fecf47d8-c90c-4c48-bdf0-bc34f6d41415", "errors": [ { "status": 402, "code": "ER0176", "message": "You have no SSE points on your account.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2025-05-11T17:02:46Z" } ] } ``` Top up your balance or wait for plan credits to renew before reconnecting. ### Invalid or Missing API Key Returns a standard HTTP `401` JSON error response (not SSE): ```bash curl -N -H "X-API-Key: invalid" \ "https://api.apitube.io/v1/news/stream" ``` ```json { "status": "not_ok", "request_id": "fecf47d8-c90c-4c48-bdf0-bc34f6d41415", "errors": [ { "status": 401, "code": "ER0202", "message": "Invalid API key.", "links": { "about": "https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp": "2025-05-11T17:02:46Z" } ] } ``` A missing API key returns the same response format with code `ER0201` (`API key is required. Provide it via X-API-Key header or api_key query parameter.`). ### Balance Exhausted If your balance runs out during an active stream, the server sends an error event and closes the connection: ```text event: error data: {"code":"ER0301","message":"Balance exhausted"} ``` ### Session Terminated When you close a session with the [terminate endpoint](#managing-active-sessions) or replace its API key, the client receives an error event and the connection ends: ```text event: error data: {"code":"ER0364","message":"SSE session terminated by API"} ``` Reconnect to resume streaming; pass `Last-Event-ID` to continue from the last article you received. ## Next Steps * Learn about all available [Parameters](/platform/news-api/filters#parameters) * Explore [common workflow examples](/platform/news-api/common-workflows/getting-started) * Check [Authentication](/platform/news-api/authentication) options * See [HTTP Response Codes](/platform/news-api/http-response-codes) for error handling ## Support If you encounter issues: 1. Check the [Technical FAQ](/platform/news-api/technical-faq) 2. Verify your API key on [apitube.io](https://apitube.io) 3. Contact support through the APITube website --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/zig/http-client.md' description: Call the APITube News API from Zig using the standard library HTTP client --- # std.http integration ```zig const std = @import("std"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); var client = std.http.Client{ .allocator = allocator }; defer client.deinit(); const uri = std.Uri.parse("https://api.apitube.io/v1/news/everything?per_page=50&api_key=YOUR_API_KEY") catch unreachable; var header_buf: [4096]u8 = undefined; var req = try client.open(.GET, uri, .{ .server_header_buffer = &header_buf }); defer req.deinit(); try req.send(); try req.wait(); const body = try req.reader().readAllAlloc(allocator, 1024 * 1024); defer allocator.free(body); const stdout = std.io.getStdOut().writer(); try stdout.print("{s}\n", .{body}); } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/suggest/categories.md' description: Autocomplete search for categories by name prefix --- # Suggest Categories Send the beginning of a category name to `/v1/suggest/categories`. Use the returned `id` in the `category.id` filter, or show the matches as suggestions in a search box. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/suggest/categories ``` The response lists categories whose names start with your text. ## Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prefix` | string | Yes | The name prefix to search for. Minimum 1 character. | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ## Response Format The response is an array of categories: ```json [ { "id": "medtop:15000000", "name": "string", "taxonomy": "string", "links": { "self": "string" } } ] ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `id` | string | Category ID, an IPTC Media Topic code such as `medtop:15000000`. Use it unchanged in the `category.id` filter. | | `name` | string | Category name | | `taxonomy` | string | Category taxonomy (e.g. `iptc_mediatopics`) | | `links.self` | string | URL to get news articles in this category (`/v1/news/category/{taxonomy}/{id}`) | ## Request Examples ### Using query parameter ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/suggest/categories?prefix=sport&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/suggest/categories", params={"prefix": "sport", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ prefix: "sport", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/suggest/categories?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["prefix" => "sport", "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/suggest/categories?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/suggest/categories") q := u.Query() q.Set("prefix", "sport") 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) } ``` ```java [Java] 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/suggest/categories?prefix=sport&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/suggest/categories?prefix=sport 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/everything ``` ::: ### Using header authentication ```shell curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/categories?prefix=politic" ``` ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/categories?prefix=econom" ``` ## Response Example ```json [ { "id": "medtop:04000000", "name": "economy, business and finance", "taxonomy": "iptc_mediatopics", "links": { "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:04000000" } } ] ``` ## Error Responses ### Missing or Invalid API Key ```json { "errors": [ { "code": "ER0201", "message": "API key is required. Provide it via X-API-Key header or api_key query parameter." } ] } ``` **Status Code:** 401 ### Missing Prefix Parameter ```json { "errors": [ { "code": "ER0346", "message": "`Prefix` in query required." } ] } ``` **Status Code:** 400 --- --- url: 'https://docs.apitube.io/platform/news-api/suggest/entities.md' description: Autocomplete search for entities by name prefix --- # Suggest Entities Send the beginning of a person, company or other entity name to `/v1/suggest/entities`. Use the matches to suggest names in a search box. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/suggest/entities ``` Matches include an ID, type, name, and Wikipedia and Wikidata links. ## Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prefix` | string | Yes | The name prefix to search for. Minimum 1 character. | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ## Response Format The response is an array of entities: ```json [ { "id": 0, "name": "string", "type": "string", "links": { "self": "string", "wikipedia": "string", "wikidata": "string" }, "metadata": {} } ] ``` ### Entity Types Entities can be one of the following types: * `person` - Individual people * `location` - Geographic locations * `organization` - Companies, institutions, and organizations * `brand` - Commercial brands * `product` - Products and services * `natural-disaster` - Natural disasters and catastrophic events * `disease` - Diseases and medical conditions * `event` - Notable events * `sport` - Sports * `unknown` - Type could not be determined ### Response Fields | Field | Type | Description | |-------|------|-------------| | `id` | integer | Unique identifier for the entity | | `name` | string | Name of the entity | | `type` | string | Type of entity (see Entity Types above) | | `links.self` | string | URL to get news articles about this entity | | `links.wikipedia` | string | Wikipedia page URL (if available) | | `links.wikidata` | string | Wikidata page URL (if available) | | `metadata` | object | Additional metadata about the entity (varies by entity type) | ## Request Examples ### Using query parameter ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/suggest/entities?prefix=elon&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/suggest/entities", params={"prefix": "elon", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ prefix: "elon", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/suggest/entities?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["prefix" => "elon", "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/suggest/entities?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/suggest/entities") q := u.Query() q.Set("prefix", "elon") 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) } ``` ```java [Java] 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/suggest/entities?prefix=elon&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/suggest/entities?prefix=elon 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/everything ``` ::: ### Using header authentication ```shell curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/entities?prefix=tesla" ``` ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/entities?prefix=apple" ``` ## Response Example ```json [ { "id": 123, "name": "Apple Inc.", "type": "organization", "links": { "self": "https://api.apitube.io/v1/news/entity/123", "wikipedia": "https://en.wikipedia.org/wiki/Apple_Inc.", "wikidata": "https://www.wikidata.org/wiki/Q312" }, "metadata": { "headquarters": { "city": "Cupertino", "country": "United States" }, "founded": "1976", "industry": "Technology" } }, { "id": 500, "name": "Apple", "type": "product", "links": { "self": "https://api.apitube.io/v1/news/entity/500", "wikipedia": "https://en.wikipedia.org/wiki/Apple", "wikidata": "https://www.wikidata.org/wiki/Q89" }, "metadata": {} } ] ``` ## Error Responses ### Missing API Key ```json { "errors": [ { "code": "ER0201", "message": "API key is required. Provide it via X-API-Key header or api_key query parameter." } ] } ``` **Status Code:** 401 ### Invalid API Key ```json { "errors": [ { "code": "ER0202", "message": "API key is invalid." } ] } ``` **Status Code:** 401 ### Missing Prefix Parameter ```json { "errors": [ { "code": "ER0346", "message": "`Prefix` in query required." } ] } ``` **Status Code:** 400 --- --- url: 'https://docs.apitube.io/platform/news-api/suggest/industries.md' description: Autocomplete search for industries by name prefix --- # Suggest Industries Send the beginning of an industry name to `/v1/suggest/industries`. Use the returned `id` in the `industry.id` filter, or show the matches as suggestions in a search box. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/suggest/industries ``` The response lists industries whose names start with your text. ## Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prefix` | string | Yes | The name prefix to search for. Minimum 1 character. | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ## Response Format The response is an array of industries: ```json [ { "id": 0, "name": "string", "links": { "self": "string" } } ] ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `id` | integer | Industry ID. Use it directly in the `industry.id` filter. | | `name` | string | Industry name | | `links.self` | string | URL to get news articles in this industry (`/v1/news/industry/{id}`) | ## Request Examples ### Using query parameter ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/suggest/industries?prefix=tech&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/suggest/industries", params={"prefix": "tech", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ prefix: "tech", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/suggest/industries?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["prefix" => "tech", "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/suggest/industries?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/suggest/industries") q := u.Query() q.Set("prefix", "tech") 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) } ``` ```java [Java] 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/suggest/industries?prefix=tech&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/suggest/industries?prefix=tech 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/everything ``` ::: ### Using header authentication ```shell curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/industries?prefix=finance" ``` ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/industries?prefix=health" ``` ## Response Example ```json [ { "id": 70, "name": "Livestock Health Services for Agricultural", "links": { "self": "https://api.apitube.io/v1/news/industry/70" } } ] ``` ## Error Responses ### Missing or Invalid API Key ```json { "errors": [ { "code": "ER0201", "message": "API key is required. Provide it via X-API-Key header or api_key query parameter." } ] } ``` **Status Code:** 401 ### Missing Prefix Parameter ```json { "errors": [ { "code": "ER0346", "message": "`Prefix` in query required." } ] } ``` **Status Code:** 400 --- --- url: 'https://docs.apitube.io/platform/news-api/suggest/topics.md' description: Autocomplete search for topics by name prefix --- # Suggest Topics Send the beginning of a topic name to `/v1/suggest/topics`. Use the returned `id` in the `topic.id` filter, or show the matches as suggestions in a search box. Sign up at [APITube](https://apitube.io) to get your API key. Include it with every API request. ## Endpoint ``` GET /v1/suggest/topics ``` The response lists topics whose names start with your text. ## Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prefix` | string | Yes | The name prefix to search for. Minimum 1 character. | | `api_key` | string | Yes\* | Your API key. Can also be provided via headers. | \* Required if not provided in headers ## Response Format The response is an array of topics: ```json [ { "id": "string", "name": "string", "links": { "self": "string" } } ] ``` ### Response Fields | Field | Type | Description | |-------|------|-------------| | `id` | string | Topic ID, such as `industry.aerospace_news`. Pass it to the `topic.id` filter. | | `name` | string | Topic name | | `links.self` | string | URL to get news articles on this topic (`/v1/news/topic/{id}`) | ## Request Examples ### Using query parameter ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/suggest/topics?prefix=election&api_key=YOUR_API_KEY" ``` ```python [Python] import requests resp = requests.get( "https://api.apitube.io/v1/suggest/topics", params={"prefix": "election", "api_key": "YOUR_API_KEY"}, ) print(resp.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ prefix: "election", api_key: "YOUR_API_KEY" }); const resp = await fetch(`https://api.apitube.io/v1/suggest/topics?${params}`); console.log(await resp.json()); ``` ```php [PHP] $query = http_build_query(["prefix" => "election", "api_key" => "YOUR_API_KEY"]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/suggest/topics?$query"), true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/suggest/topics") q := u.Query() q.Set("prefix", "election") 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) } ``` ```java [Java] 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/suggest/topics?prefix=election&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/suggest/topics?prefix=election 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/everything ``` ::: ### Using header authentication ```shell curl -H "X-API-Key: YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/topics?prefix=climate" ``` ### Using Bearer token ```shell curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.apitube.io/v1/suggest/topics?prefix=crypto" ``` ## Response Example ```json [ { "id": "industry.crypto_news", "name": "Crypto Industry News", "links": { "self": "https://api.apitube.io/v1/news/topic/industry.crypto_news" } } ] ``` ## Error Responses ### Missing or Invalid API Key ```json { "errors": [ { "code": "ER0201", "message": "API key is required. Provide it via X-API-Key header or api_key query parameter." } ] } ``` **Status Code:** 401 ### Missing Prefix Parameter ```json { "errors": [ { "code": "ER0346", "message": "`Prefix` in query required." } ] } ``` **Status Code:** 400 --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/php/symfony-framework.md description: Call the APITube News API from Symfony PHP using the HttpClient component --- # Symfony integration ```php request('GET', $url); $statusCode = $response->getStatusCode(); $content = $response->getContent(); if ($statusCode >= 400) { return new Response("HTTP Request Error: " . $statusCode); } return new Response($content); } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/technical-faq.md' description: Answers to frequently asked technical questions about working with APITube --- # Technical Questions and Answers ## General Questions ### How do I check the number of remaining requests? Read the response headers to see how many requests you can still send: ``` X-RateLimit-Limit: 100 X-RateLimit-Remaining: 95 X-RateLimit-Reset: 32 ``` * `X-RateLimit-Limit`: Total request limit * `X-RateLimit-Remaining`: Number of remaining requests * `X-RateLimit-Reset`: The number of seconds remaining until the rate limit resets ### How many articles can I get in one request? The `per_page` parameter controls how many articles are returned per page: * **Default**: 100 articles per page * **Maximum**: 250 articles per page, or 200 on Basic, 50 on Starter and 10 on Free — requesting more returns `400 ER0171` (`Limit is out of range. Your plan allows up to N results per page.`) To get more results within your plan's limits, request the next page with `page` and `per_page`. **Free plan pagination limit**: on the free plan you can only access the first **5 pages** of results. Requesting `page=6` or higher returns `400 ER0173`. Upgrade to a paid plan to paginate beyond the first 5 pages. ### How long are news articles stored in the system? APITube stores news articles for 365 days from the publication date. After this period, articles are archived and not available through the general API. To access archived articles, contact our support service. You can access the full 365 days, but a **title search** can cover at most 31 days per request. Use `published_at.start` and `published_at.end` to search one range at a time. A wider title-search range returns `400 ER0110`; see [Search window limit](/platform/news-api/everything#limits). Searches by `category.id`, `entity.id` or `source.domain` can cover all 365 days if they do not include a title search. ## Authentication ### What should I do if the API key doesn't work? If your API key doesn't work: 1. Copy the API key without extra spaces 2. Check that the `X-API-Key` header is written correctly (case-sensitive) 3. Make sure the key has not expired 4. Check your account balance and limits 5. Generate a new key in your APITube account ### Can I use one API key for multiple applications? Yes. Separate keys make it easier to manage access for each application. ### How do I update or replace an API key? To update or replace an API key: 1. Log in to your account at [APITube](https://apitube.io/dashboard) 2. Go to "Settings" → "API keys" 3. Click "Generate new key" 4. Update the key in your application ## Requests and Filtering ### How do I use several filters at once? {#how-do-i-use-multiple-filters-simultaneously} Combine filters in one request. For example: ``` https://api.apitube.io/v1/news/everything?title=technology&language.code=en&category.id=medtop:20000002&published_at.start=NOW-7DAYS ``` This request will return articles about technology in English in the "Technology" category, published in the last 7 days. Because it searches the title, the `published_at` window may not exceed 31 days — see [Search window limit](/platform/news-api/everything#limits). ### What search operators does the query parameter support? The `query` parameter supports the following operators: * Logical AND: `technology AND innovation` * Logical OR: `technology OR innovation` * Logical NOT: `technology NOT blockchain` * Grouping: `(technology OR innovation) AND (AI OR "artificial intelligence")` * Phrases: `"artificial intelligence"` * Word root search: `technolog*` (will find "technology", "technologies", "technological", etc.) ### How do I find articles for a specific time period? To search for articles for a specific period, use the `published_at.start` and `published_at.end` parameters: ``` https://api.apitube.io/v1/news/everything?published_at.start=2025-01-01&published_at.end=2025-01-31 ``` This request will return articles published in January 2025. ### Can I search for articles in several languages at once? {#can-i-search-for-articles-in-multiple-languages-simultaneously} Yes, you can specify multiple languages by separating them with commas: ``` https://api.apitube.io/v1/news/everything?language.code=en,fr,de ``` This request will return articles in English, French, and German. ## Integration and Development ### What is the maximum API response size? There is no fixed response-size limit. Responses grow with the number of articles and fields you request. Article text and entity details can make them large. Use [`fl`](/platform/news-api/everything) to request only the fields you need. For example, `fl=id,title,href` leaves out article text and other large fields. Reduce `per_page` if responses are still too large. ### How do I handle API errors? Always check the HTTP response code and status in the JSON response. When an error occurs, the API returns a `not_ok` status and error details: ```json { "status":"not_ok", "request_id":"fecf47d8-c90c-4c48-bdf0-bc34f6d41415", "errors":[ { "code":401, "message":"API key is invalid or missing", "links": { "about":"https://docs.apitube.io/platform/news-api/http-response-codes" }, "timestamp":"2025-05-11T17:02:46Z" } ], "user_input":null } ``` Implement error handling in your code, for example: ```javascript try { const response = await axios.get('https://api.apitube.io/v1/news/everything', { params: { /* params */ }, headers: { 'X-API-Key': API_KEY } }); if (response.data.status === 'ok') { // Process successful response } else { // Handle error console.error(`API Error: ${response.data.message}`); } } catch (error) { // Handle network or other exceptions console.error(`Request error: ${error.message}`); } ``` ### How do I optimize API usage to save requests? To use fewer requests: 1. Cache results and reuse them while they are still useful. 2. Use `page` and `per_page` to fetch only the articles you need. 3. Narrow searches with specific filters. 4. Combine searches that need the same results. 5. Refresh data on a schedule and share the results across users. ## Data Analysis ### How do I interpret sentiment values in the response? The `sentiment` field describes the tone of the article: ```json "sentiment": { "overall": { "score":0.07, "polarity":"positive" }, "title": { "score":0.11, "polarity":"positive" }, "body": { "score":0.03, "polarity":"positive" } } ``` Each value represents the probability of the corresponding sentiment: * `positive` > 0.4: The article has a positive sentiment * `negative` > 0.4: The article has a negative sentiment * `neutral` > 0.4: The article has a neutral sentiment If none of the values exceeds 0.4, the sentiment is considered mixed. ### How do I get the most popular news on a topic? To get the most popular news, use the `/v1/news/top-headlines` endpoint and sort by relevance: ``` https://api.apitube.io/v1/news/top-headlines?category.id=medtop:13000000&sort.by=relevance&sort.order=desc ``` ### Can I track trending topics for a specific period? Yes, to track trending topics: 1. Get articles for the desired period with the `published_at.start` and `published_at.end` parameters 2. Group articles by categories or topics 3. Count the number of articles in each category 4. Sort categories by the number of articles ``` https://api.apitube.io/v1/news/everything?published_at.start=2025-01-01&published_at.end=2025-01-31&sort.by=relevance&sort.order=desc&per_page=100 ``` ## Troubleshooting ### Why am I getting a "Too Many Requests" error? The "Too Many Requests" error (HTTP 429) occurs when you exceed the request limit for your subscription plan. To solve this problem: 1. Check the number of remaining requests in the `X-RateLimit-Remaining` header 2. Wait for the counter to reset (time in the `X-RateLimit-Reset` header) 3. Cache and reuse results 4. Request only the articles and fields you need 5. Upgrade your subscription plan if necessary ### Why am I getting an empty array of articles in the response? If `results` is empty, check these possible causes: 1. Filters are too strict — try simplifying the request 2. There are no articles matching your criteria 3. You are requesting data that is too old (more than 90 days) 4. There is a problem with the request parameters — check the syntax ### How do I distinguish duplicate articles in the results? APITube automatically identifies duplicate articles and marks them with the `is_duplicate` field. You can filter duplicates using the `is_duplicate=0` parameter: ``` https://api.apitube.io/v1/news/everything?is_duplicate=0 ``` ### Why don't some articles contain the full text? Full text may be unavailable because: 1. The article is behind a paywall (the `is_free` field is `false`) 2. Your subscription plan does not include access to the full text 3. The publisher has restricted access to the full text 4. An error occurred while extracting the text In these cases, the API returns the available part of the text or only the title and description. ## Security ### How do I securely store the API key in my application? Keep your API key in storage suited to your application: 1. **Server applications**: Store the key in environment variables or a secure secrets vault 2. **Client web applications**: Never store the key on the client, make requests through a proxy on your server 3. **Mobile applications**: Use a secure storage, such as Keychain (iOS) or EncryptedSharedPreferences (Android) 4. **Desktop applications**: Use the system credential store ### Does the API have protection against SQL injections and other attacks? Yes, APITube implements protection against all major types of web attacks: 1. SQL injections 2. XSS attacks 3. CSRF attacks 4. Command injection attacks 5. DOS/DDOS attacks All request parameters undergo strict validation before processing. ## Advanced Usage ### How do I use the API for brand reputation monitoring? To follow news about your brand and its tone: 1. Create a request specifying the brand name and sentiment analysis: ``` https://api.apitube.io/v1/news/everything?organization.name=Apple&sort.by=sentiment.overall.score ``` 2. Track changes in the sentiment of publications about the brand 3. Set up alerts for negative publications 4. Read the matching articles to understand why the brand is mentioned ### Can I receive notifications about new articles on a specific topic? To build your own notification checks: 1. Schedule your code to check the API regularly, for example with a cron job 2. Save the identifiers of already processed articles 3. Compare new results with saved ones and identify new articles 4. Send notifications through your preferred channel (email, push, webhook) ### How do I get all articles by a specific author? To get all articles by a specific author, use the `author.name` parameter: ``` https://api.apitube.io/v1/news/everything?author.name=John Doe&sort.by=published_at&sort.order=desc ``` ### How do I use the API for competitive analysis? For competitive analysis: 1. Create requests specifying the names of competing companies: ``` https://api.apitube.io/v1/news/everything?organization.name=Apple,Google,Microsoft&published_at.start=2025-01-01 ``` 2. Compare the number of publications, sentiment, and topics 3. Track product mentions and important events 4. Analyze reactions to new products and competitors' initiatives ## Integration with Other Services ### Can I integrate APITube with Google Analytics? Yes. Use Google Analytics to measure how people interact with the news you display: 1. Create unique URL parameters for articles from APITube 2. Add these parameters to article links 3. Set up event tracking in Google Analytics 4. Analyze user interaction with different news categories ### How do I integrate APITube with BI (Business Intelligence) systems? To integrate with BI systems: 1. Fetch news from APITube on a schedule. 2. Convert the response to the format your reporting system needs. 3. Load the data into your reporting system or data warehouse. 4. Build dashboards and reports from the news data. ### Can I integrate APITube with CRM systems? Yes. Use APITube to add relevant news to customer profiles in your CRM: 1. Use your CRM's API to add news to company profiles 2. Set up news searches about client companies through APITube 3. Link news data to client profiles in the CRM 4. Send managers an alert when new articles match the topics you choose ### How do I create an RSS feed based on APITube data? To create an RSS feed: 1. Write a script that requests news from APITube 2. Convert the articles to RSS (XML) 3. Update the RSS feed on a schedule 4. Host the feed on your web server or a service that supports RSS Example of RSS generation: ```php 'technology', 'language' => 'en', 'limit' => 20 ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url . '?' . http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-Key: ' . $api_key ]); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); header('Content-Type: application/rss+xml; charset=utf-8'); echo ''; ?> Technology News https://yourdomain.com/tech-news Latest technology news en-us <?= htmlspecialchars($article['title']) ?> ``` See the [general FAQ](/guides/user-guide/general-faqs) for more answers, or contact [support](mailto:support@apitube.io). --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/title-examples.md description: Examples of using title parameters in News API --- # Title Query Examples ## Find a word in the title {#query-news-with-a-specific-word-in-the-title} Find articles with "technology" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=technology&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "technology", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "technology", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "technology", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "technology") 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) } ``` ```java [Java] 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/everything?title=technology&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=technology 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/everything ``` ::: ## Search for several title words {#query-articles-with-multiple-keywords} Find articles with both "AI" and "innovation" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI,innovation&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI,innovation", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI,innovation", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI,innovation", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI,innovation") 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) } ``` ```java [Java] 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/everything?title=AI,innovation&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI,innovation 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/everything ``` ::: ## Exclude words from the title {#exclude-specific-words-from-the-title} Exclude articles with "celebrity" in the title. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?ignore.title=celebrity&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "ignore.title": "celebrity", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["ignore.title" => "celebrity", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("ignore.title", "celebrity") 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) } ``` ```java [Java] 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/everything?ignore.title=celebrity&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?ignore.title=celebrity 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/everything ``` ::: ## Match a title pattern {#using-regular-expressions-for-search} Find titles matching a pattern. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title_pattern=.%2ABreaking.%2A&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title_pattern": ".*Breaking.*", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title_pattern": ".*Breaking.*", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title_pattern" => ".*Breaking.*", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title_pattern", ".*Breaking.*") 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) } ``` ```java [Java] 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/everything?title_pattern=.%2ABreaking.%2A&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title_pattern=.%2ABreaking.%2A 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/everything ``` ::: ## Combine title filters {#combined-title-filters} Find AI headlines and exclude layoffs. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=AI&ignore.title=layoffs,job losses&title_starts_with=Breaking&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "AI", "ignore.title": "layoffs,job losses", "title_starts_with": "Breaking", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "AI", "ignore.title": "layoffs,job losses", "title_starts_with": "Breaking", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "AI", "ignore.title" => "layoffs,job losses", "title_starts_with" => "Breaking", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "AI") q.Set("ignore.title", "layoffs,job losses") q.Set("title_starts_with", "Breaking") 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) } ``` ```java [Java] 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/everything?title=AI&ignore.title=layoffs,job losses&title_starts_with=Breaking&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=AI&ignore.title=layoffs,job losses&title_starts_with=Breaking 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/everything ``` ::: ## Find market trends in headlines {#analyzing-market-trends-by-titles} Find headlines about market trends. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title_pattern=.%2Amarket.%2A&published_at.start=NOW-7DAYS&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title_pattern": ".*market.*", "published_at.start": "2023-01-01", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title_pattern": ".*market.*", "published_at.start": "2023-01-01", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title_pattern" => ".*market.*", "published_at.start" => "2023-01-01", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title_pattern", ".*market.*") q.Set("published_at.start", "2023-01-01") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?title_pattern=.%2Amarket.%2A&published_at.start=NOW-7DAYS&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title_pattern=.%2Amarket.%2A&published_at.start=NOW-7DAYS&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Follow industry issues {#tracking-industry-issues} Find semiconductor shortage news in a selected industry. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?title=semiconductor&industry.id=1041&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "title": "semiconductor", "industry.id": "1041", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "title": "semiconductor", "industry.id": "1041", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["title" => "semiconductor", "industry.id" => "1041", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("title", "semiconductor") q.Set("industry.id", "1041") 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) } ``` ```java [Java] 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/everything?title=semiconductor&industry.id=1041&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?title=semiconductor&industry.id=1041 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/everything ``` ::: --- --- url: 'https://docs.apitube.io/platform/news-api/tools.md' description: >- Tools for working with the APITube News API — the interactive query builder, the OpenAPI explorer, the Postman collection, official SDKs and no-code integrations. --- # Tools Build and test requests in your browser, use a ready-made client, or connect the API to an automation tool. ## Build and try a request **[Interactive Query Builder](/platform/news-api/query-builder)** lets you choose filters and copy a request URL or cURL command. **[API Explorer](https://api-reference.apitube.io)** lets you choose an endpoint, enter parameters and send a request to see the response. **[Postman Collection](https://www.postman.com/apitube/apitube/overview)** includes requests for every endpoint. Import it into Postman and add your API key to start testing. ## Put it into code **[Integrations & SDKs](/platform/news-api/integrations/getting-started)** — official SDKs for [Node.js](https://github.com/apitube/news-api-node), [PHP](https://github.com/apitube/news-api-php) and [Python](https://github.com/apitube/news-api-python), plus copy-paste examples for 30+ languages and HTTP clients. **[OpenAPI Specification](/platform/news-api/integrations/openapi)** — the machine-readable schema. Generate a typed client for a language that has no official SDK, or feed it to your API tooling. **No-code platforms** — [n8n](/platform/news-api/integrations/n8n), [Zapier](/platform/news-api/integrations/zapier) and [Make](/platform/news-api/integrations/make) call the API from a visual workflow, no server required. ## Let an assistant do it Connect Cursor, Claude or another assistant through the [MCP server](/platform/news-api/ai/mcp-server) to build and run requests in a conversation. You can also send a question directly to the API using the `prompt` parameter with [Natural Language Search](/platform/news-api/ai/natural-language-search). See the [AI section](/platform/news-api/ai/) for setup guides. ## Next steps * Check a key's remaining points: [Balance and usage](/platform/news-api/balance) * Something behaving unexpectedly: [Debugging API requests](/platform/news-api/debugging) --- --- url: 'https://docs.apitube.io/platform/news-api/top-headlines.md' description: >- Get breaking and important news from highly ranked sources with /v1/news/top-headlines. Find endpoint details, request examples, limits and errors. --- # Get top headlines with `/v1/news/top-headlines` Use `/v1/news/top-headlines` for news from publishers with an Open Page Rank of 5 or above. It supports the shared [Filters](/platform/news-api/filters), counts by field, highlighting and exports. The source-rank requirement always applies. 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/top-headlines POST /v1/news/top-headlines ``` Base URL: `https://api.apitube.io`. GET and POST return the same results. Put filters in the URL with `GET` or send them as JSON in the request body with `POST`. ## How top headlines differ from a search | | `/v1/news/top-headlines` | `/v1/news/everything` | |---|---|---| | Source pool | High-authority sources only (`source.rank.opr` ≥ 5) | Every indexed source | | Typical use | A front page, a breaking-news feed | Full-archive research, monitoring, exports | | Filters | Identical | Identical | To choose your own minimum source rank, use `/v1/news/everything` with `source.rank.opr.min`. ## Parameters See [Filters](/platform/news-api/filters) for all shared search filters, sorting, pagination, field selection and other request options. ## Response format The response uses the shared [Response format](/platform/news-api/response-structure). Read articles from `results` and original article links from `href`. See [API Response Structure](/platform/news-api/response-structure#article-object-fields) for all fields. ## Request examples ### GET with query filters ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/top-headlines?language.code=en&source.country.code=us&per_page=10&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/top-headlines", params={"language.code": "en", "source.country.code": "us", "per_page": 10}, headers={"X-API-Key": "YOUR_API_KEY"}, ) for article in response.json()["results"]: print(article["source"]["domain"], article["title"]) ``` ```javascript [Node.js] const params = new URLSearchParams({ 'language.code': 'en', 'source.country.code': 'us', per_page: '10' }); const response = await fetch(`https://api.apitube.io/v1/news/top-headlines?${params}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); const data = await response.json(); console.log(data.results.map(a => a.title)); ``` ```php [PHP] $query = http_build_query([ 'language.code' => 'en', 'source.country.code' => 'us', 'per_page' => 10, 'api_key' => 'YOUR_API_KEY', ]); $data = json_decode(file_get_contents("https://api.apitube.io/v1/news/top-headlines?$query"), true); print_r(array_column($data['results'], 'title')); ``` ::: ### Headlines for one category ```bash curl "https://api.apitube.io/v1/news/top-headlines?category.id=medtop:04000000&language.code=en&api_key=YOUR_API_KEY" ``` Category IDs come from [List of Categories](/platform/news-api/list-of-categories) or from [`/v1/suggest/categories`](/platform/news-api/suggest/categories). ## Limits The same limits as `/v1/news/everything` apply: results per page, accessible pages and the 31-day title-search window. See [Rate limits and quotas](/platform/news-api/rate-limits). ## Errors Same codes as [`/v1/news/everything`](/platform/news-api/everything#errors), documented in full in [HTTP response codes](/platform/news-api/http-response-codes). ## Related * [Search articles](/platform/news-api/everything) — the same filters over every source. * [Local news](/platform/news-api/local) — headlines around a point on the map. * [Parameters reference](/platform/news-api/filters#parameters) — syntax and examples for every filter family. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/examples/topic-examples.md description: Examples of using topic parameters in News API --- # Topic Query Examples ## Choose a topic {#search-for-news-on-a-specific-topic} Find cryptocurrency news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() 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) } ``` ```java [Java] 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/everything?topic.id=industry.crypto_news&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?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/everything ``` ::: ## Compare sentiment across topics {#multi-topic-sentiment-analysis} Compare positive coverage of energy topics. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity": "positive", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.green_energy_news,industry.energy_news", "sentiment.overall.polarity" => "positive", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.green_energy_news,industry.energy_news") q.Set("sentiment.overall.polarity", "positive") 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) } ``` ```java [Java] 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/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news,industry.energy_news&sentiment.overall.polarity=positive 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/everything ``` ::: ## Compare topic coverage by language {#comparative-topic-analysis-with-language-filtering} Compare AI coverage across languages. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news,industry.technology_news&language.code=en,de,fr&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news,industry.technology_news", "language.code": "en,de,fr", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news,industry.technology_news", "language.code": "en,de,fr", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news,industry.technology_news", "language.code" => "en,de,fr", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news,industry.technology_news") q.Set("language.code", "en,de,fr") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news,industry.technology_news&language.code=en,de,fr&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news,industry.technology_news&language.code=en,de,fr&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Find an entity within a topic {#topic-and-entity-intersection-analysis} Find cryptocurrency news about selected entities. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.crypto_news", "title": "Bitcoin,Ethereum", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "title": "Bitcoin,Ethereum", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.crypto_news", "title" => "Bitcoin,Ethereum", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.crypto_news") q.Set("title", "Bitcoin,Ethereum") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin,Ethereum&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Follow market news {#topic-based-market-tracking} Find financial market news. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.financial_news&title=market,stock,trading&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.financial_news", "title": "market,stock,trading", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.financial_news", "title": "market,stock,trading", "sort.by": "published_at", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.financial_news", "title" => "market,stock,trading", "sort.by" => "published_at", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.financial_news") q.Set("title", "market,stock,trading") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.financial_news&title=market,stock,trading&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.financial_news&title=market,stock,trading&sort.by=published_at&sort.order=desc 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/everything ``` ::: ## Follow topic coverage over time {#topic-trending-analysis} Get topic coverage in date order. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.ai_news", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.ai_news", "sort.by": "published_at", "sort.order": "asc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.ai_news", "sort.by" => "published_at", "sort.order" => "asc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.ai_news") q.Set("sort.by", "published_at") q.Set("sort.order", "asc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.ai_news&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.ai_news&sort.by=published_at&sort.order=asc 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/everything ``` ::: ## Compare topic coverage across sources {#topic-sentiment-comparison-across-sources} Compare coverage of a topic across sources. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.technology_news", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.technology_news", "source.domain": "theguardian.com,foxnews.com,nytimes.com", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.technology_news", "source.domain" => "theguardian.com,foxnews.com,nytimes.com", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.technology_news") q.Set("source.domain", "theguardian.com,foxnews.com,nytimes.com") q.Set("sort.by", "sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?topic.id=industry.technology_news&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&source.domain=theguardian.com,foxnews.com,nytimes.com&sort.by=sentiment.overall.score 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/everything ``` ::: ## Compare topic coverage across countries {#cross-regional-topic-impact-analysis} Compare military news across publisher countries. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.military_news&source.country.code=us,gb,de,fr&title=threat,attack,defense&sort.by=source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.military_news", "source.country.code": "us,gb,de,fr", "title": "threat,attack,defense", "sort.by": "source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.military_news", "source.country.code": "us,gb,de,fr", "title": "threat,attack,defense", "sort.by": "source.country.code,sentiment.overall.score", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.military_news", "source.country.code" => "us,gb,de,fr", "title" => "threat,attack,defense", "sort.by" => "source.country.code,sentiment.overall.score", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.military_news") q.Set("source.country.code", "us,gb,de,fr") q.Set("title", "threat,attack,defense") q.Set("sort.by", "source.country.code,sentiment.overall.score") 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) } ``` ```java [Java] 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/everything?topic.id=industry.military_news&source.country.code=us,gb,de,fr&title=threat,attack,defense&sort.by=source.country.code,sentiment.overall.score&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.military_news&source.country.code=us,gb,de,fr&title=threat,attack,defense&sort.by=source.country.code,sentiment.overall.score 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/everything ``` ::: ## Find company sentiment within a topic {#topic-and-organization-intersectional-sentiment-analysis} Find technology news about selected organizations, with image and sentiment filters. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&organization.name=Google,Microsoft,Apple,Amazon&media.images.count=1&sort.by=organization.name,sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "topic.id": "industry.technology_news", "organization.name": "Google,Microsoft,Apple,Amazon", "media.images.count": "1", "sort.by": "organization.name,sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "topic.id": "industry.technology_news", "organization.name": "Google,Microsoft,Apple,Amazon", "media.images.count": "1", "sort.by": "organization.name,sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["topic.id" => "industry.technology_news", "organization.name" => "Google,Microsoft,Apple,Amazon", "media.images.count" => "1", "sort.by" => "organization.name,sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("topic.id", "industry.technology_news") q.Set("organization.name", "Google,Microsoft,Apple,Amazon") q.Set("media.images.count", "1") q.Set("sort.by", "organization.name,sentiment.overall.score") q.Set("sort.order", "desc") 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) } ``` ```java [Java] 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/everything?topic.id=industry.technology_news&organization.name=Google,Microsoft,Apple,Amazon&media.images.count=1&sort.by=organization.name,sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?topic.id=industry.technology_news&organization.name=Google,Microsoft,Apple,Amazon&media.images.count=1&sort.by=organization.name,sentiment.overall.score&sort.order=desc 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/everything ``` ::: --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/breach-feed.md description: >- Build a security incident feed from news — filter breaches by event type, scope them to an industry or company, and follow a case into litigation --- # Track Data Breaches and Lawsuits Use [`event.type`](/platform/news-api/reference/event-types) to follow news about `data-breach`, `lawsuit` and `regulatory-action` events. Together, they help you track an incident and later legal or regulatory coverage. ## Step 1: Pull the breach feed `event.type` accepts up to 5 comma-separated values with OR logic. Start with breaches alone, newest first. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.type=data-breach&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.type": "data-breach", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.type": "data-breach", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.type" => "data-breach", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.type", "data-breach") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?event.type=data-breach&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.type=data-breach&sort.by=published_at&sort.order=desc&per_page=20 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/everything ``` ::: * **Who was hit** — `entities`, filtered to the organization entries. * **What sector** — `industries`, each with an `id` and a readable `name`. * **Tone and breaking-news status** — `sentiment.overall.score` and `is_breaking`. * **Where to read it** — `href` plus `source.domain`. Articles matching `data-breach` do not include this event label in the response. Use the filter to select the coverage you need. ## Step 2: Choose an industry or company {#step-2-scope-it-to-your-sector-or-your-vendors} Add `industry.id` to watch one sector, or `organization.name` to watch a specific company. Both narrow the same feed. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?event.type=data-breach,lawsuit,regulatory-action&industry.id=1180&published_at.start=2026-01-01&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "event.type": "data-breach,lawsuit,regulatory-action", "industry.id": "1180", "published_at.start": "2026-01-01", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.type": "data-breach,lawsuit,regulatory-action", "industry.id": "1180", "published_at.start": "2026-01-01", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.type" => "data-breach,lawsuit,regulatory-action", "industry.id" => "1180", "published_at.start" => "2026-01-01", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("event.type", "data-breach,lawsuit,regulatory-action") q.Set("industry.id", "1180") q.Set("published_at.start", "2026-01-01") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?event.type=data-breach,lawsuit,regulatory-action&industry.id=1180&published_at.start=2026-01-01&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?event.type=data-breach,lawsuit,regulatory-action&industry.id=1180&published_at.start=2026-01-01&per_page=20 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/everything ``` ::: Industry IDs are numeric — look yours up in [the industry list](/platform/news-api/list-of-industries), or resolve one from free text with [`/v1/suggest/industries`](/platform/news-api/suggest/industries). Up to 3 industries can be combined with commas. ## Step 3: Count articles before downloading them {#step-3-size-the-wave-before-you-read-it} Use `/v1/news/count` to compare the number of articles for each event type or period without downloading article content. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/count?event.type=data-breach&published_at.start=2026-07-01&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.type": "data-breach", "published_at.start": "2026-07-01", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "event.type": "data-breach", "published_at.start": "2026-07-01", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/count?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["event.type" => "data-breach", "published_at.start" => "2026-07-01", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/count?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/count") q := u.Query() q.Set("event.type", "data-breach") q.Set("published_at.start", "2026-07-01") 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) } ``` ```java [Java] 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/count?event.type=data-breach&published_at.start=2026-07-01&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/count?event.type=data-breach&published_at.start=2026-07-01 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/everything ``` ::: Repeat the count for `lawsuit` and `regulatory-action` in later months to track coverage after the initial breach. ```python import requests EVENTS = ["data-breach", "lawsuit", "regulatory-action"] def aftermath(company, api_key, since="2026-01-01"): out = {} for event in EVENTS: r = requests.get( "https://api.apitube.io/v1/news/count", params={ "event.type": event, "organization.name": company, "published_at.start": since, "api_key": api_key, }, ).json() out[event] = r["count"] return out ``` > Tip: add `ignore.event.type=earnings,partnership` to exclude those event types from a breach feed. --- --- url: >- https://docs.apitube.io/platform/news-api/common-workflows/recipes/real-estate-market.md description: >- Follow property news using industry IDs. Compare coverage by publisher country and filter by sentiment. --- # Track the Real Estate Market Combine construction, property development and REITs with [`industry.id`](/platform/news-api/list-of-industries) to follow real estate news. Use facets to compare coverage by country and sentiment. ## Step 1: Build the sector feed Three IDs cover most of the market: `216` (Real Estate and Construction — development, sales, management, brokers, architects), `226` (Property Development) and `230` (Real Estate Investment Trusts). ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=216,226,230&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "216,226,230", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "216,226,230", "sort.by": "published_at", "sort.order": "desc", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "216,226,230", "sort.by" => "published_at", "sort.order" => "desc", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "216,226,230") q.Set("sort.by", "published_at") q.Set("sort.order", "desc") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?industry.id=216,226,230&sort.by=published_at&sort.order=desc&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=216,226,230&sort.by=published_at&sort.order=desc&per_page=20 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/everything ``` ::: * **Which part of the market** — `industries` on each article separates brokerage news from development and REIT news. * **Where the property is** — `locations_mentioned`, extracted from the body. * **Which press covered it** — `source.domain` and `source.country.code`. ## Step 2: Compare coverage by publisher country {#step-2-see-which-markets-are-loudest} Use a facet on `source.country.id` to count coverage by publisher country. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=216,226,230&facet=true&facet.field=source.country.id&facet.limit=15&per_page=1&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "216,226,230", "facet": "true", "facet.field": "source.country.id", "facet.limit": "15", "per_page": "1", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "216,226,230", "facet": "true", "facet.field": "source.country.id", "facet.limit": "15", "per_page": "1", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "216,226,230", "facet" => "true", "facet.field" => "source.country.id", "facet.limit" => "15", "per_page" => "1", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "216,226,230") q.Set("facet", "true") q.Set("facet.field", "source.country.id") q.Set("facet.limit", "15") q.Set("per_page", "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) } ``` ```java [Java] 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/everything?industry.id=216,226,230&facet=true&facet.field=source.country.id&facet.limit=15&per_page=1&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=216,226,230&facet=true&facet.field=source.country.id&facet.limit=15&per_page=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/everything ``` ::: Add `source.country.code=us` to select US-based publishers. This filters the publisher's country, so it does not include foreign outlets reporting on US property. ## Step 3: Follow negative coverage {#step-3-watch-sentiment-turn} Filter for negative articles to track changes in the tone of real estate coverage. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/everything?industry.id=216,226,230&sentiment.overall.polarity=negative&published_at.start=2026-07-01&per_page=20&api_key=YOUR_API_KEY" ``` ```python [Python] import requests response = requests.get( "https://api.apitube.io/v1/news/everything", params={ "industry.id": "216,226,230", "sentiment.overall.polarity": "negative", "published_at.start": "2026-07-01", "per_page": "20", "api_key": "YOUR_API_KEY", }, ) print(response.json()) ``` ```javascript [Node.js] const params = new URLSearchParams({ "industry.id": "216,226,230", "sentiment.overall.polarity": "negative", "published_at.start": "2026-07-01", "per_page": "20", "api_key": "YOUR_API_KEY" }); const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`); const data = await response.json(); console.log(data); ``` ```php [PHP] $query = http_build_query(["industry.id" => "216,226,230", "sentiment.overall.polarity" => "negative", "published_at.start" => "2026-07-01", "per_page" => "20", "api_key" => "YOUR_API_KEY"]); $response = file_get_contents("https://api.apitube.io/v1/news/everything?$query"); $data = json_decode($response, true); print_r($data); ``` ```go [Go] package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" ) func main() { u, _ := url.Parse("https://api.apitube.io/v1/news/everything") q := u.Query() q.Set("industry.id", "216,226,230") q.Set("sentiment.overall.polarity", "negative") q.Set("published_at.start", "2026-07-01") q.Set("per_page", "20") 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) } ``` ```java [Java] 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/everything?industry.id=216,226,230&sentiment.overall.polarity=negative&published_at.start=2026-07-01&per_page=20&api_key=YOUR_API_KEY")) .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] Write a script in your preferred language that calls the APITube News API: GET https://api.apitube.io/v1/news/everything?industry.id=216,226,230&sentiment.overall.polarity=negative&published_at.start=2026-07-01&per_page=20 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/everything ``` ::: To calculate the share of negative coverage, use `/v1/news/count` twice: once for all matching articles and once with a negative-sentiment filter: ```python import requests REAL_ESTATE = "216,226,230" def negativity(api_key, country="us", since="2026-07-01"): def count(**extra): params = { "industry.id": REAL_ESTATE, "source.country.code": country, "published_at.start": since, "api_key": api_key, **extra, } return requests.get("https://api.apitube.io/v1/news/count", params=params).json()["count"] total = count() negative = count(**{"sentiment.overall.polarity": "negative"}) return {"total": total, "negative": negative, "share": round(negative / total, 3) if total else 0} ``` > Tip: add `title=mortgage` to focus on mortgage coverage before comparing sentiment. --- --- url: 'https://docs.apitube.io/platform/news-api/trends.md' description: >- Aggregate the most mentioned entities, categories, topics and sources with GET /v1/news/trends — counts, growth rate, trending score and period comparison. --- # Get trends with `/v1/news/trends` Use `/v1/news/trends` to find the most common entities, categories, topics, industries or sources in the news. Choose a field to get its values with article counts and percentages. You can also request growth rates and comparisons with a previous period. Each request costs **1 point**. Using the `prompt` parameter adds **2 points** for the translation step; `prompt` requires Basic or above. A **test key** returns the usual format and numbers, including `count`, `percentage` and `growth_rate`. Each entry's `value` is replaced with `[Upgrade subscription plan]`. Use a test key to build response handling, then switch to a live key to see the rankings. ## Endpoint ``` GET /v1/news/trends POST /v1/news/trends ``` Base URL: `https://api.apitube.io`. You must send `field`. Other parameters filter the articles or change how results are grouped. ## 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. Trend values include details about the field you chose. For example, an `entity.id` result includes the entity's name, type and `wikidata_id`. ## Trending analysis and period comparison You can add more detail to the counts: * `trending=1` adds `growth_rate` and `trending_score` for the last `trending_days` days (default 14, maximum 30). Use them to find subjects gaining attention, even if their total article count is still low. * `compare=1` adds the previous period of the same length and a `change` value. With comparison on, `sort=change` and `sort=trending_score` become available. Use `time_bucket` to group each value's counts by `hour`, `day`, `week` or `month`. Use `percentile` to keep only values above a chosen percentile: for example, 90 keeps the top 10%. ## Parameters ### Prompt Describe the news you want in plain language. The API chooses the filters. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `prompt` | string | No | Describe the news to analyse in plain language. You must still send `field` separately. A new translation costs 2 extra points. Requires Basic or above; Free and Starter return `403 ER0706`. Range: 3–500 characters. | **Find articles Described in Plain Language** Find recent English-language articles about Tesla and Elon Musk using a plain-language request. ::: code-group ```bash [cURL] 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" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Date 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`. | **Find articles within a specific date range** ::: code-group ```bash [cURL] 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" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find news using a relative time range** ::: code-group ```bash [cURL] 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" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Languages | 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`. | **Exclude French articles and publishers in France** ::: code-group ```bash [cURL] 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" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles in the English and French languages** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&language.code=en,fr&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find business news in one language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&language.code=zh,ko&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Source | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.source.bias` | string | No | Exclude publishers with these political biases, separated by commas. 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 publishers' political bias, separated by commas. 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. | **Find articles from a specific source (e.g., "theguardian.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles from multiple sources (e.g., "theguardian.com" and "nytimes.com")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com,nytimes.com&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Choose a source and language** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&source.domain=theguardian.com&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles with rank between 0.5 and 0.9** ::: code-group ```bash [cURL] 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" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Categories | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `category.id` | string | No | Category IDs, separated by commas (max 3). Use IPTC Media Topic IDs such as medtop:04000000. Example: `medtop:04000000`. | | `ignore.category.id` | string | No | Exclude these categories (comma-separated, max 3). | **Find articles from a specific category (e.g., "Sport")** Find articles in the "sport" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:15000000&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles in the Finance Category** Find articles in the "finance" category. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:04000000&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Choose a category and language** Find articles in the "politics" category that are in French. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&category.id=medtop:11000000&language.code=fr&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Topics | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `ignore.topic.id` | string | No | Exclude these topics (comma-separated, max 3). | | `topic.id` | string | No | Topic IDs, separated by commas (max 3). Find IDs with /v1/suggest/topics, for example industry.technology\_news. Example: `industry.technology_news`. | **Find articles from a specific topic (e.g., "crypto\_news")** Find articles in the "crypto news" topic. ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&topic.id=industry.crypto_news&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Industries | 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). | **Find articles about a specific entity (e.g., "Brad Pitt")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles about multiple entities (e.g., "Brad Pitt" and "Angelina Jolie")** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268,1282301&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: **Find articles about an entity while ignoring another** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&entity.id=1278268&ignore.entity.id=315&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Sentiment | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `entity.sentiment.polarity` | string | No | Filter by the tone of coverage about an entity. Choose the entity with entity.id, person.name, organization.name, location.name, brand.name, event.name, disease.name, disaster.name or sport.name. Without one of these fields, the API returns 400 ER0293. 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. | **Follow breaking news only** ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&is_breaking=1&api_key=YOUR_API_KEY" ``` ```python [Python] 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()) ``` ```javascript [Node.js] 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); ``` ```php [PHP] $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); ``` ```go [Go] 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) } ``` ```java [Java] 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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```text [AI Prompt] 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/trends ``` ::: ### Trends aggregation | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `compare` | string | No | Enable period comparison. One of: `0`, `1`. | | `compare_window` | string | No | Period to compare against, required when compare=1. Examples: 24HOURS, 7DAYS, 1WEEK, 1w, 2m. | | `field` | string | Yes | Fields to count by, separated by commas (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 | Group counts by hour, day, week or month. 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 to include in trend analysis. 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 Use the parameters listed here for supported behaviour. Other filters from `/v1/news/everything` may work, but they can change without an OpenAPI update and may be missing from generated SDKs. ::: ## Response format ```json { "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" } ``` When you request several fields, `trends` contains a separate object for each field. Each object has its own `total_count` and `total_articles`. See both response formats in [API Response Structure](/platform/news-api/response-structure#trends-endpoint-response-structure). `total_articles` adds up the counts for all values of a field. An article with three categories contributes three to this total when you request `field=category.id`. Each value's `percentage` is its share of that total. Percentages add up to 100% within a field; compare them only within that field. Use [`/v1/news/count`](/platform/news-api/count) for the number of unique matching articles. ## Request examples ::: code-group ```bash [cURL] curl "https://api.apitube.io/v1/news/trends?field=entity.id&per_page=10&language.code=en&api_key=YOUR_API_KEY" ``` ```python [Python] 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")) ``` ```javascript [Node.js] 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 }))); ``` ```php [PHP] $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 ```bash 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 ```bash 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 ```bash 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 | See [HTTP response codes](/platform/news-api/http-response-codes) for the full error list. ## Related * [Count articles](/platform/news-api/count) — one number instead of a ranking. * [Faceting](/platform/news-api/filters#faceting) — aggregate inside a normal search response. * [Search articles](/platform/news-api/everything) — fetch the articles behind a trend. --- --- url: 'https://docs.apitube.io/platform/news-api/troubleshooting.md' description: >- Diagnose empty results, API key and access errors, and HTTP 429 responses. Review a change, check your request and collect the results for support. --- # Troubleshoot a request Choose the problem you are seeing. Review the request before each check, compare the results and find the next action. For the full reference, see [HTTP response codes](/platform/news-api/http-response-codes), [Authentication](/platform/news-api/authentication) and [Rate limits and quotas](/platform/news-api/rate-limits). --- --- url: 'https://docs.apitube.io/try-it-designs.md' description: Сравнение кнопок в примерах запросов к API --- --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/java/unirest-client.md' description: Call the APITube News API from Java using Unirest --- # Unirest integration ```java // Install: add Unirest (com.konghq:unirest-java) via Maven/Gradle HttpResponse response = Unirest.get("https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY") .asString(); ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/node-js/unirest-client.md description: Call the APITube News API from Node.js using Unirest --- # Unirest integration ```javascript // Install: npm install unirest const unirest = require("unirest"); const req = unirest("GET", "https://api.apitube.io/v1/news/everything"); req.query({ "per_page": 10, "api_key": "YOUR_API_KEY" }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); }); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/swift/url-session.md' description: >- Call the APITube News API from Swift using the URLSession networking API for iOS and macOS --- # URLSession integration ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` --- --- url: 'https://docs.apitube.io/platform/news-api/ai.md' description: >- Connect an AI assistant or code editor to the News API. Find MCP setup instructions and agent skills. --- # Using News API with AI Ask Cursor, Claude or ChatGPT for news in plain language. Connect your assistant to APITube to search articles from 300,000+ sources with the filters you need. Choose how you want to connect below. ## Start here * **[Natural Language Search](/platform/news-api/ai/natural-language-search)** — send a plain-language sentence in the `prompt` parameter and the API builds the filters itself. One HTTP call, no assistant required. Available on Basic and above. * **[MCP Server](/platform/news-api/ai/mcp-server)** — connect any MCP-compatible assistant to the hosted server at `https://mcp.apitube.io/`. No install, just an API key. * **[Code Editors Setup](/platform/news-api/ai/code-editors)** — copy-paste configs for Cursor, Claude Desktop, Claude Code, VS Code, and Windsurf. * **[Agent Skills](/platform/news-api/ai/agent-skills)** — discoverable skills published under `/.well-known/` for agents to find and use the API on their own. ## What is MCP? The [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) lets AI assistants use external tools. With the APITube MCP server, you can ask *"find positive breaking news about Tesla in English"* and get matching articles without writing a request. See [MCP Server](/platform/news-api/ai/mcp-server) to connect in a minute. The same question can be answered without an assistant at all: pass it to the `prompt` parameter and the API does the translation server-side, returning the filters it chose in `meta.prompt`. See [Natural Language Search](/platform/news-api/ai/natural-language-search). ## AI-friendly data Article responses include fields your assistant can use to filter and summarise news: * **Sentiment** — positive / negative / neutral scores at the title, body, and overall level. * **Entities** — people, organizations, locations, brands, and products extracted per article. * **Categories & topics** — IPTC categories and topic tags for precise filtering. * **Readability** — reading time and word/sentence counts. Use these fields to build news summaries, answer questions with article references or monitor a subject. See the [sentiment](/platform/news-api/common-workflows/examples/sentiment-examples) and [entity](/platform/news-api/common-workflows/examples/entity-examples) examples. ## Next steps * Connect your editor: [Code Editors Setup](/platform/news-api/ai/code-editors) * Explore the full filter set: [Parameters](/platform/news-api/filters#parameters) --- --- url: 'https://docs.apitube.io/platform/news-api/webhooks.md' description: >- Get notified by HTTP POST when new articles match your filters — push delivery instead of polling, with signed payloads and automatic retries --- # Webhooks Receive new articles at your own URL with webhooks. Choose your filters once, and APITube sends matching articles as HTTP POST requests. ## What is a webhook? To create a webhook, choose: * a **URL** to deliver to, and * a set of **filters** — the same parameters as [`/v1/news/everything`](/platform/news-api/endpoints) (language, category, source, sentiment, entities, dates, and more). Whenever a newly indexed article matches those filters, APITube sends it to your URL with an HTTP `POST`. **Use cases:** * Real-time monitoring for a brand, competitor, topic, or person * Breaking-news alerts into Slack, Telegram, or email * Sending new articles to your application * Triggering automations (Zapier / Make / n8n) on matching coverage **Benefits:** * Receive articles without repeatedly checking the API * Same filtering power as `/v1/news/everything` * **Signed** payloads (HMAC-SHA256) so you can verify authenticity * **Automatic retries** with longer waits between attempts * Full **delivery logs** in the dashboard ## Creating a webhook Webhooks are created and managed in the **[dashboard](https://dashboard.apitube.io/webhooks)** (Webhooks page): 1. Click **Create webhook**. 2. Choose the **API key** the deliveries are billed to. 3. Enter the destination **URL** (HTTPS recommended — payloads contain article data). 4. Build the **filters** with the same controls as the API Playground (leave empty to receive every new article). 5. On creation you are shown the **signing secret once** — copy and store it. It is used to verify delivery signatures and is never shown again. ::: tip A new webhook starts with the latest articles and then sends new ones as they become available. Test it first with an [`api_test_`](/platform/news-api/authentication) key. Test deliveries contain preview text and use no quota. ::: ## Plan limits The number of webhooks you can have is limited by your subscription plan (counted across your whole account): | Plan | Webhooks | | ------------ | -------- | | Free | 1 | | Starter | 5 | | Basic | 5 | | Professional | 20 | | Corporate | 100 | ## Delivery format Each delivery is an HTTP `POST` to your URL: ```http POST https://your-app.example.com/webhook Content-Type: application/json X-Webhook-Signature: sha256= X-Webhook-Id: 42 X-Webhook-Timestamp: 1718800000 ``` ```json { "event": "articles.new", "webhook_id": 1, "delivered_at": "2026-06-19T12:00:00.000Z", "articles": [ { "id": 3036291250, "title": "…", "source": { "domain": "reuters.com" } } ] } ``` Each article in `articles` has the **same fields as `/v1/news/everything`**. Up to 100 articles are delivered per request. | Header | Description | | ------------------------ | -------------------------------------------------------------------------------------------- | | `X-Webhook-Signature` | `sha256=` — HMAC-SHA256 signature (see below) | | `X-Webhook-Id` | ID of the webhook subscription (matches `webhook_id` in the request body) | | `X-Webhook-Delivery-Id` | Unique ID of this delivery attempt — use it to de-duplicate retries of the same batch | | `X-Webhook-Timestamp` | Unix timestamp (seconds) when the delivery was sent | Return a `2xx` status to confirm delivery. Any other status, or no response within 30 seconds, triggers a retry. ## Verifying the signature Every request is signed with HMAC-SHA256 over `timestamp + "." + rawBody`, using your webhook's **signing secret**. Verify it before processing the request body. ::: code-group ```javascript [Node.js] import crypto from 'node:crypto'; function verifyWebhook(secret, signature, timestamp, rawBody) { const expected = crypto .createHmac('sha256', secret) .update(timestamp + '.' + rawBody) .digest('hex'); return signature === `sha256=${expected}`; } app.post('/webhook', (req, res) => { const ok = verifyWebhook( process.env.WEBHOOK_SECRET, req.headers['x-webhook-signature'], req.headers['x-webhook-timestamp'], JSON.stringify(req.body), ); if (!ok) return res.status(401).send('Invalid signature'); const { articles } = req.body; console.log(`Received ${articles.length} articles`); res.status(200).send('OK'); }); ``` ```python [Python] import hmac import hashlib def verify_webhook(secret, signature, timestamp, raw_body): expected = hmac.new( secret.encode(), (timestamp + '.' + raw_body).encode(), hashlib.sha256, ).hexdigest() return signature == f'sha256={expected}' ``` ::: ## Retries & statuses If delivery fails, APITube retries with the following delays: | Attempt | Delay | | ------- | --------- | | 1 | 1 minute | | 2 | 5 minutes | | 3 | 30 minutes| | 4 | 2 hours | | 5 | 12 hours | After 5 failed attempts the delivery is marked `failed`. After **3 consecutive** failed deliveries the webhook is automatically **disabled** — re-enable it from the dashboard once your endpoint is healthy. A webhook subscription has one of three statuses: | Status | Meaning | | ---------- | ---------------------------------------------------------- | | `active` | Delivering matching articles | | `paused` | Paused by you — no deliveries until resumed | | `disabled` | Auto-disabled after 3 consecutive failed deliveries | You can review every delivery (status, attempts, response code, error) in the dashboard, and re-send a delivery manually. ## Managing webhooks via the API Create webhooks in the dashboard. To view or manage existing webhooks through the API, send your key in `X-API-Key`. ```bash # List your webhooks curl -H "X-API-Key: YOUR_API_KEY" https://api.apitube.io/v1/webhooks # Get one curl -H "X-API-Key: YOUR_API_KEY" https://api.apitube.io/v1/webhooks/1 # Update url / filters / status (active | paused) curl -X PATCH -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"status":"paused"}' https://api.apitube.io/v1/webhooks/1 # Delete curl -X DELETE -H "X-API-Key: YOUR_API_KEY" https://api.apitube.io/v1/webhooks/1 ``` The required scopes are `webhooks:read` (for `GET`) and `webhooks:write` (for `PATCH` / `DELETE`). ## Billing Creating or managing a webhook is free. Each **delivered article** costs **1 point** (charged to the key the webhook was created with). Deliveries made with a test key are masked and not billed. --- --- url: 'https://docs.apitube.io/platform/news-api/websocket-stream.md' description: >- Receive new matching articles over WebSocket, with JSON messages and connection status updates. --- # WebSocket Stream Open one WebSocket connection with your filters to receive new matching articles. You can also send control messages over the same connection. > Articles arrive when they become available in APITube. They may have been published earlier. See [Delivery Order and Freshness](#delivery-order-and-freshness) for details. ## What is WebSocket Stream? [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) lets a client and server send messages over one open connection. This stream sends articles as JSON messages with a `type` field. You can send pings to check the connection. [SSE Stream](/platform/news-api/sse-stream) provides a one-way HTTP alternative. **Use cases:** * Live news feeds and trading/monitoring dashboards * Real-time monitoring for specific topics, entities, or sentiment * Breaking-news alerts * Applications that process incoming articles **Benefits:** * Receive articles as soon as they become available * Every message is a JSON object. Its `type` field tells you whether it contains an article, connection update or error. * The server confirms that the connection and your filters have been accepted * Check the connection with client `ping`, server `pong` and heartbeat messages * All `/everything` filters supported — language, category, sentiment, entities, and more * Field selection with the `fl` parameter to keep responses smaller * Use `takeover` to replace an old connection after a restart without replacing your API key ## Endpoint ```http GET wss://api.apitube.io/v1/news/ws ``` One connection = one set of filters. To subscribe to different filter sets, open separate connections. ## Authentication Pass your API key in one of two ways: * **Header** (recommended): `X-API-Key: YOUR_API_KEY` * **Query parameter**: `?api_key=YOUR_API_KEY` Without a valid API key the connection is closed with WebSocket close code `1008` (Unauthorized). A scope-restricted key must include the `websocket` scope. ## Quick Start ### wscat (command line) ```bash npx wscat -c "wss://api.apitube.io/v1/news/ws?language.code=en&api_key=YOUR_API_KEY" ``` You first receive `connected` and `subscribed` messages. New matching articles then arrive in `article` messages. ### JavaScript (Browser) ```javascript const ws = new WebSocket( 'wss://api.apitube.io/v1/news/ws?api_key=YOUR_API_KEY&language.code=en' ); ws.onmessage = (event) => { const msg = JSON.parse(event.data); if (msg.type === 'error') { console.error(msg.code, msg.message); return; } if (msg.type === 'article') { const article = msg.data; console.log(article.title, article.source?.domain); } }; ws.onclose = (event) => { console.log('Disconnected:', event.code, event.reason); // Reconnect with exponential backoff (see below) }; ``` ### Node.js ```javascript import WebSocket from 'ws'; const ws = new WebSocket('wss://api.apitube.io/v1/news/ws?language.code=en', { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); ws.on('message', (raw) => { const msg = JSON.parse(raw.toString()); if (msg.type === 'error') { console.error(msg.code, msg.message); return; } if (msg.type === 'article') { console.log(msg.data.title); } }); ws.on('close', (code, reason) => { console.log('Closed:', code, reason.toString()); }); ``` ### Python ```python import json import websocket def on_message(ws, message): msg = json.loads(message) if msg.get("type") == "error": print(f"Error: {msg['code']} - {msg['message']}") return if msg.get("type") == "article": article = msg["data"] print(f"{article['title']} — {article.get('source', {}).get('domain')}") ws = websocket.WebSocketApp( "wss://api.apitube.io/v1/news/ws?language.code=en", header={"X-API-Key": "YOUR_API_KEY"}, on_message=on_message, ) ws.run_forever() ``` ## Message Format Every message is a JSON object. Read its `type` field to decide how to handle it. ### Server → Client After a successful connection, the server sends two confirmation messages: ```json {"type":"connected","session_id":"req-a1b2c3","timestamp":1718800000000} {"type":"subscribed","filters":{"language.code":"en"},"timestamp":1718800000000} ``` * `connected` — the connection is established and authenticated. `session_id` identifies this session. * `subscribed` — your subscription is accepted. `filters` echoes the query parameters you connected with (your API key is not echoed back). New matching articles then arrive in `article` messages: ```json {"type":"article","data":{"id":123456,"title":"...","source":{"domain":"reuters.com"},"published_at":"2026-07-03T...","language":{"code":"en"}}} ``` * `data` — the full article JSON, in the same format as the [/everything](/platform/news-api/endpoints) endpoint (or only the fields you requested with `fl`). Control messages: | Message | When | | ----- | ---- | | `{"type":"heartbeat","timestamp":...}` | Keep-alive, sent every 30 seconds | | `{"type":"pong","timestamp":...}` | Reply to a client `ping` | | `{"type":"error","code":"...","message":"..."}` | An error occurred (balance, limits, key revoked); the connection then closes | ### Client → Server Send a `ping` message to confirm that your application is still connected. The server replies with `pong`: ```json { "action": "ping" } ``` Any message from the client confirms that it is still connected. The server replies only to `ping`; it ignores other message content. Filters cannot change while the connection is open. ## Filtering All filters available on the [/everything](/platform/news-api/endpoints) endpoint work with WebSocket Stream, passed as query parameters at connection time: **By language:** ``` wss://api.apitube.io/v1/news/ws?language.code=en&api_key=YOUR_API_KEY ``` **By category:** ``` wss://api.apitube.io/v1/news/ws?category.id=medtop:13000000&api_key=YOUR_API_KEY ``` **By source:** ``` wss://api.apitube.io/v1/news/ws?source.domain=theverge.com&api_key=YOUR_API_KEY ``` **Multiple filters:** ``` wss://api.apitube.io/v1/news/ws?language.code=en&category.id=medtop:13000000&sentiment.overall.polarity=positive&api_key=YOUR_API_KEY ``` **In plain language:** ``` wss://api.apitube.io/v1/news/ws?prompt=breaking technology news in English&api_key=YOUR_API_KEY ``` The API converts [`prompt`](/platform/news-api/filters#prompt) into filters before accepting the subscription. The `subscribed` message shows those filters, so you can check how the prompt was understood: ```json {"type":"subscribed","filters":{"organization.name":"Tesla","language.code":"en"},"timestamp":1718800000000} ``` If a prompt cannot be used, the API sends an error message and closes the connection with code `4001`: ```json {"type":"error","code":"ER0800","message":"prompt must be a string between 3 and 500 characters."} ``` A new prompt translation costs 2 points once per connection. If the translation is already cached, it is free. `prompt` requires **Basic or above**. On Free and Starter, the socket closes with `ER0706`. For the full list of available filters, see [Parameters](/platform/news-api/filters#parameters). ## Field Selection Use `fl` to receive only the fields you need and keep responses smaller. The `data` object in each `article` message contains only those fields: ``` wss://api.apitube.io/v1/news/ws?language.code=en&fl=id,title,source.domain&api_key=YOUR_API_KEY ``` ## Delivery Order and Freshness Articles arrive in the order they become available in APITube. This may differ from their `published_at` order. * **`published_at`** is the original publication time when available. Otherwise, it shows when the article became available in APITube. * **Delivery time** varies by article and publisher. A newly delivered article may have an older `published_at` value. Use `published_at.start` to receive only recent articles. Older articles are excluded before delivery and billing. Use `source.rank.opr.min` (Open PageRank) to select higher-ranked sources. These filters do not change delivery order. See [Parameters](/platform/news-api/filters#parameters). ## Keep-Alive The stream uses two kinds of connection checks: * **Server heartbeat** — every 30 seconds the server sends a `{"type":"heartbeat"}` message and a protocol-level WebSocket ping. Standard clients (the browser `WebSocket` API and the Node `ws` library) reply to the protocol ping automatically. * **Client ping** — you may send `{"action":"ping"}` at any time and the server replies with `{"type":"pong"}`. If a client stops replying to pings, the API closes its connection after one or two heartbeat intervals. This frees the session even if no matching articles are arriving. ## Reconnection A new WebSocket connection starts with the newest matching articles. It does not replay articles missed while disconnected and has no `Last-Event-ID` equivalent. Use [SSE Stream](/platform/news-api/sse-stream) if you need automatic resume. For WebSocket, reconnect with increasing delays between attempts: ```javascript let reconnectDelay = 1000; function connect() { const ws = new WebSocket('wss://api.apitube.io/v1/news/ws?language.code=en&api_key=YOUR_API_KEY'); ws.onopen = () => { reconnectDelay = 1000; // reset on success }; ws.onclose = () => { setTimeout(connect, reconnectDelay); reconnectDelay = Math.min(reconnectDelay * 2, 30000); }; ws.onmessage = (event) => { const msg = JSON.parse(event.data); if (msg.type === 'article') console.log(msg.data.title); }; } connect(); ``` To recover articles missed during a disconnection, request that time range from [/everything](/platform/news-api/endpoints), then reconnect to the stream. ## Parameters | Parameter | Description | |-----------|-------------| | `api_key` | API key (alternative to `X-API-Key` header) | | `takeover` | `true` to evict your oldest connection instead of being rejected at the connection limit | | `fl` | Field selection (e.g., `id,title,source.domain`) | | `prompt` | Describe filters in plain language (3–500 characters). The `subscribed` message shows the selected filters. Requires Basic or above. | | All `/everything` filters | `language.code`, `category.id`, `source.domain`, `sentiment.overall.polarity`, `title`, `organization.name`, and [more](/platform/news-api/everything) | ## Technical Details | Property | Value | |----------|-------| | Protocol | WebSocket (`wss://`), sends messages in both directions | | Poll interval | Every 10 seconds | | Heartbeat interval | Every 30 seconds | | Articles per poll cycle | Up to 50 | | Max message size | 128 KB | | Max connection lifetime | 6 hours (then reconnect) | | Billing | 1 credit per delivered article | | Reconnection | Manual (exponential backoff) | ## Concurrent Connections Your plan limits how many WebSocket connections you can keep open at the same time: | Plan | Max concurrent WebSocket connections | |------|--------------------------------------| | Free | 1 | | Starter | 2 | | Basic | 2 | | Professional | 10 | | Corporate | 50 | On **Free**, you can open **1** WebSocket connection with 1,000 deliveries per day. Article text is a preview; links, images, descriptions and other fields are full. Articles arrive with a **12-hour delay**. Paid plans include full text and more connections: Starter 2, Basic 2, Professional 10 and Corporate 50. Opening more connections than your plan allows sends an `error` message with code `ER0403` and closes the connection with code `4003`: ```json {"type":"error","code":"ER0403","message":"Maximum WebSocket connections (10) reached for your plan."} ``` ### Takeover Connect with `?takeover=true` to replace your oldest connection when all slots are in use. This frees a slot after a restart without replacing your API key. The old client receives an `error` message with `ER0365`, and its connection closes with code `4007`: ``` wss://api.apitube.io/v1/news/ws?language.code=en&takeover=true&api_key=YOUR_API_KEY ``` Use takeover if your application stopped without closing its old connection. Replacing the API key also closes all sessions opened with that key. ## Billing Each article delivered through the stream costs **1 credit**. Credits are deducted in real time as articles arrive — never for the connection itself or for heartbeats. **How it works:** 1. When you connect, the server checks your balance. With no WebSocket credits and no paid balance, it sends an `error` message with code `ER0404` and closes the connection with code `4002`. 2. While the stream is active, 1 credit is deducted per article sent to you — only after the article is confirmed delivered to an open socket. 3. If your balance runs out mid-stream, the server sends an `error` message with code `ER0402` ("WebSocket points exhausted") and closes the connection. **Credit source priority:** * Plan WebSocket credits (`ws_points`) are used first. * If those are exhausted and you have a positive paid balance, the paid balance is used instead. :::warning Each connection is billed independently Each connection is billed separately. If an article matches several of your streams, you pay once per delivery. Use one stream where possible, or choose filters that do not overlap. ::: ## Error Handling The API sends errors in an `error` message, then closes the connection: ```json {"type":"error","code":"ER0402","message":"WebSocket points exhausted."} ``` | Error code | Meaning | Close code | |------------|---------|-----------| | `ER0401` | Invalid filters | `4001` | | `ER0402` | WebSocket credits exhausted mid-stream | `4002` | | `ER0403` | Maximum WebSocket connections reached | `4003` | | `ER0404` | No WebSocket credits at connection time | `4002` | | `ER0361` | API key revoked | `4004` | | `ER0362` | Connection lifetime (6h) exceeded — reconnect | `4005` | | `ER0365` | Connection replaced by a newer one (takeover) | `4007` | | `ER0177` | Monthly pay-as-you-go spending limit reached | `4006` | WebSocket close codes at a glance: | Close code | Reason | |-----------|--------| | `1000` | Normal close | | `1008` | Unauthorized (invalid or missing API key) | | `4001` | Invalid filters | | `4002` | Balance exhausted / no credits | | `4003` | Connection limit reached | | `4004` | API key revoked | | `4005` | Lifetime exceeded | | `4006` | Pay-as-you-go spending limit reached | | `4007` | Replaced by a new connection using `takeover` | ## SSE or WebSocket? Both deliver the same articles in real time with the same filters and per-article billing. Choose by connection style: | | [SSE Stream](/platform/news-api/sse-stream) | WebSocket Stream | |--|------|-----------| | Protocol | HTTP (one-way) | WebSocket (two-way) | | Message format | `event: article` + `data:` | `{"type":"article","data":{...}}` | | Reconnection | Automatic via `Last-Event-ID` | Manual (exponential backoff) | | Slot recovery | Session list/terminate endpoints | `takeover` option | | Best for | Simple one-way reading, browser `EventSource` | Apps that send and receive messages, with ping/pong checks | Choose **SSE** for a one-way feed with automatic resume. Choose **WebSocket** to receive JSON messages and send control messages on the same connection. To receive articles at your own URL, use [Webhooks](/platform/news-api/webhooks). ## Next Steps * Learn about all available [Parameters](/platform/news-api/filters#parameters) * Compare with the [SSE Stream](/platform/news-api/sse-stream) and [Webhooks](/platform/news-api/webhooks) * Check [Authentication](/platform/news-api/authentication) options * See [HTTP Response Codes](/platform/news-api/http-response-codes) for error handling ## Support If you encounter issues: 1. Check the [Technical FAQ](/platform/news-api/technical-faq) 2. Verify your API key on [apitube.io](https://apitube.io) 3. Contact support through the APITube website --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/shell/wget-client.md' description: Call the APITube News API from your terminal with Wget. --- # Wget integration ```shell wget --quiet \ --method GET \ --output-document \ - 'https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY' ``` --- --- url: >- https://docs.apitube.io/platform/news-api/integrations/javascript/xml-http-request.md description: Call the APITube News API from JavaScript using the XMLHttpRequest object --- # XMLHttpRequest integration ```javascript const data = null; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", "https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY"); xhr.send(data); ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/php/yii-framework.md' description: >- Call the APITube News API from Yii PHP using the framework's HTTP client extension --- # Yii integration ```php createRequest() ->setUrl($url) ->send(); if ($response->isOk) { return $response->content; } else { return "HTTP Request Error: " . $response->statusCode; } } } ``` --- --- url: 'https://docs.apitube.io/platform/news-api/integrations/zapier.md' description: >- Automate news monitoring workflows with APITube News API and Zapier — no coding required --- # Zapier Integration Use [Zapier](https://zapier.com) to connect the News API to other apps. These examples show how to monitor news, send alerts and create summaries. ## Prerequisites * Zapier account ([free](https://zapier.com/sign-up) or paid plan) * APITube API key (get one from your [dashboard](https://apitube.io)) ## Setting Up APITube Credentials Use **Webhooks by Zapier** to call the API. Send your API key in a request header. When configuring a Webhooks step: 1. Set **Method** to `GET` 2. Under **Headers**, add: `X-API-Key` | `YOUR_API_KEY` 3. Set **URL** to the APITube endpoint (e.g., `https://api.apitube.io/v1/news/everything`) :::tip You can also pass the API key as a query parameter: add `api_key=YOUR_API_KEY` to the URL. However, using the header is recommended for security. ::: ## API Endpoints Reference | Endpoint | Method | Description | |----------|--------|-------------| | `/v1/news/everything` | GET | Search all articles with 50+ filters | | `/v1/news/top-headlines` | GET | Headlines from highly ranked sources | | `/v1/news/article` | GET | Get articles by ID | | `/v1/news/story/:articleId` | GET | Get related articles for a story | | `/v1/news/trends` | GET | Trending subjects and article counts | Base URL: `https://api.apitube.io` Full list of endpoints and parameters: [Endpoints](/platform/news-api/endpoints) | [Parameters](/platform/news-api/filters#parameters) ## Zap 1: News Monitoring → Google Sheets Automatically collect news articles matching your criteria into a Google Sheets spreadsheet. **How it works:** * Schedule by Zapier triggers every 15 minutes * Webhooks by Zapier sends a GET request to APITube * Looping by Zapier processes each article * Google Sheets appends each article as a row **Step-by-step setup:** ### Step 1: Schedule by Zapier (Trigger) * Choose **Schedule by Zapier** as trigger * Set **Schedule** to `Every 15 Minutes` ### Step 2: Webhooks by Zapier (GET Request) * Choose **Webhooks by Zapier** → **Custom Request** * **Method**: `GET` * **URL**: `https://api.apitube.io/v1/news/everything?title=artificial+intelligence&language.code=en&per_page=50&sort.by=published_at&sort.order=desc` * **Headers**: `X-API-Key` | `YOUR_API_KEY` ### Step 3: Looping by Zapier * Choose **Looping by Zapier** → **Create Loop From Line Items** * Set **Values to Loop** to the results array from Step 2 ### Step 4: Google Sheets (Create Row) * Choose **Google Sheets** → **Create Spreadsheet Row** * Map fields: * **Title** → article title * **URL** → article url * **Source** → article source name * **Published** → article published\_at * **Sentiment** → article sentiment overall polarity **Customization tips:** * Change the `title` query parameter to monitor different keywords * Add `category.id` to filter by category (see [list of categories](/platform/news-api/list-of-categories)) * Add `source.country.code` to filter by country (e.g., `us`, `gb`) * Use `person.name` or `organization.name` to follow news about specific people or companies ## Zap 2: News Alerts → Slack / Email Get notified in Slack or email when new articles match your criteria. **How it works:** * Schedule by Zapier triggers every 30 minutes * Webhooks by Zapier fetches articles from APITube * Filter by Zapier checks if there are results * Slack / Gmail sends a formatted notification **Step-by-step setup:** ### Step 1: Schedule by Zapier (Trigger) * Set **Schedule** to `Every 30 Minutes` ### Step 2: Webhooks by Zapier (GET Request) * **Method**: `GET` * **URL**: `https://api.apitube.io/v1/news/everything?title=startup+funding&language.code=en&per_page=10&sort.by=published_at&sort.order=desc` * **Headers**: `X-API-Key` | `YOUR_API_KEY` ### Step 3: Filter by Zapier * **Field**: results count from Step 2 * **Condition**: Greater than `0` * This prevents empty notifications when no articles are found ### Step 4: Slack — Send Channel Message * **Channel**: your target channel * **Message Text**: ```text New articles found for "startup funding": [Article Title] — mapped from results → title [Source Name] • [Published Date] — mapped from results → source.domain, published_at [Article URL] — mapped from results → href ``` Use Zapier's field mapper to insert article fields from the Webhooks step. **For Email:** Replace Slack with **Gmail** → **Send Email**: * **Subject**: `News Alert: startup funding` * **Body**: map article fields (title, url, source, published\_at) ## Zap 3: AI News Digest → Email Use ChatGPT to summarise each day's news and email the summary. **How it works:** * Schedule by Zapier triggers once daily (e.g., 8:00 AM) * Webhooks by Zapier fetches top headlines * Code by Zapier formats articles into a text list * ChatGPT by Zapier summarizes the articles * Gmail sends the digest **Step-by-step setup:** ### Step 1: Schedule by Zapier (Trigger) * Set **Schedule** to `Every Day` at `8:00 AM` ### Step 2: Webhooks by Zapier (GET Request) * **Method**: `GET` * **URL**: `https://api.apitube.io/v1/news/top-headlines?language.code=en&per_page=20&sort.by=published_at&sort.order=desc` * **Headers**: `X-API-Key` | `YOUR_API_KEY` ### Step 3: Code by Zapier (Format Articles) * **Language**: JavaScript * **Input Data**: `articles` → results array from Step 2 * **Code**: ```javascript const articles = JSON.parse(inputData.articles); const formatted = articles.map((a, i) => `${i + 1}. ${a.title} (${a.source.domain})\n ${a.href}` ).join('\n\n'); output = [{ summary: formatted, count: articles.length }]; ``` ### Step 4: ChatGPT — Conversation * **User Message**: `Summarize the following ${count} news articles into a concise daily digest. Group by topic, highlight the most important stories, and keep it under 500 words.\n\n${summary}` ### Step 5: Gmail — Send Email * **To**: your email address * **Subject**: `Daily News Digest` * **Body**: ChatGPT response from Step 4 ## Parameters See [Parameters](/platform/news-api/filters#parameters) for 50+ filters, including language, category, sentiment, entities and date ranges. ## Tips & Tricks * **URL encoding**: Spaces in query parameters should be encoded as `+` or `%20` (e.g., `title=climate+change`) * **Rate limits**: APITube allows 50 requests per minute. Space your Schedule triggers accordingly * **Pagination**: Use `page` parameter to fetch more results. Max `per_page` is 250 (10 on Free, 50 on Starter, 200 on Basic) * **Date filtering**: Use `published_at.start` with a relative date to avoid duplicate articles between polls * **Zapier plan limits**: The free plan allows 100 tasks per month. Choose how often your Zap runs to stay within your limit * **Error handling**: Add a **Paths by Zapier** step after the Webhooks step to handle HTTP errors ## Next Steps * [Common Workflows](/platform/news-api/common-workflows/getting-started) — more query examples * [Parameters](/platform/news-api/filters#parameters) — full parameter reference * [Endpoints](/platform/news-api/endpoints) — all available endpoints * [API Reference](https://api-reference.apitube.io) — interactive API explorer