API Documentation

About TheNewsAPI

TheNewsAPI provides real-time access to news content from worldwide. Our comprehensive API delivers high-quality, timely information with advanced filtering capabilities to help you integrate news content into your applications, dashboards, or research.

Currently, we offer specialized access to crypto news content, with plans to expand to global news categories in the near future. Our platform is designed to serve developers, researchers, businesses, and financial analysts who need reliable, structured news data.

Key Features

  • Comprehensive news coverage from thousands of trusted sources
  • Advanced AI-powered content analysis including sentiments, NER and auto-summary entity extraction
  • Flexible filtering options by keywords, categories, and other parameters
  • Auto-generated article summaries for quick content digestion
  • Detailed metadata including named entity recognition (NER)
  • Simple, developer-friendly REST API with JSON responses
  • Reliable performance with high availability

Getting Your API Key

To use TheNewsAPI, you'll need an API key. Follow these steps to obtain yours:

  1. Create an account - Sign up for an account at Sign Up.
  2. Confirm your email - Verify your account by clicking the link sent to your email address.
  3. Select a plan - Choose the plan that best meets your needs on our pricing page.
  4. Access your API key - Once registered, navigate to the API Keys section in your dashboard to find your API key.

Your API key is confidential. Never share it publicly or commit it to public repositories. Use environment variables or secure configuration to store your API key in your applications.

Making Your First Request

Once you have your API key, you can start making requests to our endpoints. Here's a simple example to get you started:

Request Example

GET API Endpoint
https://api.thenewsapi.net/crypto?apikey=YOUR_API_KEY

You can customize your request with various parameters to filter results according to your needs. Continue reading to explore all available options and advanced features.

Crypto News Endpoint

The Crypto News endpoint provides access to our comprehensive database of cryptocurrency news articles from 2000+ of trusted sources worldwide.

Endpoint

GET Base URL
https://api.thenewsapi.net/crypto

Query Parameters

Parameter Type Description
apikey * string Your API key (required unless using Authorization header)
q string Search query with optional logical operators (&, |, !)
Maximum length: 100 characters.
from string Start date in ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ)
to string End date in ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ)
categories string Comma-separated list of categories (e.g., defi,nft,bitcoin)
sentiments string Comma-separated list of sentiments (e.g., positive,neutral,negative)
sources string Comma-separated list of source domains (e.g., coindesk.com,cointelegraph.com)
langs string Comma-separated list of language using ISO 639-1 code (e.g., en,zh)
page integer Page number for paginated results (default: 1)
size integer Number of results per page

* Fields marked with an asterisk are required.

Available Categories

When using the categories parameter, you can filter articles by the following categories:

price-analysis
NFT
markets
altcoin
policy
legal
business
DeFi
finance
gaming
technology
blockchain
opinion
metaverse
mining
security
interview
review
AI
investigation
web3
stablecoins
news

Example: categories=DeFi,markets,blockchain to get articles related to DeFi, markets, and blockchain.

Authentication

Authentication is required for all requests to TheNewsAPI. Our API uses API key authentication, which is a simple and secure method for verifying your identity and managing access to our services.

Each API key is unique to your account and gives you specific permissions and rate limits based on your subscription plan. Your API key is used to track your usage, apply appropriate rate limits, and ensure you're properly billed for the resources you consume.

You can find your API key in your dashboard. If you need to regenerate your API key for security reasons, you can do so from the same page.

Authentication Method

1

Get API Key

Retrieve from your dashboard:

a1b2c3d4e5f6g7h8i9j0
2

Add to Requests

Include as query parameter:

https://api.thenewsapi.net/crypto?apikey=YOUR_API_KEY
3

Combine Parameters

Chain parameters with &:

?q=bitcoin&from=2024-01-01&apikey=YOUR_API_KEY

Authentication Errors

If authentication fails, the API will return an error response with a 401 Unauthorized status code:

Security Best Practices

  • Never expose your API key in client-side JavaScript code
  • Use environment variables to store your API key securely
  • For browser-based applications, use a backend proxy to make API requests
  • Regularly rotate your API keys for enhanced security
  • Restrict API key usage to specific IP addresses when possible through your dashboard settings

Response Format

All API responses are returned in JSON format with a consistent structure.

Top-Level Response Structure

Field Type Description
success Boolean Indicates if the request was successful
data Object Contains the response data (for successful requests)
error Object Error information (only present for failed requests)

