APITube Help Center

How to call the News API from Python, Java, Go and more

Send an HTTPS request and read the returned JSON

Jacob Partington

Written by Jacob Partington

July 2, 2026

Updated October 16, 2026

Open this example in the API Playground ↗

How to call the News API from Python, Java, Go and more

Use your language’s HTTP client to call /v1/news/everything. Send your key in X-API-Key, add search parameters and read the JSON response. An SDK is optional:

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.apitube.io/v1/news/everything?language.code=en&per_page=5"

What do you need to call the News API from any language?

Use the URL https://api.apitube.io/v1/news/everything, your API key and any filters you need. Dotted names such as language.code are literal parameter names. Let your HTTP client encode values containing spaces or symbols.

You can also authenticate with Authorization: Bearer or api_key in the URL. A missing key returns 401 ER0201.

A successful response includes status, results, pagination fields and a request_id. Each article in results includes fields such as id, title, href and published_at.

How do you call the News API from Python?

This example uses the requests package. Install it if it is not already in your project, then pass filters through params:

import requests

resp = requests.get(
    "https://api.apitube.io/v1/news/everything",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"language.code": "en", "per_page": 5},
)
data = resp.json()
for article in data["results"]:
    print(article["title"], article["href"])

How do you call it from Java, Go, Ruby and C#?

These examples send the same request with an X-API-Key header.

Java, using java.net.http on Java 11+:

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.apitube.io/v1/news/everything?language.code=en&per_page=5"))
    .header("X-API-Key", "YOUR_API_KEY")
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Go, using net/http:

req, _ := http.NewRequest("GET", "https://api.apitube.io/v1/news/everything?language.code=en&per_page=5", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))

Ruby, using net/http:

require "net/http"
require "json"

uri = URI("https://api.apitube.io/v1/news/everything?language.code=en&per_page=5")
req = Net::HTTP::Get.new(uri)
req["X-API-Key"] = "YOUR_API_KEY"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
JSON.parse(res.body)["results"].each { |a| puts a["title"] }

C# / .NET, using HttpClient:

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
var url = "https://api.apitube.io/v1/news/everything?language.code=en&per_page=5";
var json = await client.GetStringAsync(url);
Console.WriteLine(json);

How do you call it from PHP without the SDK?

Use PHP’s cURL extension:

$ch = curl_init("https://api.apitube.io/v1/news/everything?language.code=en&per_page=5");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY"]);
$response = json_decode(curl_exec($ch), true);
foreach ($response["results"] as $article) {
    echo $article["title"] . "\n";
}

Do you need an official SDK?

No. Use an HTTP client directly or an official Node.js, PHP or Python SDK. A client library can handle authentication, parsing and exceptions for you; see the Node.js guide.

The parameter reference applies to direct requests from every language.

Common Questions

Where do I put the API key — header or URL?

Prefer X-API-Key or Authorization: Bearer to keep the key out of URLs. The api_key query parameter also works. See authentication.

Which endpoints can I call this way?

Every public REST endpoint. Change the path, HTTP method and parameters as needed. The key authentication stays the same.

How many results can I get per request?

per_page defaults to 100, or your plan’s maximum if lower. Maximums are 250 on Professional and Corporate, 200 on Basic, 50 on Starter and 10 on Free. A larger value returns 400 ER0171. Use page for more results and check has_next_pages.

What rate limit applies?

Live limits are 10 requests/minute on Free, 50 on Starter, Basic and Professional, or 200 on Corporate. Test keys allow 15. The account’s keys share their mode’s allowance. If you receive 429, wait before retrying and reduce traffic.


Related Articles