Skip to content

Article Statistics

The Article Statistics endpoint returns the total number of crypto news articles published across 12 predefined time windows — from the last hour up to the last 30 days. All counts are returned in a single request with no parameters.

Use this to:

  • Display an "articles published today" counter in your app
  • Calibrate pagination — estimate how many pages to expect before fetching articles
  • Monitor publishing activity over time (e.g. detect slow weekend periods)
  • Build volume trend charts alongside sentiment data

Base URL

https://crypto-news51.p.rapidapi.com

Get statistics

GET/api/v1/crypto/statistics

Returns a single JSON object with article counts for each time window. No query parameters are accepted.

Authentication

HeaderValue
X-RapidAPI-KeyYour RapidAPI secret key
X-RapidAPI-Hostcrypto-news51.p.rapidapi.com

Example request

bash
curl "https://crypto-news51.p.rapidapi.com/api/v1/crypto/statistics" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: crypto-news51.p.rapidapi.com"
javascript
const response = await fetch(
  'https://crypto-news51.p.rapidapi.com/api/v1/crypto/statistics',
  {
    headers: {
      'X-RapidAPI-Key': process.env.RAPIDAPI_KEY,
      'X-RapidAPI-Host': 'crypto-news51.p.rapidapi.com',
    },
  }
)

const stats = await response.json()

// Estimate pages needed to fetch all articles from the last 24h
const limit = 100
const pages = Math.ceil(stats.countArticlesLast24h / limit)
console.log(`Last 24h: ${stats.countArticlesLast24h} articles across ${pages} pages`)
python
import os
import requests
import math

response = requests.get(
    "https://crypto-news51.p.rapidapi.com/api/v1/crypto/statistics",
    headers={
        "X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"],
        "X-RapidAPI-Host": "crypto-news51.p.rapidapi.com",
    },
)

response.raise_for_status()
stats = response.json()

print("Article counts by time window:")
print(f"  Last  1h:  {stats['countArticlesLast1h']:>6}")
print(f"  Last  4h:  {stats['countArticlesLast4h']:>6}")
print(f"  Last  8h:  {stats['countArticlesLast8h']:>6}")
print(f"  Last 12h:  {stats['countArticlesLast12h']:>6}")
print(f"  Last 24h:  {stats['countArticlesLast24h']:>6}")
print(f"  Last  2d:  {stats['countArticlesLast2d']:>6}")
print(f"  Last  7d:  {stats['countArticlesLast7d']:>6}")
print(f"  Last 30d:  {stats['countArticlesLast30d']:>6}")

# Estimate pages for a 30d backfill at limit=100
pages_30d = math.ceil(stats["countArticlesLast30d"] / 100)
print(f"\nEstimated pages for 30d backfill (limit=100): {pages_30d}")

Response

json
{
  "countArticlesLast1h": 61,
  "countArticlesLast4h": 249,
  "countArticlesLast8h": 528,
  "countArticlesLast12h": 902,
  "countArticlesLast24h": 2573,
  "countArticlesLast2d": 5220,
  "countArticlesLast3d": 7604,
  "countArticlesLast4d": 8896,
  "countArticlesLast5d": 10128,
  "countArticlesLast6d": 12150,
  "countArticlesLast7d": 14655,
  "countArticlesLast30d": 63596
}

Response fields

FieldTypeDescription
countArticlesLast1hintegerArticles published in the last 1 hour.
countArticlesLast4hintegerArticles published in the last 4 hours.
countArticlesLast8hintegerArticles published in the last 8 hours.
countArticlesLast12hintegerArticles published in the last 12 hours.
countArticlesLast24hintegerArticles published in the last 24 hours.
countArticlesLast2dintegerArticles published in the last 2 days.
countArticlesLast3dintegerArticles published in the last 3 days.
countArticlesLast4dintegerArticles published in the last 4 days.
countArticlesLast5dintegerArticles published in the last 5 days.
countArticlesLast6dintegerArticles published in the last 6 days.
countArticlesLast7dintegerArticles published in the last 7 days.
countArticlesLast30dintegerArticles published in the last 30 days.

Použitie pre odhad stránkovania

Pred fetchovaním všetkých článkov zavolaj tento endpoint a vypočítaj počet stránok:

javascript
const stats = await fetchStatistics()
const totalPages = Math.ceil(stats.countArticlesLast24h / 100) // limit=100

Takto vieš vopred koľko requestov bude potrebných a môžeš používateľovi zobraziť progress bar.


Error responses

StatusCodeDescription
401unauthorizedX-RapidAPI-Key je chýbajúci alebo neplatný
403forbiddenVáš RapidAPI plán nezahŕňa prístup k tomuto endpointu
429too_many_requestsPrekročený rate limit
500internal_errorChyba servera — bezpečné opakovať po krátkom čase

EndpointDescription
Crypto ArticlesFetch the actual articles for a given time frame
Historical ArticlesArticles up to 30 days back
Sentiment AnalysisAggregated sentiment counts for a time interval

Released under the MIT License.