# Alpaca API POST /v2/orders

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/endpoints/post-orders, 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.

Places an order: market, limit, stop, stop limit or trailing stop, alone or as a bracket, OCO, OTO or multi leg order. The reply is the Order with its id.

- Request: `POST /v2/orders`
- Version: v2
- Group: Orders
- Status: verified. Source: [docs.alpaca.markets](https://docs.alpaca.markets/openapi/trading-api.json), checked 2026-11-30.

Note: Read on the OpenAPI document and the Placing Orders page. The document's required list for the body holds type and time_in_force only; symbol, qty or notional and side carry their requirements in their descriptions, and this record keeps the document's marks. Replies: 200 with the Order; 403 where buying power or shares are insufficient; 422 where a parameter is not recognised. A reply is not a fill: the status field and the trade_updates stream tell you what happened. Test on the paper host first.

## Parameters

- `Content-Type` (in header, type string, required): Send application/json: the OpenAPI document marks the body required and gives it as JSON.
- `symbol` (in body, type string, optional): The asset to trade, by symbol or asset id. The document's words: required except for a multi leg (mleg) order. Crypto pairs take a slash, such as BTC/USD.
- `qty` (in body, type string, optional): How many shares, as a string. Fractional quantities only with a market order and time in force day. Required for a multi leg order. Send qty or notional, not both.
- `notional` (in body, type string, optional): A dollar amount to trade instead of a quantity, as a string. Market orders with time in force day only. Cannot be sent with qty.
- `side` (in body, type string, optional): buy or sell.
- `type` (in body, type string, required): market, limit, stop, stop_limit or trailing_stop.
- `time_in_force` (in body, type string, required): day, gtc, opg, cls, ioc or fok. Crypto takes gtc and ioc only; trailing stops take day and gtc.
- `limit_price` (in body, type string, optional): Required for limit and stop_limit. At or above 1 US dollar at most 2 decimals, below it at most 4: a finer price is rejected.
- `stop_price` (in body, type string, optional): Required for stop and stop_limit.
- `trail_price` (in body, type string, optional): The trail of a trailing stop in dollars. One of trail_price or trail_percent is required for trailing_stop.
- `trail_percent` (in body, type string, optional): The trail of a trailing stop as a percentage. One of trail_price or trail_percent is required for trailing_stop.
- `extended_hours` (in body, type boolean, optional): true lets a limit order with time in force day or gtc trade in the extended sessions. Default false.
- `client_order_id` (in body, type string, optional): Your own id for the order, at most 128 characters. Alpaca generates one where it is left out.
- `order_class` (in body, type string, optional): simple, bracket, oco, oto or mleg. Left out, the order is simple.
- `take_profit` (in body, type object, optional): For bracket and OTO orders: an object with limit_price.
- `stop_loss` (in body, type object, optional): For bracket and OTO orders: an object with stop_price and, where the leg is a stop limit, limit_price.
- `position_intent` (in body, type string, optional): buy_to_open, buy_to_close, sell_to_open or sell_to_close.
- `legs` (in body, type array, optional): For a multi leg options order: up to 4 legs, each with symbol and ratio_qty, and optionally side and position_intent.

### Authentication headers

- `APCA-API-KEY-ID` (type string, required): Your API key id. Placeholder only: never paste a real key into this site.
- `APCA-API-SECRET-KEY` (type string, required): The secret key that goes with the key id. Placeholder only: never paste a real secret into this site.

## Request

Written from the method, path and parameters recorded on this page, against the demo host. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder at https://openbrokerapi.com/tools/request-builder writes these same snippets, from the same record.

This call takes a request body. The samples send it as JSON with a placeholder for each of the 2 body fields the record marks as required. Each placeholder has to be replaced with a real value before the request can succeed.

The owner's quickstart ends with one script that logs in, reads positions, sends this request and reads the confirmation, dry run by default: https://openbrokerapi.com/brokers/alpaca/quickstart#step-10

### Python

```python
# Set ALPACA_API_KEY_ID, ALPACA_API_SECRET_KEY as environment variables first. Never paste real values into code.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: body fields symbol, qty, notional, side, limit_price, stop_price, trail_price, trail_percent, extended_hours, client_order_id, order_class, take_profit, stop_loss, position_intent, legs.
import os
import requests

BASE_URL = "https://paper-api.alpaca.markets"  # the demo host
headers = {
    "APCA-API-KEY-ID": os.environ["ALPACA_API_KEY_ID"],
    "APCA-API-SECRET-KEY": os.environ["ALPACA_API_SECRET_KEY"],
    "Content-Type": "application/json",
}
body = {"type": "...", "time_in_force": "..."}
resp = requests.post(BASE_URL + "/v2/orders", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set ALPACA_API_KEY_ID, ALPACA_API_SECRET_KEY as environment variables first. Never paste real values into code.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Optional and not shown: body fields symbol, qty, notional, side, limit_price, stop_price, trail_price, trail_percent, extended_hours, client_order_id, order_class, take_profit, stop_loss, position_intent, legs.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://paper-api.alpaca.markets"; // the demo host
const res = await fetch(BASE_URL + "/v2/orders", {
  method: "POST",
  headers: {
    "APCA-API-KEY-ID": process.env.ALPACA_API_KEY_ID,
    "APCA-API-SECRET-KEY": process.env.ALPACA_API_SECRET_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"type": "...", "time_in_force": "..."}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set ALPACA_API_KEY_ID, ALPACA_API_SECRET_KEY as environment variables first. Never paste real values into code.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: body fields symbol, qty, notional, side, limit_price, stop_price, trail_price, trail_percent, extended_hours, client_order_id, order_class, take_profit, stop_loss, position_intent, legs.
curl -X POST "https://paper-api.alpaca.markets/v2/orders" \
  -H "APCA-API-KEY-ID: $ALPACA_API_KEY_ID" \
  -H "APCA-API-SECRET-KEY: $ALPACA_API_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "...", "time_in_force": "..."}'
```

## Response

A mock response. The values are invented, so check field names against the official reference.

```json
{
  "_mock": true,
  "id": "00000000-0000-4000-8000-000000mock01",
  "client_order_id": "mock-order-1",
  "created_at": "2026-11-30T14:30:00Z",
  "submitted_at": "2026-11-30T14:30:00Z",
  "asset_id": "00000000-0000-4000-8000-0000000mock1",
  "symbol": "MOCK",
  "asset_class": "us_equity",
  "qty": "1",
  "filled_qty": "0",
  "type": "market",
  "side": "buy",
  "time_in_force": "day",
  "status": "accepted",
  "extended_hours": false,
  "order_class": "simple"
}
```

## 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 the Alpaca API

- [All Alpaca API endpoints](https://openbrokerapi.com/brokers/alpaca/endpoints): 25 documented, grouped by what they do.
- [Alpaca API quickstart](https://openbrokerapi.com/brokers/alpaca/quickstart)
- [All Alpaca API 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.
- [Alpaca API as an OpenAPI file](https://openbrokerapi.com/specs/alpaca.json): Generated from these endpoint records. Independent and unofficial.

## 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 API POST /v2/orders. Broker API Hub, https://openbrokerapi.com/brokers/alpaca/endpoints/post-orders, 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.
