canonical: https://jentic.com/apis/alpaca.markets/broker

# Alpaca Markets Broker API

The Alpaca Broker API lets businesses open and manage brokerage accounts and offer stock, options, and crypto trading to their end users under their own brand. It covers the full account lifecycle including onboarding, KYC and CIP, ACH and bank relationship setup, funding wallets, journals between accounts, trading on behalf of accounts, watchlists, corporate actions, and rebalancing portfolios. The API uses HTTP basic authentication for server-to-server calls and exposes both production and sandbox endpoints. With 131 endpoints, it is the broadest of Alpaca's three APIs and is intended for fintechs building branded investing products.

## For AI agents

Open brokerage accounts, manage funding and ACH relationships, trade on behalf of customers, run rebalancing programmes, and handle journals across accounts via the Alpaca Broker API.

## Scope

Does not handle market data, retail self-directed trading, or non-brokerage banking - use for branded brokerage account opening, funding, trading on behalf of customers, and rebalancing only.

## Capabilities

- Open and update brokerage accounts with KYC and CIP information
- Set up ACH relationships and funding wallets for an account
- Place, replace, and cancel orders on behalf of an account
- Move cash between accounts via journals, including batch journals
- Run automated rebalancing portfolios, subscriptions, and runs
- Subscribe to account, journal, transfer, and trade events via SSE
- Manage watchlists and read corporate action announcements

## Use cases

### Customer onboarding and account opening

Fintechs onboarding new customers create brokerage accounts via POST /v1/accounts, then upload identity documents to /v1/accounts/{account_id}/documents/upload and CIP information to /v1/accounts/{account_id}/cip. Document downloads, account status events, and onboarding-related Onfido SDK token retrieval are all part of the same surface, so onboarding does not require gluing together multiple vendors.

Example prompt: Call POST /v1/accounts with the new customer's identity payload, then upload a passport scan via POST /v1/accounts/{account_id}/documents/upload.

### Trading on behalf of accounts

Apps trade on behalf of their users by calling POST /v1/trading/accounts/{account_id}/orders with the order parameters and managing positions through the same /v1/trading/accounts namespace. Open orders, watchlists, portfolio history, and PDT status are all reachable from this branch, which keeps trading flows in one cohesive subtree.

Example prompt: Place a buy limit order for 5 shares of MSFT at 420.00 USD on account ACCT-1234 via POST /v1/trading/accounts/ACCT-1234/orders.

### Funding and journals

Funds flow into accounts via ACH (POST /v1/accounts/{account_id}/transfers) and between accounts via journals (POST /v1/journals). Batch journals, reverse batch journals, and crypto funding wallets cover the full set of money movement patterns a brokerage needs without leaving the API.

Example prompt: Initiate an ACH deposit of 5000 USD into account ACCT-1234 via POST /v1/accounts/ACCT-1234/transfers.

### Automated rebalancing programmes

Robo-advisors register model portfolios via /v1/rebalancing/portfolios, subscribe accounts to portfolios, and trigger rebalancing runs. The rebalancing endpoints model the full subscription and run lifecycle, which lets advisors run scheduled rebalances without orchestrating individual orders manually.

Example prompt: Subscribe account ACCT-1234 to portfolio PORT-9 via POST /v1/rebalancing/subscriptions, then trigger a manual run via POST /v1/rebalancing/runs.

### AI agent investing assistant

An AI agent acting on behalf of a managed-account customer can read positions, propose orders, and place trades after explicit confirmation. Through Jentic the agent searches by intent, loads the order schema, and executes - the basic auth credentials are kept in your Jentic One instance and never appear in the prompt context.

Example prompt: Use Jentic to search 'place a buy order for an Alpaca brokerage account', execute POST /v1/trading/accounts/{id}/orders after confirmation.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/accounts | Create a new brokerage account |
| GET | /v1/accounts/{account_id} | Retrieve an account by ID |
| POST | /v1/trading/accounts/{account_id}/orders | Create an order for an account |
| GET | /v1/trading/accounts/{account_id}/positions | List open positions for an account |
| POST | /v1/accounts/{account_id}/transfers | Request a new transfer |
| POST | /v1/journals | Create a journal between accounts |
| POST | /v1/rebalancing/runs | Trigger a rebalancing run |
| GET | /v2/events/trades | Subscribe to trade events via SSE |

