Skip to content

Authentication ​

Sign up at APITube 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 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, 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. 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. You can limit a key to specific IP addresses, referring websites and endpoints in the dashboard.