Overview

Alpaca provides real-time and historical market data for US equities and ETFs, along with commission-free trading capabilities. It uses API key authentication and supports both paper trading (simulation) and live trading environments. It is a strong choice for building algorithmic trading bots or financial data dashboards.

Beginner Tip

Start with a paper trading account on alpaca.markets to get free API keys for testing without risking real money. Use the data API at data.alpaca.markets separately from the broker API at paper-api.alpaca.markets.

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 Alpaca",
    "description": "Realtime and historical market data on all US equities and ETFs",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

t Timestamp for the bar in RFC 3339 format
o Opening price for the bar period
h Highest price during the bar period
l Lowest price during the bar period
c Closing price for the bar period
v Trading volume (number of shares) during the bar period

Implementation Example

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

Request
const url = "https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/";
// 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.

403 Forbidden Using paper trading keys to access live trading endpoints or vice versa
✓ Make sure you are using the correct base URL — paper-api.alpaca.markets for paper trading and api.alpaca.markets for live trading
422 Unprocessable Entity Invalid timeframe or date format in market data requests
✓ Use valid timeframe values like 1Min, 5Min, 1Hour, 1Day and ISO 8601 dates for start/end parameters
401 Unauthorized Both key ID and secret key are required but one is missing
✓ Include both APCA-API-KEY-ID and APCA-API-SECRET-KEY headers in every authenticated request

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 YES
Category Finance
Difficulty Intermediate
Listing details not endpoint-verified

Related Tags

Similar APIs

View All →