Appearance
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.comGet statistics
GET/api/v1/crypto/statistics
Returns a single JSON object with article counts for each time window. No query parameters are accepted.
Authentication
| Header | Value |
|---|---|
X-RapidAPI-Key | Your RapidAPI secret key |
X-RapidAPI-Host | crypto-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
| Field | Type | Description |
|---|---|---|
| countArticlesLast1h | integer | Articles published in the last 1 hour. |
| countArticlesLast4h | integer | Articles published in the last 4 hours. |
| countArticlesLast8h | integer | Articles published in the last 8 hours. |
| countArticlesLast12h | integer | Articles published in the last 12 hours. |
| countArticlesLast24h | integer | Articles published in the last 24 hours. |
| countArticlesLast2d | integer | Articles published in the last 2 days. |
| countArticlesLast3d | integer | Articles published in the last 3 days. |
| countArticlesLast4d | integer | Articles published in the last 4 days. |
| countArticlesLast5d | integer | Articles published in the last 5 days. |
| countArticlesLast6d | integer | Articles published in the last 6 days. |
| countArticlesLast7d | integer | Articles published in the last 7 days. |
| countArticlesLast30d | integer | Articles 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=100Takto vieš vopred koľko requestov bude potrebných a môžeš používateľovi zobraziť progress bar.
Error responses
| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | X-RapidAPI-Key je chýbajúci alebo neplatný |
| 403 | forbidden | Váš RapidAPI plán nezahŕňa prístup k tomuto endpointu |
| 429 | too_many_requests | Prekročený rate limit |
| 500 | internal_error | Chyba servera — bezpečné opakovať po krátkom čase |
Related endpoints
| Endpoint | Description |
|---|---|
| Crypto Articles | Fetch the actual articles for a given time frame |
| Historical Articles | Articles up to 30 days back |
| Sentiment Analysis | Aggregated sentiment counts for a time interval |