Alpaca Accounts API
The Accounts API from Alpaca — 14 operation(s) for accounts.
The Accounts API from Alpaca — 14 operation(s) for accounts.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/alpaca-accounts-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Broker Accounts API
description: Open brokerage accounts, enable crypto and stock trading, and manage the ongoing user experience with Alpaca Broker API
version: 1.0.0
contact:
name: Alpaca Support
email: support@alpaca.markets
url: https://alpaca.markets/support
termsOfService: https://s3.amazonaws.com/files.alpaca.markets/disclosures/library/TermsAndConditions.pdf
servers:
- url: https://broker-api.sandbox.alpaca.markets
description: Sandbox endpoint
- url: https://broker-api.alpaca.markets
description: Production endpoint
security:
- BasicAuth: []
tags:
- name: Accounts
paths:
/v1/accounts:
get:
tags:
- Accounts
summary: Get all accounts
parameters:
- name: query
in: query
schema:
type: string
description: Pass space-delimited tokens. The response will contain accounts that match with each of the tokens (logical AND). A match means the token is present in either the account’s associated account number, phone number, name, or e-mail address (logical OR).
- schema:
type: string
format: date-time
in: query
name: created_after
- schema:
type: string
format: date-time
in: query
name: created_before
- schema:
type: string
in: query
name: status
description: See the AccountStatus model for values
- $ref: '#/components/parameters/Sort'
- schema:
type: string
in: query
name: entities
description: Comma-delimited entity names to include in the response
responses:
'200':
description: 'The response is a list of Account model up to 1000 items
per query order by created_at. To scroll the result,
please use the created_after parameter.
'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Account'
operationId: getAllAccounts
description: Retrieves all accounts found by the query'
post:
tags:
- Accounts
summary: Create an account
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccountCreationRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'400':
description: The post body is not well formed.
content:
application/json:
schema:
type: string
'409':
description: There is already an existing account registered with the same email address.
'422':
description: One of the input values is not a valid value.
content:
application/json:
schema:
type: string
operationId: createAccount
description: 'Submit an account application with KYC information. This will create a trading account for the end user. The account status may or may not be ACTIVE immediately and you will receive account status updates on the event API. '
/v1/accounts/{account_id}:
parameters:
- $ref: '#/components/parameters/AccountID'
get:
summary: Get an account by Id.
tags:
- Accounts
description: 'You can query a specific account that you submitted to Alpaca by passing into the query the account_id associated with the account you’re retrieving.
'
responses:
'200':
description: Will return an AccountExtended if an account with account_id exists, otherwise will throw an error.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountExtended'
operationId: getAccount
patch:
tags:
- Accounts
summary: Update an account
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccountUpdateRequest'
responses:
'200':
description: If all parameters are valid and updates have been made, it returns with status code 200. The response is the account model.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountExtended'
'400':
description: The post body is not well formed.
content:
application/json:
schema:
type: string
'422':
description: The request body contains an attribute that is not permitted to be updated or you are attempting to set an invalid value.
content:
application/json:
schema:
type: string
operationId: patchAccount
description: 'This operation updates account information.
If all parameters are valid and updates have been made, it returns with status code 200. The response is the account model.'
delete:
summary: Request to close an account
tags:
- Accounts
responses:
'204':
description: No content.
operationId: deleteAccount
description: This operation closes an active account.
/v1/accounts/{account_id}/documents/upload:
parameters:
- $ref: '#/components/parameters/AccountID'
post:
tags:
- Accounts
summary: Upload a document to an already existing account
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DocumentUploadRequest'
responses:
'204':
description: Success (No Content)
'400':
description: Bad Request. The body in the request is not valid.
content:
application/json:
schema:
type: string
'404':
description: Not Found. No account was found for this account_id
content:
application/json:
schema:
type: string
operationId: uploadDocToAccount
description: 'Upload a document to be attached to an account.
Documents are binary objects whose contents are encoded in base64. Each encoded content size is limited to 10MB if you use Alpaca for KYCaaS. If you perform your own KYC there are no document size limitations.'
/v1/accounts/{account_id}/recipient_banks:
parameters:
- $ref: '#/components/parameters/AccountID'
get:
tags:
- Accounts
summary: Retrieve bank relationships for an account
parameters:
- name: status
in: query
schema:
type: string
enum:
- ACTIVE
- INACTIVE
example: ACTIVE
- name: bank_name
in: query
schema:
type: string
responses:
'200':
description: Success. Returns the bank relationship model.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Bank'
'400':
description: Bad request. The body in the request is not valid.
operationId: getRecipientBanks
description: Retrieves Bank Relationships for an account
post:
tags:
- Accounts
summary: Create a Bank Relationship for an account
parameters:
- $ref: '#/components/parameters/AccountID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateBankRequest'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Bank'
'400':
description: Bad Request
'409':
description: Conflict
operationId: createRecipientBank
description: If successful, retrieves Bank Relationships for an account
/v1/accounts/{account_id}/recipient_banks/{bank_id}:
parameters:
- $ref: '#/components/parameters/AccountID'
- name: bank_id
in: path
required: true
schema:
type: string
format: uuid
delete:
tags:
- Accounts
summary: Delete a Bank Relationship for an account
responses:
'204':
description: Success (No Content)
'400':
description: Bad Request
'404':
description: Bank Not Found
operationId: deleteRecipientBank
description: If successful, deletes Bank Relationship for an account
/v1/accounts/{account_id}/transfers:
parameters:
- $ref: '#/components/parameters/AccountID'
get:
summary: Return a list of transfers for an account.
tags:
- Accounts
description: 'You can query a list of transfers for an account.
You can filter requested transfers by values such as direction and status.
'
parameters:
- name: direction
in: query
schema:
enum:
- INCOMING
- OUTGOING
type: string
description: INCOMING or OUTGOING
- name: limit
in: query
schema:
type: integer
format: int32
- name: offset
in: query
schema:
type: integer
format: int32
responses:
'200':
description: Success.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Transfer'
examples:
example-1:
value:
- id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
relationship_id: 81412018-ffa2-43f9-a3eb-d39f1c5e0f87
bank_id: f1ae96de-94c1-468e-93a3-6b7213930ca8
account_id: 449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65
type: ach
status: QUEUED
reason: string
amount: string
direction: INCOMING
created_at: '2019-08-24T14:15:22Z'
updated_at: '2019-08-24T14:15:22Z'
expires_at: '2019-08-24T14:15:22Z'
additional_information: string
example-2:
value:
- id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
relationship_id: 81412018-ffa2-43f9-a3eb-d39f1c5e0f87
bank_id: f1ae96de-94c1-468e-93a3-6b7213930ca8
account_id: 449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65
type: ach
status: QUEUED
reason: string
amount: string
direction: INCOMING
created_at: '2019-08-24T14:15:22Z'
updated_at: '2019-08-24T14:15:22Z'
expires_at: '2019-08-24T14:15:22Z'
additional_information: string
operationId: getTransfersForAccount
post:
summary: Request a new transfer
tags:
- Accounts
description: 'Create a new transfer to an account to fund it.
In the sandbox environment, you can instantly deposit to or withdraw from an account with a virtual money amount. In the production environment, this endpoint is used only for requesting an outgoing (withdrawal) wire transfer at this moment. For the wire transfer (in production), you need to create a bank resource first using the Bank API. For more on how to fund an account in sandbox please check out this tutorial [here](https://alpaca.markets/learn/fund-broker-api/).'
parameters:
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTransferRequest'
responses:
'200':
description: Successfully requested a transfer.
content:
application/json:
schema:
$ref: '#/components/schemas/Transfer'
operationId: createTransferForAccount
/v1/accounts/{account_id}/transfers/{transfer_id}:
parameters:
- $ref: '#/components/parameters/AccountID'
- schema:
type: string
format: uuid
name: transfer_id
in: path
required: true
description: Tranfer identifier
delete:
summary: Request to close a transfer
operationId: deleteTransfer
responses:
'204':
description: Success (No Content)
'404':
$ref: '#/components/responses/NotFound'
description: Request to close a transfer
tags:
- Accounts
/v1/accounts/activities:
get:
tags:
- Accounts
summary: Retrieve account activities
parameters:
- name: account_id
in: query
schema:
type: string
format: uuid
description: id of a single account to filter by
- name: date
in: query
schema:
type: string
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported.
- name: until
in: query
schema:
type: string
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported.
- name: after
in: query
schema:
type: string
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. Cannot be used with date.
- $ref: '#/components/parameters/Direction'
- name: page_size
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 100
description: The maximum number of entries to return in the response
- in: query
name: page_token
description: 'The Activity ID of the end of your current page of results. '
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Activity'
operationId: getAccountActivities
description: "Returns an array of Activities\n\nNotes:\n* Pagination is handled using the `page_token` and `page_size` parameters.\n* `page_token` represents the ID of the end of your current page of results.\n for example if in your first response the id of the last Activiy item returned in the array was `20220203000000000::045b3b8d-c566-4bef-b741-2bf598dd6ae7`, you'd pass that value as `page_token` to get the next page of results\n\n* If specified with a `direction` of `desc`, for example, the results will end before the activity with the specified ID.\n* If specified with a `direction` of `asc`, results will begin with the activity immediately after the one specified.\n* `page_size` is the maximum number of entries to return in the response.\n* If `date` is not specified, the default and maximum value is 100.\n* If `date` is specified, the default behavior is to return all results, and there is no maximum page size."
/v1/accounts/activities/{activity_type}:
parameters:
- $ref: '#/components/parameters/ActivityType'
get:
tags:
- Accounts
parameters:
- name: account_id
in: query
schema:
type: string
format: uuid
description: id of a single account to filter by
- name: date
in: query
schema:
type: string
format: date-time
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported.
- name: until
in: query
schema:
type: string
format: date-time
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported.
- name: after
in: query
schema:
type: string
format: date-time
description: Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported.
- $ref: '#/components/parameters/Direction'
- name: page_size
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 100
description: The maximum number of entries to return in the response
- name: page_token
in: query
schema:
type: string
description: The ID of the end of your current page of results
summary: Retrieve specific account activities
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Activity'
operationId: getAccountActivitiesByType
description: "Retrieves an Array of Activies by type\n\nNotes:\n* Pagination is handled using the `page_token` and `page_size` parameters.\n* `page_token` represents the ID of the end of your current page of results.\n for example if in your first response the id of the last Activiy item returned in the array was `20220203000000000::045b3b8d-c566-4bef-b741-2bf598dd6ae7`, you'd pass that value as `page_token` to get the next page of results\n\n* If specified with a `direction` of `desc`, for example, the results will end before the activity with the specified ID.\n* If specified with a `direction` of `asc`, results will begin with the activity immediately after the one specified.\n* `page_size` is the maximum number of entries to return in the response.\n* If `date` is not specified, the default and maximum value is 100.\n* If `date` is specified, the default behavior is to return all results, and there is no maximum page size."
/v1/accounts/{account_id}/ach_relationships:
parameters:
- $ref: '#/components/parameters/AccountID'
get:
summary: Retrieve ACH Relationships for an account
tags:
- Accounts
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ACHRelationship'
operationId: getAccountACHRelationships
description: Returns a list of ACH Relationships for an account
parameters:
- schema:
type: string
in: query
name: statuses
description: Comma-separated status values
post:
summary: Create an ACH Relationship
operationId: createACHRelationshipForAccount
responses:
'200':
description: returns the newly created ACH Relationship entity.
content:
application/json:
schema:
$ref: '#/components/schemas/ACHRelationship'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/NotAuthorized'
'409':
description: The account already has an active relationship.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Create a new ACHRelationship for an account
If successful, will return 200 code with a newly created ACH Relationship entity.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateACHRelationshipRequest'
description: 'Create ACH Relationship '
tags:
- Accounts
/v1/accounts/{account_id}/ach_relationships/{ach_relationship_id}:
parameters:
- $ref: '#/components/parameters/AccountID'
- schema:
type: string
format: uuid
name: ach_relationship_id
in: path
description: ACH relationship identifier
required: true
delete:
summary: Delete an existing ACH relationship
operationId: deleteACHRelationshipFromAccount
responses:
'204':
description: Success (No Content)
'400':
description: the passed in account_id or relationship_id were invalid
'404':
$ref: '#/components/responses/NotFound'
description: Delete an existing ACH relationship for an account
tags:
- Accounts
/v1/trading/accounts/{account_id}/account:
parameters:
- $ref: '#/components/parameters/AccountID'
get:
operationId: getTradingAccount
summary: Retrieve trading details for an account.
tags:
- Accounts
description: 'As a broker you can view more trading details about your users.
The response is a Trading Account model.'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TradeAccount'
/v1/events/accounts/status:
get:
summary: Subscribe to account status events (SSE).
tags:
- Accounts
description: 'Events API provide event push as well as historical queries via SSE (server sent events).
Historical events are streamed immediately if queried, and updates are pushed as events occur.
Query Params Rules:
- `since` required if `until` specified
- `since_id` required if `until_id` specified
- `since` and `since_id` can’t be used at the same time
Behavior:
- if `since` or `since_id` not specified this will not return any historic data
- if `until` or `until_id` reached stream will end (status 200)
---
Note for people using the clients generated from this OAS spec. Currently OAS-3 doesn''t have full support for representing SSE style responses from an API, so if you are using a generated client and don''t specify a `since` and `until` there is a good chance the generated clients will hang waiting for the response to end.
If you require the streaming capabilities we recommend not using the generated clients for this specific usecase until the OAS-3 standards come to a consensus on how to represent this correcting in OAS-3.
'
parameters:
- name: since
in: query
schema:
type: string
format: date
description: 'Format: YYYY-MM-DD'
- name: until
in: query
schema:
type: string
format: date
description: 'Format: YYYY-MM-DD'
- name: since_id
in: query
schema:
type: integer
- name: until_id
in: query
schema:
type: integer
responses:
'200':
description: Connected. Events will now start streaming as long as you keep the connection open.
content:
text/event-stream:
schema:
type: array
items:
$ref: '#/components/schemas/AccountStatusEvent'
examples: {}
operationId: suscribeToAccountStatusSSE
components:
schemas:
TradeActivity:
title: TradeActivity
type: object
properties:
transaction_time:
type: string
format: date-time
example: '2021-05-10T14:01:04.650275Z'
description: Valid only for trading activity types. Null for non-trading activites.
type:
type: string
enum:
- fill
- partial_fill
example: fill
description: Valid only for trading activity types. Null for non-trading activites.
price:
type: string
format: decimal
example: '3.1415'
description: Valid only for trading activity types. Null for non-trading activites.
qty:
type: string
format: decimal
example: '0.38921'
description: Valid only for trading activity types. Null for non-trading activites.
side:
$ref: '#/components/schemas/OrderSide'
symbol:
type: string
example: AAPL
description: Valid only for trading activity types. Null for non-trading activites.
leaves_qty:
type: string
format: decimal
example: '0.5123'
description: Valid only for trading activity types. Null for non-trading activites.
order_id:
type: string
format: uuid
example: fe060a1b-5b45-4eba-ba46-c3a3345d8255
description: Valid only for trading activity types. Null for non-trading activites.
cum_qty:
type: string
format: decimal
example: '0.9723'
description: Valid only for trading activity types. Null for non-trading activites.
order_status:
$ref: '#/components/schemas/OrderStatus'
AccountConfigurations:
title: AccountConfigurations
type: object
description: Represents additional configuration settings for an account
properties:
dtbp_check:
type: string
description: both, entry, or exit. Controls Day Trading Margin Call (DTMC) checks.
example: both
enum:
- both
- entry
- exit
trade_confirm_email:
type: string
description: all or none. If none, emails for order fills are not sent.
enum:
- all
- none
suspend_trade:
type: boolean
description: If true, new orders are blocked.
no_shorting:
type: boolean
description: If true, account becomes long-only mode.
fractional_trading:
type: boolean
description: If true, account is able to participate in fractional trading
max_margin_multiplier:
type: string
description: Can be "1" or "2"
pdt_check:
type: string
example: entry
required:
- dtbp_check
- trade_confirm_email
- suspend_trade
- no_shorting
- fractional_trading
- max_margin_multiplier
- pdt_check
TradeAccount:
type: object
x-examples:
example-1:
id: c8f1ef5d-edc0-4f23-9ee4-378f19cb92a4
account_number: '927584925'
status: ACTIVE
currency: USD
buying_power: '103556.8572572922'
regt_buying_power: '52921.2982330664'
daytrading_buying_power: '103556.8572572922'
cash: '24861.91'
cash_withdrawable: '17861.91'
cash_transferable: '24861.91'
accrued_fees: '0'
pending_transfer_out: '0'
portfolio_value: '28059.3882330664'
pattern_day_trader: true
trading_blocked: false
transfers_blocked: false
account_blocked: false
created_at: '2021-03-01T13:28:49.270232Z'
trade_suspended_by_user: false
multiplier: '2'
shorting_enabled: true
equity: '28059.3882330664'
last_equity: '26977.323677655'
long_market_value: '3197.4782330664'
short_market_value: '0'
initial_margin: '1598.7391165332'
maintenance_margin: '959.24346991992'
last_maintenance_margin: '934.6241032965'
sma: '26758.0590204615'
daytrade_count: 0
previous_close: '2021-04-01T19:00:00-04:00'
last_long_market_value: '3115.413677655'
last_short_market_value: '0'
last_cash: '23861.91'
last_initial_margin: '1557.7068388275'
last_regt_buying_power: '50839.233677655'
last_daytrading_buying_power: '104433.9158860662'
last_buying_power: '104433.9158860662'
last_daytrade_count: 0
clearing_broker: VELOX
example-2:
id: 56712986-9ff7-4d8f-8e52-077e099e533e
account_number: '601612064'
status: ACTIVE
crypto_status: PAPER_ONLY
currency: USD
buying_power: '83567.42'
regt_buying_power: '83567.42'
daytrading_buying_power: '0'
non_marginable_buying_power: '41783.71'
cash: '83567.42'
cash_withdrawable: '0'
cash_transferable: '41783.71'
accrued_fees: '0'
pending_transfer_out: '0'
pending_transfer_in: '0'
portfolio_value: '83567.42'
pattern_day_trader: false
trading_blocked: false
transfers_blocked: false
account_blocked: false
created_at: '2022-01-21T21:25:26.713802Z'
trade_suspended_by_user: false
multiplier: '1'
shorting_enabled: false
equity: '83567.42'
last_equity: '41783.71'
long_market_value: '0'
short_market_value: '0'
initial_margin: '0'
maintenance_margin: '0'
last_maintenance_margin: '0'
sma: '0'
daytrade_count: 0
previous_close: '2022-02-08T19:00:00-05:00'
last_long_market_value: '0'
last_short_market_value: '0'
last_cash: '41783.71'
last_initial_margin: '0'
last_regt_buying_power: '41783.71'
last_daytrading_buying_power: '0'
last_buying_power: '41783.71'
last_daytrade_count: 0
clearing_broker: VELOX
description: 'This is an extended version of the Account model found [in the trading api](https://alpaca.markets/docs/api-references/trading-api/account/#account-entity).
Extra data has been added that would be useful for brokers.'
properties:
id:
type: string
example: c8f1ef5d-edc0-4f23-9ee4-378f19cb92a4
format: uuid
description: The account ID
account_number:
type:
- string
- 'null'
example: '927584925'
description: The account number
status:
$ref: '#/components/schemas/AccountStatus'
currency:
type: string
example: USD
description: Always USD
buying_power:
type: string
example: '12345.6789'
format: decimal
description: Current available cash buying power. If multiplier = 2 then buying_power = max(equity-initial_margin(0) * 2). If multiplier = 1 then buying_power = cash.
regt_buying_power:
type: string
example: '12345.6789'
format: decimal
description: User’s buying power under Regulation T (excess equity - (equity - margin value) - * margin multiplier)
daytrading_buying_power:
type: string
example: '12345.6789'
format: decimal
description: Your buying power for day trades (continuously updated value)
cash:
type: string
example: '12345.6789'
format: decimal
description: Cash balance
cash_withdrawable:
type: string
example: '12345.6789'
format: decimal
description: Cash available for withdrawl
cash_transferable:
type: string
example: '12345.6789'
description: Cash available for transfer (JNLC)
pending_transfer_out:
type: string
example: '12345.6789'
description: Cash pending transfer out
portfolio_value:
type: string
example: '12345.6789'
format: decimal
description: Total value of cash + holding positions. (This field is deprecated. It is equivalent to the equity field.)
pattern_day_trader:
type: boolean
example: false
description: Whether account is flagged as pattern day trader or not
trading_blocked:
type: boolean
example: false
description: If true, the account is not allowed to place orders.
transfers_blocked:
type: boolean
example: false
description: If true, the account is not allowed to request money transfers.
account_blocked:
type: boolean
example: false
description: If true, the account activity by user is prohibited.
# --- truncated at 32 KB (80 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/alpaca/refs/heads/main/openapi/alpaca-accounts-api-openapi.yml