# Alpaca auth

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/brokers/alpaca/messages/auth, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Authenticates a WebSocket connection with the key id and secret, on the account stream and on the market data stream alike. Sent first, before listen or subscribe.

- Message: `auth`
- Interface: Alpaca WebSocket streams
- Group: Connection
- Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/websocket-streaming.md), checked 2026-11-30.

This is a message of the Alpaca WebSocket streams, not an HTTP endpoint. It has no method and no path: it is sent as JSON, or as MessagePack where the client asks for it, over an open WebSocket connection. It is in no OpenAPI file on this site and the request builder does not list it.

Note: Paper and live keys are different keys and each works only on its own host, so connect the paper stream with the paper key.

## The message

- Name: `auth`
- Direction: Request, sent by the client
- Carried by: WebSocket. The same message opens both of Alpaca's streams; the answer differs by stream, as the answer section says.
- Paper account stream: `wss://paper-api.alpaca.markets/stream`
- Live account stream: `wss://api.alpaca.markets/stream`
- Stocks, IEX feed (free plan): `wss://stream.data.alpaca.markets/v2/iex`
- Stocks, SIP feed (Algo Trader Plus): `wss://stream.data.alpaca.markets/v2/sip`
- Stocks, 15 minute delayed SIP: `wss://stream.data.alpaca.markets/v2/delayed_sip`
- Test stream outside market hours, symbol FAKEPACA: `wss://stream.data.alpaca.markets/v2/test`
- Crypto, Alpaca US: `wss://stream.data.alpaca.markets/v1beta3/crypto/us`

## Fields

- `action` (type string, required or not: not stated): Names the message: auth.
- `key` (type string, required or not: not stated): Your API key id. Read it from your own environment; never paste it into a web page.
- `secret` (type string, required or not: not stated): The secret key that goes with the key id. Read it from your own environment.

## What arrives

On the account stream, a message with stream authorization and data.status authorized or unauthorized. On the market data stream, [{"T":"success","msg":"authenticated"}], or an error message with code 402 (auth failed), 403 (already authenticated) or 404 (auth timeout).

- `stream` (type string, required or not: not stated): Account stream: authorization.
- `data.status` (type string, required or not: not stated): Account stream: authorized, or unauthorized where the credentials were refused.
- `data.action` (type string, required or not: not stated): Account stream: authenticate, or listen where a listen message arrived before the connection was authorised.
- `T` (type string, required or not: not stated): Market data stream: success, or error.
- `msg` (type string, required or not: not stated): Market data stream: authenticated on success; connected is the message sent on connecting, before auth.

## Sample

Written by this site from the fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.

```json
{
  "action": "auth",
  "key": "<your API key id, from your own environment>",
  "secret": "<your secret key, from your own environment>"
}
```

## Return codes documented for this message

The market data stream page's error table gives 401 not authenticated, 402 auth failed, 403 already authenticated and 404 auth timeout as the errors of authenticating, and this site holds every code in that table as a record. Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/websocket-streaming.md), checked 2026-11-30.

