Skip to content

Authentication

To use the API, you'll require an API key. You can obtain an API key by signing up for an account on the APITube website.

TIP

All requests may be GET or POST. The API key must be included in the request to authenticate the user. The API key can be passed as a query parameter in the URL or in the headers of the request. If you suspect that your API key has been compromised, you can regenerate it from the APITube website.

API Key in a query string

WARNING

This method is not recommended for production environments as the API key is exposed in the URL.

The API key can be passed as a query parameter in the URL. This is the simplest way to authenticate your requests.

Request Example:

shell
curl https://api.apitube.io/v1/news/everything?per_page=10&api_key=YOUR_API_KEY ...

API Key in headers

You can also pass the API key in the headers of your request. This is a more secure way to authenticate your requests. The API key must be included in the X-API-Key header of the request.

Headers:

  • X-API-Key (string): Your API key for authentication. This header is required for accessing the endpoint.

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 use a Bearer token to authenticate your requests. This is a more secure way to authenticate your requests. The Bearer token must be included in the Authorization header of the request. The Bearer token should be prefixed with Bearer.

Request Example:

shell
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.apitube.io/v1/news/everything?per_page=10 ...

Test mode

Every account has two kinds of API keys, so you can build and test an integration without spending your quota:

  • Live keys (api_live_...) — full access. Requests return complete article data and consume your plan quota / balance.
  • Test keys (api_test_...) — for development. Requests hit the live API and return the real response structure, but each article's text is truncated and suffixed with ...[Test mode — use a live key for full content], and no quota or balance is consumed.

This lets you wire up pagination, fields and error handling against the real API for free (including SSE/WebSocket streams). Switch to a live key — on a paid plan — to receive full article content.

TIP

Create and manage test keys in the dashboard: turn on Test mode (the toggle at the bottom of the sidebar), then create a key under API Keys. Live and test keys are listed separately per mode.

Request Example:

shell
curl "https://api.apitube.io/v1/news/everything?per_page=10&api_key=api_test_YOUR_TEST_KEY"

Detecting the mode

Every response includes an x-apitube-mode header so your integration can tell which mode a key is in without parsing the body:

  • x-apitube-mode: live
  • x-apitube-mode: test

In test mode, aggregate endpoints are also limited. /v1/news/count caps the answer at 100 — a query matching millions still reports 100, so never treat a test-key count as a real volume. /v1/news/trends keeps the shape and the numbers (count, percentage, growth_rate) but replaces each entry's value — the category, entity or source the trend is about — with [Upgrade subscription plan], so you can wire up the response format without seeing the actual rankings.

WARNING

Test keys are rate-limited more strictly than live keys. Use them for development and integration checks, not for production traffic.

Calling the API from a browser

Every response carries Access-Control-Allow-Origin: *, so the API can be called from any origin without proxy configuration. A request that sends X-API-Key is not a simple request, so the browser first issues a OPTIONS preflight — the API answers it with 204 and the matching Access-Control-Allow-* headers, no key required. The preflight result is cacheable for 24 hours (Access-Control-Max-Age: 86400).

WARNING

Any key you ship to a browser is public: anyone can read it from the network tab and spend your quota. Keep the key on your server and proxy the calls, or use a test key with its own limits for a public demo. Restrict what a key can do with IP and referrer rules and endpoint scopes in the dashboard before exposing it anywhere.