How to make your first request with cURL
Send a request, add filters and read the response
Written by Kent Hudson
June 28, 2026
Updated October 16, 2026
How to make your first request with cURL
Send a GET request to /v1/news/everything with your key in X-API-Key. Run this command in a terminal after replacing YOUR_API_KEY. A successful search returns JSON with articles in results:
curl "https://api.apitube.io/v1/news/everything?per_page=3" \
-H "X-API-Key: YOUR_API_KEY"
cURL is available on macOS, most Linux systems and recent Windows versions. Use the same endpoint with more parameters to filter the articles.
How do you pass your API key in cURL?
Choose one of these methods:
# X-API-Key header (recommended for scripts)
curl "https://api.apitube.io/v1/news/everything" -H "X-API-Key: YOUR_API_KEY"
# Bearer token
curl "https://api.apitube.io/v1/news/everything" -H "Authorization: Bearer YOUR_API_KEY"
# api_key in the URL (quickest one-off test)
curl "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY"
A header keeps the key out of the URL. If several methods are present, Bearer takes priority, followed by X-API-Key, then api_key. See how to authenticate requests.
How do you add parameters and encode them correctly?
Use -G and --data-urlencode when values contain spaces or special characters:
curl -G "https://api.apitube.io/v1/news/everything" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "title=electric vehicles" \
--data-urlencode "language.code=en" \
--data-urlencode "per_page=10"
Keep dotted names, such as language.code, as written. cURL encodes the values for you. If you write a full URL instead, quote it so the shell does not treat & as a command separator.
per_page allows up to 250 on Professional and Corporate, 200 on Basic, 50 on Starter or 10 on Free. Higher values return 400 ER0171. See the parameter reference.
How do you read the cURL response?
Check status, then read the article array in results. page and limit describe the current page; has_next_pages and next_page tell you whether more results are available. Keep request_id if you need support.
{
"status": "ok",
"limit": 3,
"page": 1,
"has_next_pages": true,
"next_page": "https://api.apitube.io/v1/news/everything?per_page=3&page=2",
"results": [ "… article objects …" ],
"request_id": "…"
}
The response also includes export links for the search. Non-JSON downloads require a paid plan.
Use -i for status and response headers, or -v for connection details. If jq is installed, this prints a small summary:
curl -s "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY&per_page=3" \
| jq '{status, page, count: (.results | length)}'
How do you send a POST request with a JSON body instead?
Send the filters as JSON and set Content-Type: application/json. Keep the key in a header:
curl -X POST "https://api.apitube.io/v1/news/everything" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "electric vehicles", "language.code": "en", "per_page": 10}'
GET and POST return the same response structure. See your first news search for article fields and search examples.
Common Questions
- Why does cURL return a 401?
- Why is only part of my query applied?
- How do I see the exact HTTP status code?
- Which endpoints work without a key?
Why does cURL return a 401?
Read errors[0].code: ER0201 means no key arrived, ER0202 means an invalid or revoked key, and ER0230 means expiry. Check the header name and key value. See authentication errors.
Why is only part of my query applied?
An unquoted & can split your shell command. Quote the entire URL, or use -G --data-urlencode to build it.
How do I see the exact HTTP status code?
Use -i to show headers and status above the body, or -w "%{http_code}\n" to print the numeric code.
Which endpoints work without a key?
/ping, /openapi.json and /robots.txt. News endpoints require a valid key.