Data Object

Field Type Description
count Integer Total number of articles matching your query
previous String | null URL for the previous page (null on first page)
next String | null URL for the next page of results (null if no more pages)
results Array Array of article objects containing the actual news data

Article Objects

Field Type Description
article_id String Unique identifier for the article
source Object Information about the publication source
category String Primary category of the article. See Available Categories for the complete list of supported categories.
language String Language code (ISO 639-1 code)
url String URL to the original article
thumbnail String URL to the thumbnail image
authors Array Array of author names
description String Brief summary of the article
content String Full text content of the article
images Array Array of image URLs from the article
videos Array Array of video URLs from the article
coins Array Array of cryptocurrency entities mentioned in the article
published_at String Publication date and time (ISO 8601 format)
summary String AI-generated summary of the article content
sentiment String AI-determined sentiment of the article (positive, neutral, negative)
keywords Array Array of relevant keywords extracted from the content
NER Object Named Entity Recognition data, categorizing entities found in the content. See Named Entity Recognition (NER) section for details on entity types.

* Fields may vary based on your subscription plan.

Example Response

Note

Fields with AI-generated content (summary, sentiment, keywords, NER) are highlighted in the table above and may vary based on your subscription plan. Check the pricing page for details on feature availability by plan.

Status Codes

TheNewsAPI uses standard HTTP status codes to indicate the success or failure of an API request:

Status Code Description Common Causes
200 OK Request successful Valid request that completed successfully
400 Bad Request Invalid request Missing required parameters, invalid parameter values
401 Unauthorized Authentication failed Invalid or missing API key
403 Forbidden Access denied Insufficient credits remaining, IP address restrictions, or account has been blocked due to violation of terms of service
404 Not Found Resource not found Requested endpoint or resource does not exist
429 Too Many Requests Rate limit exceeded You've exceeded your rate limit
500 Internal Server Error Server error Something went wrong on our servers
503 Service Unavailable Service unavailable The server is currently unable to handle the request, please try again later

Security Guidelines

To ensure the security of your integration with TheNewsAPI, follow these best practices:

API Key Protection

  • Never expose your API key in client-side code or public repositories
  • Use environment variables to store your API key
  • For frontend applications, implement a backend proxy to make API calls
  • Rotate your API keys periodically for enhanced security

HTTPS Usage

Always use HTTPS for all API requests to ensure encrypted data transmission.

Rate Limiting

Implement proper rate limiting handling in your applications to gracefully handle quota limits.

Content Security

When displaying content from the API, implement proper sanitization to prevent XSS attacks.

Working with Pagination

TheNewsAPI uses cursor-based pagination to help you navigate through large result sets efficiently. Here's how to work with our pagination system:

Pagination Parameters

  • page: Page number (starting from 1)
  • size: Number of results per page (default: maximum size for your plan)

Maximum Size by Plan

Plan Maximum Articles
Free 10 articles per request
Basic 40 articles per request
Pro 50 articles per request
Enterprise 50 articles per request

The maximum number of articles you can retrieve per request corresponds to the "Articles per credit" value in your plan.

Using Pagination Links

Each response includes next and previous pagination URLs that you can use to navigate through the results:

  • Use the next URL to fetch the next page of results
  • Use the previous URL to go back to the previous page
  • If next is null, you've reached the end of the results
  • If previous is null, you're on the first page

Query Builder Tool

For users who prefer a visual approach to creating API queries, TheNewsAPI provides an interactive Query Builder tool in your dashboard.

Using the Query Builder

The Query Builder allows you to construct complex API queries without writing code:

  1. Visit your dashboard at Query Builder
  2. Select your desired parameters using the interactive form
  3. Preview sample results in real-time
  4. Copy the generated API URL or code snippet for your application

Query Builder Features

  • Visual selection of search terms, categories, and filters
  • Real-time preview of matching articles
  • Automatic generation of properly formatted API URLs
  • Code snippets in multiple programming languages

Note

The Query Builder is available to all registered users and provides an excellent way to experiment with different query parameters before implementing them in your application.

Request Limits

TheNewsAPI implements rate limiting to ensure optimal performance and fair usage across all users. These limits help maintain service stability while providing appropriate capacity for each subscription tier.

Rate Limit Overview

