Skip to content

Count Articles

The /v1/news/count endpoint returns only the number of articles matching your filters, without loading any article content. It accepts the same filters as /v1/news/everything, but runs a single count(*) query — much cheaper and faster when all you need is the total. It is useful for dashboards, sample-size estimation, and progress bars.

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.

Endpoint

GET  /v1/news/count
POST /v1/news/count

Both methods are equivalent: filters can be passed as query parameters (GET) or as a JSON body (POST). The endpoint accepts the same filters as /v1/news/everything — see the Parameters reference and the Interactive Query Builder for the full list.

Query Parameters

The endpoint supports every filter available on /v1/news/everything. Some commonly used ones:

ParameterTypeRequiredDescription
titlestringNoFull-text search in article titles. Supports phrase search with proximity.
language.codestringNoFilter by language (ISO 639-1), e.g. en.
category.idstringNoFilter by category id.
source.idintegerNoFilter by source id.
published_at.startstringNoStart of period (ISO 8601 or YYYY-MM-DD).
published_at.endstringNoEnd of period (ISO 8601 or YYYY-MM-DD).
api_keystringYes*Your API key. Can also be provided via headers.

* Required if not provided in headers

Each request costs 1 point.

Response Format

json
{
  "status": "ok",
  "count": 0,
  "request_id": "string"
}

Response Fields

FieldTypeDescription
statusstringAlways ok on success.
countintegerNumber of articles matching the filters.
request_idstringUnique identifier for the request.

Request Examples

GET with query filters

shell
curl "https://api.apitube.io/v1/news/count?language.code=en&category.id=medtop:20000199&api_key=YOUR_API_KEY"

POST with JSON body

shell
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"
  }'

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

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