- [WS_400 (400)](https://openbrokerapi.com/errors/alpaca/ws-400): The market data stream's error 400, invalid syntax: the message sent could not be parsed.
- [WS_401 (401)](https://openbrokerapi.com/errors/alpaca/ws-401): The market data stream's error 401, not authenticated: a message other than auth arrived before the connection was authenticated.
- [WS_402 (402)](https://openbrokerapi.com/errors/alpaca/ws-402): The market data stream's error 402, auth failed: the key id and secret were not accepted, or the feed is not in your subscription.
- [WS_403 (403)](https://openbrokerapi.com/errors/alpaca/ws-403): The market data stream's error 403, already authenticated: a second auth message on a connection that was already authenticated.
- [WS_404 (404)](https://openbrokerapi.com/errors/alpaca/ws-404): The market data stream's error 404, auth timeout: no auth message arrived within the 10 seconds the page allows after connecting.
- [WS_405 (405)](https://openbrokerapi.com/errors/alpaca/ws-405): The market data stream's error 405, symbol limit exceeded: the subscribe message would take the connection past the number of symbols the plan allows.
- [WS_406 (406)](https://openbrokerapi.com/errors/alpaca/ws-406): The market data stream's error 406, connection limit exceeded: a second connection where the plan allows one.
- [WS_407 (407)](https://openbrokerapi.com/errors/alpaca/ws-407): The market data stream's error 407, slow client: the client is not reading messages as fast as the server sends them.
- [WS_409 (409)](https://openbrokerapi.com/errors/alpaca/ws-409): The market data stream's error 409, insufficient subscription: the feed or channel asked for is not in the plan.
- [WS_410 (410)](https://openbrokerapi.com/errors/alpaca/ws-410): The market data stream's error 410: the subscribe action named a channel the connected feed does not serve.
- [WS_500 (500)](https://openbrokerapi.com/errors/alpaca/ws-500): The market data stream's error 500, internal error, on Alpaca's side.

## Limits that apply at Alpaca

- client_order_id length: 128 characters
  - Scope: POST /v2/orders and PATCH /v2/orders/{order_id}
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/openapi/trading-api.json), checked 2026-11-30.
  - Note: From the CreateOrderRequest and PatchOrderRequest schemas.
- Crypto order size: 200,000 US dollars notional per order
  - Scope: Crypto spot orders, buy or sell
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/crypto-trading.md), checked 2026-11-30.
  - Note: The Crypto Spot Trading page: each order is limited to 200,000 US dollars in notional value.
- Market data historical API, Basic plan: 200 requests per minute
  - Scope: Market Data API historical calls, Basic (free) plan
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/about-market-data-api.md), checked 2026-11-30.
  - Note: The About Market Data API page: Historical API limit of 200 calls per minute on Basic, with IEX real time data and stock history since 2016 limited to data 15 minutes old.
- Market data points per page: 10,000 data points per page
  - Scope: Market Data API historical bars, trades and quotes, counted across all symbols
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/openapi/market-data-api.json), checked 2026-11-30.
  - Note: The limit query parameter: default 1000, maximum 10000, counted across every symbol in the request. Pages continue with next_page_token.
- Market data historical API, Algo Trader Plus: 10,000 requests per minute
  - Scope: Market Data API historical calls, Algo Trader Plus plan (99 US dollars a month)
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/about-market-data-api.md), checked 2026-11-30.
  - Note: The About Market Data API page: Historical API limit of 10,000 calls per minute on Algo Trader Plus.
- GTC order age: 90 days
  - Scope: Orders with time in force gtc
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/orders-at-alpaca.md), checked 2026-11-30.
  - Note: The Placing Orders page: GTC orders are cancelled automatically 90 days after creation, the date shown in expires_at, by a job that runs at 4:15 pm ET.
- Trading API request rate: HTTP 429 above the limit, with X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers on replies; no figure on the pages opened
  - Scope: Trading API, per account
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/openapi/trading-api.json), checked 2026-11-30.
  - Note: The Trading API OpenAPI document gives the 429 reply and the three headers. None of the Trading API pages opened on 30 Nov 2026 prints a number, so this site records none.
- Market data WebSocket authentication timeout: 10 seconds
  - Scope: Market data WebSocket, from connecting to the auth message
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/streaming-market-data.md), checked 2026-11-30.
  - Note: Error 404 auth timeout where no auth message arrives in time.
- Market data WebSocket connections: Depends on the subscription; 1 for many subscriptions and with none. A second connection is answered with error 406 connection limit exceeded
  - Scope: Market data WebSocket, per account
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/streaming-market-data.md), checked 2026-11-30.
  - Note: The WebSocket Stream page gives no table of figures by plan.
- Market data WebSocket symbols, Basic plan: 30 symbol subscriptions
  - Scope: Market data WebSocket, US equities, Basic (free) plan; Algo Trader Plus is unlimited
  - Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/us/docs/about-market-data-api.md), checked 2026-11-30.
  - Note: The About Market Data API page: up to 30 WebSocket symbol subscriptions on Basic for equities, unlimited on Algo Trader Plus; for options 200 quote subscriptions on Basic and 1,000 on Algo Trader Plus. Over the limit the stream answers error 405.

## More on Alpaca

- [All Alpaca messages](https://openbrokerapi.com/brokers/alpaca/messages): 9 documented here, grouped by what they do.
- [Alpaca API quickstart](https://openbrokerapi.com/brokers/alpaca/quickstart)
- [All Alpaca error codes](https://openbrokerapi.com/errors/alpaca)
- [Alpaca API page](https://openbrokerapi.com/brokers/alpaca): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: Alpaca auth. Broker API Hub, https://openbrokerapi.com/brokers/alpaca/messages/auth, newest check 2026-11-30.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