Plan Rate Limit
Free 30 per 10 minutes
Basic 900 per 10 minutes
Pro 900 per 10 minutes
Enterprise 900 per 10 minutes

Rate Limit Headers

Each API response includes headers to help you track your usage:

  • X-RateLimit-Limit : Maximum requests allowed

  • X-RateLimit-Remaining : Requests remaining in period

  • X-RateLimit-Reset : Time left in seconds until rate limit resets

Handling Rate Limit Errors

If you receive a 429 Too Many Requests response:

  • Implement exponential backoff for retries

  • Check the X-RateLimit-Reset header

Plan Quotas

TheNewsAPI uses a credit-based system for subscription plans. Different plans offer different credit allocations and article return limits:

Plan Credit Allocation Articles per Credit Additional Credits Features
Free 100 / day 10 Not available 12-hour delayed data, basic features
Basic 15,000 / month 40 $0.006 / credit Real-time data, 6-month history, full content
Pro 35,000 / month 50 $0.005 / credit 9-month history, dedicated support, 99.99% uptime
Enterprise 120,000 / month 50 $0.005 / credit 12-month history, dedicated support, 99.99% uptime

Check our pricing page for the most current plan details and pricing information.

Plan Changes with Proration

You can upgrade or downgrade your subscription plan at any time. When changing plans, proration is applied to ensure fair billing:

Upgrading

  • Changes apply immediately

  • You're only charged the difference between plans for the remainder of the billing cycle

  • Immediately receive the higher credit allocation and increased limits

Downgrading

  • Changes apply immediately

  • You receive a credit toward your next invoice for the unused portion of your current plan

  • The lower plan limits begin immediately

Key Benefits of Proration:

  • Fair billing - only pay for what you use
  • Flexibility to change plans anytime without waiting for renewal
  • No double-charging when upgrading
  • Credits for unused service when downgrading

To change your plan, visit your Subscription Dashboard and click on "Change Plan".

Credit Consumption

Understanding how credits translate to articles will help you optimize your API usage and manage your subscription effectively.

When Credits are used

Credits are deducted for each successful API request that returns articles. Each successful call to an endpoint uses 1 credit, regardless of how many articles are returned (up to your plan's maximum).

No Credit Usage

Credits are NOT deducted for failed API requests (error responses).

Purchasing Additional Credits

If you need more API credits beyond your plan's monthly allocation, you can purchase additional credits directly from your dashboard:

  1. Navigate to Subscription Dashboard
  2. Click on "Purchase Credits" button
  3. Select the number of credits you wish to purchase
  4. Complete the payment process
  5. Credits are added to your account immediately

Additional credits expire at the end of your current billing cycle. Make sure to use them before your plan renews.

Named Entity Recognition (NER)

Our API includes Named Entity Recognition (NER) data in article responses. NER identifies and categorizes key elements in text into pre-defined categories such as people, organizations, locations, monetary values, and more.

Entity Types

The NER field in article responses contains entities grouped by the following types:

Entity Type Description Examples
PERSON Names of people Vitalik Buterin, Elon Musk
NORP Nationalities, religious or political groups American, Democrats, Retail Investors
ORG Organizations, companies, agencies Ethereum Foundation, Coinbase, SEC
GPE Countries, cities, states United States, Singapore, London
LOC Non-GPE locations Asia, Silicon Valley, the Alps
FAC Buildings, airports, highways, bridges Burj Khalifa, JFK Airport
PRODUCT Objects, vehicles, cryptocurrencies Bitcoin, ETH, Tesla Model S
EVENT Named events Consensus 2025, Bitcoin Halving
WORK_OF_ART Books, songs, whitepapers Bitcoin Whitepaper, CryptoTimes
LAW Named laws and regulations Securities Act, GDPR
MONEY Monetary values $1.5 billion, €20,000
PERCENT Percentage values 15%, 2.5%
QUANTITY Physical quantities, measurements 5 gigawatts, 21 million coins
DATE Dates or periods January 2025, Q3 2024
TIME Times of day 9:30 AM EST, midnight
CARDINAL Numerals 42, three hundred
LANGUAGE Named languages English, Chinese, Solidity

Example NER Response

Note

NER data is particularly valuable for tracking mentions of specific cryptocurrencies, organizations, or individuals across news articles. You can use this data to build relationship graphs or monitor sentiment around specific entities in the crypto market.