Overview

Twelve Data provides real-time and historical stock, forex, cryptocurrency, and ETF market data through a clean and well-documented REST API. It supports over 12,000 financial instruments across global exchanges and offers a generous free tier with 800 API credits per day. Beginners will find it approachable thanks to clear documentation, a free plan, and straightforward API key authentication.

Beginner Tip

Each API call consumes a different number of credits on the free plan — simple quote requests use 1 credit while technical indicator endpoints use more. Check the credits cost in the docs before building to avoid unexpected limits.

Available Data

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

stock price and symbol
open/close/high/low values
trading volume
market cap
historical price data

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "status": "success",
  "data": {
    "result": "Data from Twelve Data",
    "description": "Stock market data (real-time & historical)",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

price Current market price of the requested symbol as a string (convert to float for calculations).
symbol The ticker symbol that was queried.
open Opening price for the current trading day (available in the /quote endpoint).
close Previous closing price of the security.
volume Trading volume for the current session.
datetime Timestamp of the data point in YYYY-MM-DD HH:MM:SS format.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.twelvedata.com/price?symbol=AAPL&apikey=YOUR_API_KEY";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

400 Bad Request - symbol not found The ticker symbol is not recognized or requires an exchange suffix.
For non-US stocks, append the exchange (e.g., "RELIANCE:NSE" for Indian stocks). Use the /stocks endpoint to search valid symbols.
429 Too Many Requests Exceeded the 800 daily credits or the per-minute request rate on the free plan.
Implement caching for frequently requested symbols and add retry logic with exponential backoff. Upgrade to a paid plan for higher limits.
401 Unauthorized - api_key is invalid API key is incorrect or has not been activated yet.
Copy the key directly from your Twelve Data dashboard and wait a few minutes after registration for the key to activate.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Finance
Difficulty Intermediate
Listing details not endpoint-verified

Related Tags

Alternatives to Twelve Data

Technical alternatives for different use cases.

Covers stocks, forex, crypto with technical indicators

Better For

Free tier generosity (fewer API calls)

Trade-off

Multi-asset class data from a single API

Similar APIs

View All →