API Access Key & Authentication
All Marketstack API requests require a valid API access key, passed as a query parameter on every call.
You can find your API key in your Marketstack Dashboard and include it in the access_key query parameter of each request.
Example API Request
In this request:
https://api.apilayer.net/marketstack/v2is the Marketstack V2 base URL./eodis the API endpoint.access_keyauthenticates your request.symbols=AAPLrequests End-of-Day market data for Apple.
https://api.apilayer.net/marketstack/v2/eod?access_key=YOUR_ACCESS_KEY&symbols=AAPLKeep your API key secure: Do not expose it in public repositories, client-side code, or other publicly accessible locations. If you believe your API key has been compromised, reset it from your Marketstack Dashboard.
Base URL
All Marketstack V2 API requests use the following base URL:
https://api.apilayer.net/marketstack/v2
Marketstack uses HTTPS for secure API communication.
Example API Request Available on: All Plans
https://api.apilayer.net/marketstack/v2Make Your First Request
To retrieve End-of-Day market data for Apple (AAPL), send:
curl "https://api.apilayer.net/marketstack/v2/eod?access_key=YOUR_ACCESS_KEY&symbols=AAPL"
A successful request returns an HTTP 200 response with market data in JSON format.
{
"pagination": {
"limit": 100,
"offset": 0,
"count": 1,
"total": 1
},
"data": [
{
"symbol": "AAPL",
"open": "...",
"high": "...",
"low": "...",
"close": "...",
"volume": "...",
"date": "..."
}
]
}Most list-based Marketstack responses contain:
pagination— Information about the number of records returned and available.data— The requested market data.
See Pagination for details on working with larger result sets. Pagination defaults to 100 results per page (max: 1,000). Use limit and offset parameters to page through results.
Common Query Parameters
Most endpoints support these parameters:
access_key— Your API key (required)limit— Results per page (default: 100, max: 1,000)offset— Number of results to skip for paginationsort— Sort order:ASCorDESC(default: DESC)date_from/date_to— Filter by date range (format: YYYY-MM-DD)search— Filter results by keyword, matching against names, symbols, or other text fields (case-insensitive substring match). Available on Exchanges, Tickers, Indices, Bonds, and ETFs endpoints.symbol— Filter results to specific tickers, comma-separated (e.g.AAPL,MSFT,GOOGL). Available on global EOD and Intraday endpoints. Symbols containing a period should use a hyphen instead (e.g.BRK-B).
Rate Limits
The API allows up to 5 requests per second. Exceeding this returns a 429 status code. Monthly request quotas depend on your plan.
Error Handling
Failed requests return an error object with a code, message, and optional context for validation details:
Example Error:
json
{
"error": {
"code": "validation_error",
"message": "Request failed with validation error",
"context": {
"symbols": [{
"key": "missing_symbols",
"message": "You did not specify any symbols."
}]
}
}
}Tip: Always check for the presence of an error object in the response before processing data. Rate-limited requests (429) can be retried after a brief delay.
Common API Errors
| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | Authentication failed — verify your access key |
| 403 | function_access_restricted | Endpoint not available on your current plan |
| 404 | invalid_api_function | The API endpoint does not exist |
| 404 | 404_not_found | The requested resource was not found |
| 406 | data_not_available | The requested data is currently unavailable |
| 429 | too_many_requests | Monthly request quota exceeded |
| 429 | rate_limit_reached | Rate limit (5 req/sec) exceeded |
| 500 | internal_error | Internal server error |