alpacahq/alpaca-skills/account-onboarding
Claude Code and agent skill by alpacahq/alpaca-skills
- community
Checking that the SKILL.md file is still in the repository.
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements, document upload (incl. W-8BEN), account status lifecycle, and account updates/closure. Use when a developer is building onboarding, KYC, or account-management flows on Alpaca in any language.
Install
npx vskill@latest install alpacahq/alpaca-skills/account-onboardingSKILL.md
Alpaca Broker API — Account Onboarding & KYC
Create and manage end-user brokerage accounts under your firm. This is the first step of any Broker API integration: no funding, journaling, or trading can happen until an account reaches ACTIVE.
Readalpaca-broker-integrationfirst for base URLs and auth (client-credentials Bearer token; legacy Basic still works).
Reference
- Guide:
https://docs.alpaca.markets/docs/getting-started-with-broker-api,https://docs.alpaca.markets/docs/accounts - API ref:
https://docs.alpaca.markets/reference/createaccount - Live schema:
alpaca-docsMCP →get-endpointtitle"Broker API"path/v1/accounts
1. Endpoints
| Method | Path | Purpose | |
|---|---|---|---|
| POST | /v1/accounts | Create account (submit application) | |
| GET | /v1/accounts | List/query accounts (returns up to 1000) | |
| GET | /v1/accounts/{account_id} | Get one account (AccountExtended) | |
| PATCH | /v1/accounts/{account_id} | Update account | |
| POST | /v1/accounts/{account_id}/actions/close | Close account (returns 204) | |
| POST | /v1/accounts/{account_id}/documents/upload | Upload owner/KYC documents (array body) | |
| GET | /v1/accounts/{account_id}/documents | List uploaded documents | |
| POST / GET | /v1/accounts/{account_id}/cip | Submit / retrieve CIP results | |
| GET | /v1/country-info | Supported-country data | |
| GET | /v1/events/accounts/status | SSE stream of account-status changes → see alpaca-broker-sse-events |
2. Create-account request (POST /v1/accounts)
Four objects are required: contact, identity, disclosures, agreements. documents and trusted_contact are optional but usually needed for KYC.
Key field rules:
contact.street_addressis an array (max 3 lines).contact.staterequired when country/tax-residence isUSA.identity.funding_sourceis an array; one+ ofemployment_income,investments,inheritance,business_income,savings,family.tax_id_typeenum is large and country-specific:USA_SSN,USA_ITIN,IND_PAN,MEX_RFC,GBR_NINO, … plus genericNATIONAL_ID,PASSPORT,DRIVER_LICENSE,OTHER_GOV_ID,NOT_SPECIFIED. Query the spec for the full list rather than hardcoding.- Optional top-level:
account_type(trading|custodial|donor_advised|ira),account_sub_type(IRA:traditional|roth),enabled_assets(us_equity|us_option|crypto|ipo, defaultus_equity),allow_instant_ach(defaultfalse— the partner-side switch for Instant ACH). - Deprecated:
investment_objective/investment_time_horizon/liquidity_needs/risk_tolerancemoved fromidentityto top-level.
Responses: 200 → account object · 409 email already registered · 422 invalid value · 400 malformed body.
3. Agreements
Each entry: agreement (customer_agreement, account_agreement, margin_agreement, crypto_agreement, options_agreement), signed_at (RFC3339), ip_address (IPv4), optional revision. You must present the agreement text to the user and capture the real signing timestamp + IP — Alpaca treats these as the legal record. revision defaults to the currently-active revision if omitted.
4. Documents & W-8BEN
documents[] items: document_type + (content base64 or content_data).
document_typeenum includesidentity_verification,address_verification,date_of_birth_verification,tax_id_verification,w8ben,w9,cip_result, and more.mime_type:application/pdf,image/png,image/jpeg— plusapplication/jsononly forw8ben.- W-8BEN shortcut (lesson): instead of generating a PDF, upload
content_dataas a structuredW8benDocumentJSON object (full_name, country_citizen, permanent_address_*, date_of_birth, ip_address, timestamp, signer_full_name, …) and Alpaca renders the official form for you. This is the clean way to satisfy the tax-form requirement for non-US persons programmatically. - W-8BEN expires. A new form must be submitted every three years, in addition to the calendar year it was signed — schedule the renewal, don't treat the upload as one-and-done.
- Doc size cap: 10 MB per file when using Alpaca's KYC-as-a-service; no cap if you run your own KYC.
5. Account status lifecycle
status (and crypto_status) use the AccountStatus enum:
| Status | Meaning | |
|---|---|---|
INACTIVE | Not enabled for the given asset | |
PAPER_ONLY | Limited to paper trading | |
ONBOARDING | Created but KYC not yet performed — only used with Onfido (the OpenAPI enum text still describes it as "application expected, not yet submitted") | |
SUBMITTED | Submitted, being processed | |
SUBMISSION_FAILED | Submission error; Alpaca resolves these, no action needed | |
ACTION_REQUIRED | Manual action + a document upload from the user (e.g. a true disclosure routes here); see kyc_results | |
APPROVAL_PENDING | The account did not pass the automatic KYC check, so the team reviews manually — usually no document required | |
APPROVED | Approved, waiting to go active | |
ACTIVE | Fully usable — funding & trading allowed | |
REJECTED | Application rejected | |
ACCOUNT_UPDATED | Personal information under review; transient, returns to ACTIVE. Outgoing transfers are restricted meanwhile | |
ACCOUNT_CLOSED | Closed |
Happy path: SUBMITTED → APPROVED → ACTIVE. APPROVAL_PENDING and ACTION_REQUIRED are the exception branches when the automatic KYC check does not pass; either can rejoin at APPROVED or end in REJECTED. (The OpenAPI enum still calls APPROVAL_PENDING the "initial value"; the statuses guide is the newer source.)
Lesson — gate every downstream op on `ACTIVE`. A 200 from POST /v1/accounts does not mean tradable. Subscribe to account-status SSE events (or poll GET /v1/accounts/{id}) and only enable funding/journals/trading once status == ACTIVE. Trying to journal or trade into a non-active account fails. Gate crypto on crypto_status, which tracks separately from status. Treat ACCOUNT_UPDATED as transient-restricted rather than failed — the account returns to ACTIVE after review.
6. KYC results & CIP
kyc_resultson the account object carriesreject/accept/indeterminatesets plusadditional_information.summaryispass/fail(internal only).- `KYCResultType` is an extensible string set, not a closed enum. Examples only:
IDENTITY_VERIFICATION,WATCHLIST_HIT,W8BEN_CORRECTION. Generated code must tolerate and preserve unrecognized values rather than parsing into a fixed enum. The documented identifiers live underKYCResultsathttps://docs.alpaca.markets/reference/getaccount. - If you run KYC yourself (or via Onfido/Trulioo/Veriff/etc.), submit results via
POST /v1/accounts/{id}/cipwith aCIPInfobody (provider_name, kyc, document, photo, identity, watchlist sub-results). Sub-check results areclear/consider. - Minimum to open an individual account: verify name, date of birth, address, and identification number.
WATCHLIST_HITneeds no action from the account owner unless Alpaca separately requests it.
7. Integration guidance & lessons learned
- Normalize inputs to canonical formats before sending. Country fields must be ISO 3166-1 alpha-3 (
USA,PHL, …) — strip any UI decoration (flags/emoji, display names) and validate againstGET /v1/country-info. Garbage incountry/country_of_tax_residenceis a common 422. - Capture real agreement metadata.
signed_atandip_addressmust reflect the actual user action, not server time / a placeholder. - Treat creation as async. Persist the returned
account_idimmediately, then drive UI off the status events, not the create response. - Keep sandbox and live credentials/config in separate deployments. There is nothing in an account id to check — ids are plain UUIDs, and the two environments are separate hosts with separate credentials.
- Idempotency on submit. A
409on duplicate email is your friend — look up the existing account rather than retrying creation. Store your local user↔account_idmapping before the network call so a timeout doesn't orphan an account. - Closing is your responsibility to sequence. Before
POST .../actions/close, you must liquidate all positions and withdraw all cash. The account record is not deleted — it goesACCOUNT_CLOSED.
Related skills: fund the account → alpaca-broker-funding-transfers; move cash in via the firm sweep → alpaca-broker-journals; trade → alpaca-broker-trading-orders; track status in real time → alpaca-broker-sse-events.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/broker-api/account-onboarding/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alpacahq/alpaca-skills/account-onboarding)