## Key resources

- **Accounts** — Create, update, retrieve, and close brokerage accounts including KYC, CIP, and document upload
- **Trading** — Place, replace, and cancel orders, list positions, and read portfolio history per account
- **Funding** — ACH relationships, transfers, funding wallets, and crypto funding
- **Journals** — Move cash between accounts including batch and reverse batch journals
- **Rebalancing** — Model portfolios, subscriptions, and runs for automated rebalancing
- **Events** — SSE streams for account status, journals, transfers, and trade events
- **Watchlists** — Per-account watchlists with assets added and removed by symbol

## Why Jentic

- **Setup:** Wiring the Alpaca Broker API by hand means encoding its HTTP basic credentials, targeting the broker-api.alpaca.markets host, and coordinating account, trading, transfer, and journal calls yourself. Through Jentic you install once, import the Broker API from the API Directory, store the basic credential once, and your agent calls it.
- **Permission scoping:** The Broker API puts the account id in the URL path (/v1/accounts/{account_id}, /v1/trading/accounts/{account_id}/orders, /v1/accounts/{account_id}/transfers), so a rule can pin your agent to one customer account. You choose the operations it may call, so placing orders or moving transfers is not included unless you add them.
- **Credential handling:** Your Alpaca Broker basic credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'open a brokerage account' or 'read positions for an account', and Jentic returns the matching Alpaca Broker operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Alpaca Trading API** — Trading API is the self-directed counterpart to Broker, focused on a single account
- **Alpaca Market Data API** — Market Data covers prices, bars, and snapshots that feed trading decisions
- **Plaid** — Plaid provides bank account verification used to fund brokerage accounts
- **Stripe** — Stripe handles fee collection from end customers outside the brokerage flow

## FAQ

### What authentication does the Alpaca Broker API use?

HTTP basic authentication for server-to-server calls. Through Jentic, the basic auth credentials are stored encrypted in the vault and injected at execution time, so they never appear in agent prompts or logs.

### Can I open a brokerage account through the Broker API?

Yes. POST /v1/accounts creates a new brokerage account. KYC, CIP, and identity documents are uploaded via /v1/accounts/{account_id}/cip and /v1/accounts/{account_id}/documents/upload to complete onboarding.

### How do I place an order on behalf of an account through Jentic?

Run pip install jentic, search 'place an order for an Alpaca brokerage account', load the input schema for POST /v1/trading/accounts/{account_id}/orders, and execute with the symbol, quantity, side, and order type.

### Can I move cash between two accounts via the API?

Yes. POST /v1/journals creates a journal between accounts. POST /v1/journals/batch and POST /v1/journals/reverse_batch handle one-to-many and many-to-one transfers in a single call.

### Does the Broker API support automated rebalancing?

Yes. The /v1/rebalancing endpoints expose model portfolios, account subscriptions, and rebalancing runs. Use POST /v1/rebalancing/runs to trigger a manual rebalance against a configured portfolio.

### Is there a sandbox environment for the Broker API?

Yes. The spec lists a sandbox endpoint at https://broker-api.sandbox.alpaca.markets alongside the production endpoint. Use the sandbox to develop and test before pointing at the production base URL.

### Can I limit what my agent is allowed to do with the Alpaca Broker API?

Yes. Because Jentic One is self-hosted, your own rules decide which Alpaca Broker operations and credentials your agent may use. The Broker API puts the account id in the URL path, such as /v1/accounts/{account_id} and /v1/trading/accounts/{account_id}/orders, so a rule can pin the agent to a single customer account. You also choose the operations it may call, so placing orders via POST /v1/trading/accounts/{account_id}/orders or moving money via POST /v1/journals is only available if you add it.
