openapi: 3.0.0 info: title: Alpaca Broker API description: 'Open brokerage accounts, enable commission-free trading, and manage the ongoing user experience with Alpaca Broker API' version: 1.0.0 servers: - url: 'https://broker-api.sandbox.alpaca.markets/v1' description: Sandbox endpoint - url: 'https://broker-api.alpaca.markets/v1' description: Production endpoint components: securitySchemes: BasicAuth: type: http scheme: basic parameters: ActivityType: in: path name: activity_type required: true schema: type: string enum: - FILL - ACATC - ACATS - CSD - CSR - CSW - DIV - DIVCGL - DIVCGS - DIVNRA - DIVROC - DIVTXEX - INT - JNLC - JNLS - MA - NC - PTC - REORG - SSO - SSP Status: name: status in: query description: Status of the orders to list. schema: type: string enum: - open - closed - all Limit: name: limit in: query description: The maximum number of orders in response. schema: type: integer example: 500 After: name: after in: query description: The response will include only ones submitted after this timestamp (exclusive.) schema: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' Until: name: until in: query description: The response will include only ones submitted until this timestamp (exclusive.) schema: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' Direction: name: direction in: query description: The chronological order of response based on the submission time. asc or desc. Defaults to desc. schema: type: string enum: - asc - desc example: desc Nested: name: nested in: query description: 'If true, the result will roll up multi-leg orders under the legs field of primary order.' schema: type: boolean example: false Symbols: name: symbols in: query description: A comma-separated list of symbols to filter by. schema: type: string example: 'AAPL,TSLA,MSFT' AccountID: name: account_id in: path required: true description: Account identifier. schema: type: string format: uuid OrderID: name: order_id in: path required: true description: Order identifier. schema: type: string DocumentID: name: document_id in: path required: true description: Document identifier. schema: type: string format: uuid schemas: Account: type: object properties: id: type: string format: uuid account_number: type: string status: $ref: '#/components/schemas/AccountStatus' currency: type: string description: Always "USD" created_at: type: string format: date-time last_equity: type: string format: decimal kyc_results: $ref: '#/components/schemas/KYCResult' example: id: 0d18ae51-3c94-4511-b209-101e1666416b account_number: '9034005019' status: APPROVED currency: USD created_at: '2019-09-30T23:55:31.185998Z' last_equity: '1500.65' AccountStatus: type: string example: ACTIVE enum: - SUBMITTED - ACTION_REQUIRED - EDITED - APPROVAL_PENDING - APPROVED - REJECTED - ACTIVE - DISABLED - ACCOUNT_CLOSED - ONBOARDING description: | - **SUBMITTED** The application has been submitted and in process. - **ACTION_REQUIRED** The application requires manual action. - **EDITED** Application was edited (e.g. to match info from uploaded docs). This is a transient status. - **APPROVAL_PENDING** Initial value. The application approval process is in process. - **APPROVED** The account application has been approved, and waiting to be ACTIVE - **REJECTED** The account application is rejected for some reason - **ACTIVE** The account is fully active. Trading and funding are processed under this status. - **DISABLED** The account is disabled after ACTIVE status. - **ACCOUNT_CLOSED** The account is closed. - **ONBOARDING** The account is currently being created. AccountExtended: type: object properties: id: type: string format: uuid account_number: type: string status: $ref: '#/components/schemas/AccountStatus' currency: type: string description: Always "USD" created_at: type: string format: date-time last_equity: type: string format: decimal kyc_results: $ref: '#/components/schemas/KYCResult' contact: $ref: '#/components/schemas/Contact' identity: $ref: '#/components/schemas/Identity' disclosures: $ref: '#/components/schemas/Disclosures' agreements: $ref: '#/components/schemas/Agreements' documents: type: array items: $ref: '#/components/schemas/ApplicationDocument' trusted_contact: $ref: '#/components/schemas/TrustedContact' AccountUpdateRequest: type: object properties: contact: $ref: '#/components/schemas/Contact' identity: $ref: '#/components/schemas/Identity' disclosures: $ref: '#/components/schemas/Disclosures' trustedContact: $ref: '#/components/schemas/TrustedContact' AccountDocument: type: object description: | If an account has documents on the application submission, it has the ApplicationDocument model in exchange with DocumentUploadRequest. properties: id: type: string format: uuid document_type: $ref: '#/components/schemas/DocumentType' document_sub_type: type: string mime_type: type: string created_at: type: string format: date-time required: - id - document_type - created_at example: id: 0d18ae51-3c94-4511-b209-101e1666416b document_type: identity_verification document_sub_type: passport mime_type: image/jpeg created_at: '2019-09-30T23:55:31.185998Z' AccountCreationRequest: type: object properties: contact: $ref: '#/components/schemas/Contact' identity: $ref: '#/components/schemas/Identity' disclosures: $ref: '#/components/schemas/Disclosures' agreements: $ref: '#/components/schemas/Agreements' documents: type: array items: $ref: '#/components/schemas/DocumentUploadRequest' trusted_contact: $ref: '#/components/schemas/TrustedContact' title: AccountCreationRequest ApplicationDocument: type: object description: | If an account has documents on the application submission, it has the ApplicationDocument model in exchange with DocumentUpload. properties: id: type: string format: uuid document_type: $ref: '#/components/schemas/DocumentType' document_sub_type: type: string mime_type: type: string created_at: type: string format: date-time required: - id - document_type - created_at example: id: 0d18ae51-3c94-4511-b209-101e1666416b document_type: identity_verification document_sub_type: passport mime_type: image/jpeg created_at: '2019-09-30T23:55:31.185998Z' DocumentUpload: type: object description: | If an account has documents after the submission, it has the Document model in exchange with DocumentUpload. properties: document_type: $ref: '#/components/schemas/DocumentType' document_sub_type: type: string example: passport content: type: string format: base64 example: /9j/Cg== mime_type: type: string example: image/jpeg required: - document_type - content - mime_type example: document_type: identity_verification document_sub_type: passport content: /9j/Cg== mime_type: image/jpeg Activity: title: Activity type: object description: Base for activity types properties: id: type: string format: uuid example: 88b5f678-fef5-447b-af15-f21e367e6d8c account_id: type: string format: uuid example: c8f1ef5d-edc0-4f23-9ee4-378f19cb92a4 activity_type: $ref: '#/components/schemas/ActivityType' ActivityType: title: ActivityType type: string enum: - FILL - ACATC - ACATS - CSD - CSR - CSW - DIV - DIVCGL - DIVCGS - DIVNRA - DIVROC - DIVTXEX - INT - JNLC - JNLS - MA - NC - PTC - REORG - SSO - SSP TradeActivity: title: TradeActivity allOf: - $ref: '#/components/schemas/Activity' - type: object properties: transaction_time: type: string format: timestamp example: '2021-05-10T14:01:04.650275Z' type: type: string enum: - fill - partial_fill example: fill price: type: string example: '3.1415' qty: type: string example: '0.38921' side: type: string enum: - buy - sell example: sell symbol: type: string example: AAPL leaves_qty: type: string example: '0.5123' order_id: type: string format: uuid example: fe060a1b-5b45-4eba-ba46-c3a3345d8255 cum_qty: type: string example: '0.9723' order_status: type: string enum: - new - partially_filled - filled - done_for_day - canceled - expired - replaced - pending_cancel - pending_replace - accepted - pending_new - accepted_for_bidding - stopped - rejected - suspended - calculated example: filled NonTradeActivity: title: NonTradeActivity allOf: - $ref: '#/components/schemas/Activity' - type: object properties: date: type: string format: date example: '2021-05-21' net_amount: type: string example: '1234' description: type: string example: Example description status: type: string enum: - executed - correct - canceled example: executed symbol: type: string example: AAPL qty: type: string example: '0.38921' per_share_amount: type: string example: '0.38921' ActivityItem: title: ActivityItem anyOf: - $ref: '#/components/schemas/TradeActivity' - $ref: '#/components/schemas/NonTradeActivity' DocumentType: type: string enum: - identity_verification - address_verification - date_of_birth_verification - tax_id_verification - account_approval_letter - cip_result description: | - identity_verification: identity verification document - address_verification: address verification document - date_of_birth_verification: date of birth verification document - tax_id_verification: tax ID verification document - account_approval_letter: 407 approval letter - cip_result: initial CIP result example: identity_verification DocumentUploadRequest: type: object description: | If an account has documents after the submission, it has the Document model in exchange with DocumentUploadRequest. properties: document_type: $ref: '#/components/schemas/DocumentType' document_sub_type: type: string example: passport content: type: string format: base64 example: /9j/Cg== mime_type: type: string example: image/jpeg required: - document_type - content - mime_type example: document_type: identity_verification document_sub_type: passport content: /9j/Cg== mime_type: image/jpeg title: DocumentUploadRequest KYCResult: type: object description: Hold information about the result of KYC. properties: reject: type: object accept: type: object indeterminate: type: object addidional_information: type: string StreetAddress: type: string example: 20 N San Mateo Dr Contact: type: object description: | Contact is the model for the account owner contact information. properties: email_address: type: string format: email example: john.doe@example.com phone_number: type: string description: 'with country code, no hyphen or space' example: '+15556667788' street_address: type: array items: $ref: '#/components/schemas/StreetAddress' city: type: string example: San Mateo state: type: string example: CA postal_code: type: string example: '94401' Identity: type: object description: | Identity is the model to provide account owner’s identity information. properties: given_name: type: string example: John family_name: type: string example: Doe date_of_birth: type: string format: date example: '1990-01-01' tax_id: type: string example: 666-55-4321 tax_id_type: type: string enum: - USA_SSN - AUS_TFN - AUS_ABN - DEU_TAX_ID - FRA_SPI - GBR_UTR - GBR_NINO - HUN_TIN - IND_PAN - ISR_TAX_ID - ITA_TAX_ID - JPN_TAX_ID - NLD_TIN - SGP_NRIC - SGP_FIN - SGP_ASGD - SGP_ITR - SWE_TAX_ID - NOT_SPECIFIED country_of_citizenship: type: string description: | [ISO 3166-1 alpha-3](https://www.iso.org/iso-3166-country-codes.html). example: USA country_of_birth: type: string description: | [ISO 3166-1 alpha-3](https://www.iso.org/iso-3166-country-codes.html). example: USA country_of_tax_residence: type: string description: | [ISO 3166-1 alpha-3](https://www.iso.org/iso-3166-country-codes.html). example: USA funding_source: type: array items: type: string enum: - employment_income - investments - inheritance - business_income - savings - family annual_income_min: type: number annual_income_max: type: number liquid_net_worth_min: type: number liquid_net_worth_max: type: number total_net_worth_min: type: number total_net_worth_max: type: number extra: type: object description: | any extra information used for KYC purposes required: - given_name - family_name - date_of_birth - country_of_tax_residence - funding_source example: given_name: John family_name: Doe date_of_birth: '1990-01-01' tax_id: 666-55-4321 tax_id_type: USA_SSN country_of_citizenship: AUS country_of_birth: AUS country_of_tax_residence: USA funding_source: - employment_income Disclosures: type: object description: | Disclosures fields denote if the account owner falls under each category defined by FINRA rule. The client has to ask questions for the end user and the values should reflect their answers. If one of the answers is true (yes), the account goes into ACTION_REQUIRED status. properties: employment_status: type: string enum: - unemployed - employed - student - retired employer_name: type: string employer_address: type: string employment_position: type: string is_control_person: type: boolean is_affiliated_exchange_or_finra: type: boolean is_politically_exposed: type: boolean immediate_family_exposed: type: boolean required: - is_control_person - is_affiliated_exchange_or_finra - is_politically_exposed - immediate_family_exposed example: is_control_person: false is_affiliated_exchange_or_finra: false is_politically_exposed: false immediate_family_exposed: false Agreement: type: object properties: agreement: type: string enum: - margin_agreement - account_agreement - customer_agreement description: | - margin_agreement: Alpaca Margin Agreement - account_agreement: Alpaca Account Agreement - customer_agreement: Alpaca Customer Agreement signed_at: type: string example: '2019-09-11T18:09:33Z' ip_address: type: string format: ipv4 example: 185.13.21.99 required: - agreement - signed_at - ip_address Agreements: type: array description: | The client has to present Alpaca Account Agreement and Margin Agreement to the end user, and have them read full sentences. items: $ref: '#/components/schemas/Agreement' TrustedContact: type: object description: | This model input is optional. However, the client should make reasonable effort to obtain the trusted contact information. See more details in [FINRA Notice 17-11](https://www.finra.org/sites/default/files/Regulatory-Notice-17-11.pdf) properties: given_name: type: string example: Jane family_name: type: string example: Doe email_address: type: string format: email description: | at least one of `email_address`, `phone_number` or `street_address` is required example: jane.doe@example.com phone_number: type: string description: | at least one of `email_address`, `phone_number` or `street_address` is required street_address: type: array items: type: string description: | at least one of `email_address`, `phone_number` or `street_address` is required city: type: string description: | required if `street_address` is set state: type: string description: | required if `street_address` is set postal_code: type: string description: | required if `street_address` is set country: type: string description: | [ISO 3166-1 alpha-3](https://www.iso.org/iso-3166-country-codes.html). required if `street_address` is set required: - given_name - family_name example: given_name: Jane family_name: Doe email_address: jane.doe@example.com CreateOrderRequest: type: object properties: symbol: type: string example: AAPL qty: type: string format: decimal example: '4.124' notional: type: string format: decimal example: '3' side: type: string enum: - buy - sell example: buy type: type: string enum: - market - limit - stop - stop_limit - trailing_stop example: limit time_in_force: type: string enum: - day - gtc - opg - cls - ioc - fok example: gtc limit_price: type: string format: decimal example: '3.14' stop_price: type: string format: decimal example: '3.14' trail_price: type: string format: decimal example: '3.14' trail_percent: type: string format: decimal example: '5.0' extended_hours: type: boolean example: false client_order_id: type: string example: eb9e2aaa-f71a-4f51-b5b4-52a6c565dad4 order_class: type: string enum: - simple - bracket - oco - oto example: simple take_profit: type: object properties: limit_price: type: string format: decimal example: '3.14' stop_loss: type: object properties: stop_price: type: string format: decimal example: '3.14' limit_price: type: string format: decimal example: '3.14' commission: type: string format: decimal example: '1.0' required: - symbol - side - type - time_in_force Order: type: object properties: id: type: string format: uuid example: 61e69015-8549-4bfd-b9c3-01e75843f47d client_order_id: type: string example: 61e69015-8549-4bfd-b9c3-01e75843f47d created_at: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' updated_at: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' submitted_at: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' filled_at: nullable: true type: string format: date-time example: '2021-03-16T18:38:01.942282Z' expired_at: nullable: true type: string format: date-time example: '2021-03-16T18:38:01.942282Z' canceled_at: nullable: true type: string format: date-time example: '2021-03-16T18:38:01.942282Z' failed_at: nullable: true type: string format: date-time example: '2021-03-16T18:38:01.942282Z' replaced_at: nullable: true type: string format: date-time example: '2021-03-16T18:38:01.942282Z' replaced_by: nullable: true type: string format: uuid example: 61e69015-8549-4bfd-b9c3-01e75843f47d replaces: nullable: true type: string format: uuid example: 61e69015-8549-4bfd-b9c3-01e75843f47d asset_id: type: string format: uuid example: 61e69015-8549-4bfd-b9c3-01e75843f47d symbol: type: string example: AALP asset_class: type: string enum: - us_equity - crypto notional: nullable: true type: string format: decimal example: '4.2' qty: nullable: true type: string format: decimal example: '4.2' filled_qty: type: string format: decimal example: '4.2' filled_avg_price: nullable: true type: string format: decimal example: '4.2' order_class: type: string enum: - simple - bracket - oco - oto example: bracket order_type: type: string enum: - market - limit - stop - stop_limit - trailing_stop example: stop type: type: string enum: - market - limit - stop - stop_limit - trailing_stop example: stop side: type: string enum: - buy - sell example: buy time_in_force: type: string enum: - day - gtc - opg - cls - ioc - fok example: gtc limit_price: nullable: true type: string format: decimal example: '3.14' stop_price: nullable: true type: string format: decimal example: '3.14' status: type: string enum: - new - partially_filled - filled - done_for_day - canceled - expired - replaced - pending_cancel - pending_replace - accepted - pending_new - accepted_for_bidding - stopped - rejected - suspended - calculated example: filled extended_hours: type: boolean example: true legs: nullable: true type: array items: $ref: '#/components/schemas/Order' trail_price: nullable: true type: string format: decimal example: '3.14' trail_percent: nullable: true type: string format: decimal example: '5.0' hwm: nullable: true type: string format: decimal example: '3.14' commission: type: string format: decimal example: '3.14' required: - id UpdateOrderRequest: type: object properties: qty: type: string format: decimal example: '4.2' time_in_force: type: string enum: - day - gtc - opg - cls - ioc - fok example: gtc limit_price: type: string format: decimal example: '3.14' stop_price: type: string format: decimal example: '3.14' trail: type: string format: decimal example: '3.14' client_order_id: type: string example: 61e69015-8549-4bfd-b9c3-01e75843f47d created_at: type: string format: date-time updated_at: type: string format: date-time required: - id - created_at - updated_at title: OrderUpdateRequest description: '' BankResource: allOf: - $ref: '#/components/schemas/IdentifiedResource' - $ref: '#/components/schemas/BankData' - type: object properties: account_id: type: string format: uuid status: type: string enum: - QUEUED - CANCEL_REQUESTED - SENT_TO_CLEARING - APPROVED - CANCELED required: - account_id - status BankData: title: BankData type: object properties: name: type: string bank_code: type: string bank_code_type: type: string enum: - ABA - BIC country: type: string state_province: type: string postal_code: type: string city: type: string street_address: type: string account_number: type: string required: - name - bank_code - bank_code_type - account_number IdentifiedResource: title: IdentifiedResource type: object properties: id: type: string format: uuid example: 61e69015-8549-4bfd-b9c3-01e75843f47d created_at: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' updated_at: type: string format: date-time example: '2021-03-16T18:38:01.942282Z' required: - id - created_at - updated_at ACHRelationshipData: description: '' type: object properties: account_owner_name: type: string minLength: 1 bank_account_type: type: string minLength: 1 enum: - CHECKING - SAVINGS bank_account_number: type: string minLength: 1 bank_routing_number: type: string minLength: 1 nickname: type: string minLength: 1 required: - account_owner_name - bank_account_type - bank_account_number - bank_routing_number title: ACHRelationshipData ACHRelationshipResource: title: ACHRelationshipResource allOf: - $ref: '#/components/schemas/IdentifiedResource' - $ref: '#/components/schemas/ACHRelationshipData' - type: object properties: account_id: type: string format: uuid status: type: string enum: - QUEUED - APPROVED - PENDING - CANCEL_REQUESTED required: - account_id - status UntypedACHTransferData: title: UntypedACHTransferData allOf: - $ref: '#/components/schemas/UntypedTransferData' - type: object properties: relationship_id: type: string format: uuid required: - relationship_id TransferResource: title: TransferResource allOf: - $ref: '#/components/schemas/IdentifiedResource' - type: object properties: type: type: string enum: - ach - wire status: type: string enum: - QUEUED - APPROVAL_PENDING - PENDING - SENT_TO_CLEARING - REJECTED - CANCELED - APPROVED - COMPLETE - RETURNED account_id: type: string format: uuid reason: type: string nullable: true expires_at: type: string format: date-time required: - type - status - account_id - expires_at - oneOf: - $ref: '#/components/schemas/UntypedACHTransferData' - $ref: '#/components/schemas/UntypedWireTransferData' discriminator: propertyName: type mapping: ach: '#/components/schemas/UntypedACHTransferData' wire: '#/components/schemas/UntypedWireTransferData' TransferData: title: TransferData allOf: - type: object properties: transfer_type: type: string enum: - ach - wire timing: type: string enum: - immediate required: - transfer_type - oneOf: - $ref: '#/components/schemas/UntypedACHTransferData' - $ref: '#/components/schemas/UntypedWireTransferData' discriminator: propertyName: transfer_type mapping: ach: '#/components/schemas/UntypedACHTransferData' wire: '#/components/schemas/UntypedWireTransferData' UntypedWireTransferData: allOf: - $ref: '#/components/schemas/UntypedTransferData' - type: object properties: additional_information: type: string bank_id: type: string format: uuid required: - bank_id title: UntypedWireTransferData UntypedTransferData: title: UntypedTransferData type: object properties: amount: type: string format: decimal direction: type: string enum: - INCOMING - OUTGOING required: - amount - direction Journal: title: Journal example: id: h7h5g33f-ef01-4458-9a4b-9598727a406f entry_type: JNLS from_account: 8fjkjn-4483-4199-840f-6c5fe0b7ca24 to_account: 3gtt65jd-6f2a-433c-8c33-17b66b8941fa status: executed symbol: AAPL qty: '2' price: '128.23' x-examples: example: id: h7h5g33f-ef01-4458-9a4b-9598727a406f entry_type: JNLS from_account: 8fjkjn-4483-4199-840f-6c5fe0b7ca24 to_account: 3gtt65jd-6f2a-433c-8c33-17b66b8941fa status: executed symbol: AAPL qty: '2' settle_date: '2020-12-24' price: '128.23' description: 'Represents a cash or security transfer between accounts, as specified by the `entry_type` parameter.' allOf: - type: object properties: id: type: string format: uuid description: journal ID entry_type: type: string description: 'JNLS, for transfers of securities, or JNLC, for transfers of cash.' enum: - JNLS - JNLC from_account: type: string format: uuid description: account ID the shares go from to_account: type: string format: uuid description: account ID the shares go to settle_date: type: string format: date status: type: string enum: - pending - canceled - executed - queued - rejected - deleted required: - id - entry_type - from_account - to_account - settle_date - anyOf: - $ref: '#/components/schemas/JNLS' - $ref: '#/components/schemas/JNLC' JNLS: example: id: h7h5g33f-ef01-4458-9a4b-9598727a406g entry_type: JNLS from_account: 8fjkjn-4483-4199-840f-6c5fe0b7ca24 to_account: 3gtt65jd-6f2a-433c-8c33-17b66b8941fa status: executed symbol: AAPL qty: '2' price: '128.23' x-examples: example-1: id: h7h5g33f-ef01-4458-9a4b-9598727a406f entry_type: JNLS from_account: 8fjkjn-4483-4199-840f-6c5fe0b7ca24 to_account: 3gtt65jd-6f2a-433c-8c33-17b66b8941fa status: executed symbol: AAPL qty: '2' price: '128.23' title: JNLS type: object description: 'Journal information specific to securities transfers. This field is required for `Journal`s with an `entry_type` of `jnls` (securities transfers), but will be null for those with `jnlc` (cash transfers).' properties: symbol: type: string description: Only valid for JNLS journals. Null for JNLC. qty: type: string format: decimal description: Only valid for JNLS journals. Null for JNLC. price: type: string format: decimal description: Only valid for JNLS journals. Null for JNLC. required: - symbol - qty - price JNLC: example: id: f45g67h8-d1fc-4136-aa4f-cf4460aecdfc entry_type: JNLC from_account: 8fjkjn-4483-4199-840f-6c5fe0b7ca24 to_account: 3gtt65jd-6f2a-433c-8c33-17b66b8941fa status: pending net_amount: '115.5' description: 'Journal information specific to cash transfers. This field is required for `Journal`s with an `entry_type` of `jnlc` (cash transfers), but will be null for those with `jnls` (securities transfers).' type: object title: JNLC properties: description: type: string description: ID the amount goes to. Only valid for JNLC journals. Null for JNLS. net_amount: type: string format: decimal description: Only valid for JNLC journals. Null for JNLS. transmitter_name: type: string description: Only valid for JNLC journals. Null for JNLS. Max 255 characters. transmitter_account_number: type: string description: Only valid for JNLC journals. Null for JNLS.max 255 characters transmitter_address: type: string description: Only valid for JNLC journals. Null for JNLS.max 255 characters transmitter_financial_institution: type: string description: Only valid for JNLC journals. Null for JNLS.max 255 characters transmitter_timestamp: type: string format: date-time description: Only valid for JNLC journals. Null for JNLS. required: - net_amount x-examples: {} JournalData: title: JournalData type: object properties: entry_type: type: string enum: - JNLC - JNLS from_account: type: string format: uuid to_account: type: string format: uuid amount: type: string format: decimal description: | Required for JNLC. The dollar amount to move. It has to be a positive value. symbol: type: string description: | Required for JNLS. qty: type: string format: decimal description: | Required for JNLS. The number of shares to move. It has to be a positive value. required: - entry_type - from_account - to_account JournalResource: title: JournalResource oneOf: - $ref: '#/components/schemas/JNLC' - $ref: '#/components/schemas/JNLS' discriminator: propertyName: entry_type mapping: JNLC: '#/components/schemas/JNLC' JNLS: '#/components/schemas/JNLS' BatchJournalRequest: title: BatchJournalRequest type: object properties: entry_type: type: string enum: - JNLC from_account: type: string format: uuid description: type: string entries: type: array items: type: object properties: to_account: type: string format: uuid amount: type: string required: - to_account - amount required: - entry_type - from_account BatchJournalResponse: title: BatchJournalResponse type: object properties: id: type: string format: uuid error_message: type: string entry_type: type: string enum: - JNLC from_account: type: string format: uuid to_account: type: string format: uuid symbol: type: string qty: type: string nullable: true price: type: string status: type: string enum: - pending - canceled - executed - queued - rejected - deleted settle_date: type: string nullable: true system_date: type: string nullable: true net_amount: type: string description: type: string required: - id - error_message - entry_type - from_account - to_account - symbol - qty - price - status - settle_date - system_date - net_amount - description Asset: title: Asset type: object properties: id: type: string example: 904837e3-3b76-47ec-b432-046db621571b class: type: string enum: - us_equity - crypto exchange: type: string example: NASDAQ symbol: type: string example: AAPL name: type: string example: Apple Inc. Common Stock status: type: string enum: - active - inactive tradable: type: boolean example: true marginable: type: boolean example: true shortable: type: boolean example: true easy_to_borrow: type: boolean example: true fractionable: type: boolean example: true required: - id - symbol Position: description: '' type: object x-examples: {} properties: asset_id: type: string example: 904837e3-3b76-47ec-b432-046db621571b format: uuid symbol: type: string example: AAPL exchange: type: string example: NASDAQ asset_class: type: string enum: - us_equity - crypto example: us_equity avg_entry_price: type: string example: '100.0' qty: type: string example: '5' side: type: string example: long enum: - long market_value: type: string example: '600.0' cost_basis: type: string example: '500.0' unrealized_pl: type: string example: '100.0' unrealized_plpc: type: string example: '0.20' unrealized_intraday_pl: type: string example: '10.0' unrealized_intraday_plpc: type: string example: '0.0084' current_price: type: string example: '120.0' lastday_price: type: string example: '119.0' change_today: type: string example: '0.0084' MarketDay: title: MarketDay type: object properties: date: type: string example: '2021-04-06' open: type: string example: '09:30' close: type: string example: '16:00' session_open: type: string example: '0700' session_close: type: string example: '1900' required: - date - open - close Error: title: Error type: object properties: code: type: number message: type: string required: - code - message Clock: description: Represents the current market time and open/close events. type: object x-examples: example: timestamp: '2018-04-01T12:00:00.000Z' is_open: true next_open: '2018-04-01T12:00:00.000Z' next_close: '2018-04-01T12:00:00.000Z' properties: timestamp: type: string minLength: 1 format: time is_open: type: boolean next_open: type: string minLength: 1 format: date-time next_close: type: string minLength: 1 format: date-time required: - timestamp - is_open - next_open - next_close Document: type: array description: '' minItems: 1 uniqueItems: true x-examples: example: - document_id: b792e8ae-2cb4-4209-85b9-32be4c2fcdd6 document_type: account_statement document_date: '2019-08-24' items: type: object properties: document_id: type: string minLength: 1 format: uuid document_type: $ref: '#/components/schemas/DocumentType' document_date: type: string minLength: 1 format: date-time required: - document_id - document_type - document_date AccountStatusEvent: description: '' type: object x-examples: example: account_id: 449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65 account_number: string status_from: string status_to: string reason: string at: '2019-08-24T14:15:22Z' title: AccountStatusEvent properties: account_id: type: string minLength: 1 account_number: type: string minLength: 1 status_from: type: string minLength: 1 status_to: type: string minLength: 1 reason: type: string minLength: 1 at: type: string minLength: 1 kyc_result: $ref: '#/components/schemas/KYCResult' required: - account_id - account_number - status_from - status_to - reason - at TradeUpdatesEvent: description: '' type: object title: TradeUpdatesEvent properties: account_id: type: string minLength: 1 at: type: string minLength: 1 event: type: string event_id: type: integer execution_id: type: integer order: $ref: '#/components/schemas/Order' required: - account_id - at - event - event_id - execution_id - order Watchlist: title: Watchlist type: object description: Represents a set of securities observed by a user. properties: id: type: string format: uuid description: | Unique identifier of the watchlist itself. account_id: type: string format: uuid description: | Unique identifier of the account that owns this watchlist. created_at: type: string format: date-time updated_at: type: string format: date-time name: type: string assets: type: array items: $ref: '#/components/schemas/Asset' required: - id - name responses: Forbidden: description: Request is forbidden content: application/json: schema: type: string BadRequest: description: Malformed input. content: application/json: schema: $ref: '#/components/schemas/Error' NotAuthorized: description: Client is not authorized for this operation. content: application/json: schema: $ref: '#/components/schemas/Error' NotFound: description: Resource does not exist. content: application/json: schema: $ref: '#/components/schemas/Error' requestBodies: {} paths: /accounts: get: security: - BasicAuth: [] tags: - Accounts summary: Retrieve all accounts parameters: - name: query in: query schema: type: string description: | The query supports partial match of account number, names, emails, etc.. Items can be space delimited. 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' post: security: - BasicAuth: [] 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 '422': description: One of the input values is not a valid value. content: application/json: schema: type: string '/accounts/{account_id}': get: security: - BasicAuth: [] summary: Retrieve an account. tags: - Accounts description: The response is an Account model. parameters: - $ref: '#/components/parameters/AccountID' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AccountExtended' operationId: get_account patch: security: - BasicAuth: [] tags: - Accounts summary: Update an account parameters: - $ref: '#/components/parameters/AccountID' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AccountUpdateRequest' 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 '422': description: One of the input values is not a valid value. content: application/json: schema: type: string operationId: patch_account delete: security: - BasicAuth: [] summary: Request to close an account tags: - Accounts parameters: - $ref: '#/components/parameters/AccountID' responses: '204': description: No content. operationId: delete_account description: '' '/accounts/{account_id}/documents': get: security: - BasicAuth: [] summary: Return a list of account documents. tags: - Documents description: | You can query account documents such as monthly statements and trade confirms under an account. parameters: - name: account_id in: path required: true description: Account identifier. schema: type: string format: uuid - name: start_date in: query description: optional date value to filter the list (inclusive). schema: type: string format: date - name: end_date in: query description: optional date value to filter the list (inclusive). schema: type: string format: date responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Document' examples: {} '404': description: Not found content: application/json: schema: type: string '/accounts/{account_id}/documents/upload': post: security: - BasicAuth: [] tags: - Accounts summary: Upload a document to an already existing account parameters: - $ref: '#/components/parameters/AccountID' 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 '/accounts/{account_id}/recipient_banks': get: security: - BasicAuth: [] tags: - Funding - Accounts summary: Retrieve bank relationships for an account parameters: - name: account_id in: path required: true schema: type: string format: uuid - name: status in: query schema: type: string - 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/BankResource' '400': description: Bad request. The body in the request is not valid. operationId: get_recipient_banks description: '' post: security: - BasicAuth: [] tags: - Funding - Accounts summary: Create a Bank Relationship for an account parameters: - $ref: '#/components/parameters/AccountID' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BankData' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/BankResource' '400': description: Bad Request '409': description: Conflict operationId: post_recipient_banks '/accounts/{account_id}/recipient_banks/{bank_id}': delete: security: - BasicAuth: [] tags: - Accounts - Funding summary: Delete a Bank Relationship for an account parameters: - $ref: '#/components/parameters/AccountID' - name: bank_id in: path required: true schema: type: string responses: '204': description: Success (No Content) '400': description: Bad Request '404': description: Bank Not Found operationId: delete_recipient_bank description: '' '/accounts/{account_id}/transfers': get: security: - BasicAuth: [] summary: Return a list of transfers for an account. tags: - Funding - Accounts description: | You can filter requested transfers by values such as direction and status. parameters: - name: account_id in: path required: true schema: type: string format: uuid - name: direction in: query schema: enum: - INCOMING - OUTGOING type: string - 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/TransferResource' operationId: get_transfers post: security: - BasicAuth: [] summary: Request a new transfer tags: - Funding - Accounts description: | This operation allows you to fund an account with virtual money in the sandbox environment. parameters: - name: account_id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TransferData' responses: '200': description: Successfully requested a transfer. content: application/json: schema: $ref: '#/components/schemas/TransferResource' operationId: post_transfers /accounts/activities: get: security: - BasicAuth: [] tags: - Accounts summary: Retrieve account activities parameters: - name: date in: query schema: type: string - name: until in: query schema: type: string - name: after in: query schema: type: string - name: direction in: query schema: type: string enum: - asc - desc - name: account_id in: query schema: type: string format: uuid - name: page_size in: query schema: type: integer minimum: 1 maximum: 100 default: 100 - name: page_token in: query schema: type: string responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/ActivityItem' '/accounts/activities/{activity_type}': get: security: - BasicAuth: [] tags: - Accounts parameters: - $ref: '#/components/parameters/ActivityType' - name: date in: query schema: type: string - name: until in: query schema: type: string - name: after in: query schema: type: string - name: direction in: query schema: type: string enum: - asc - desc - name: account_id in: query schema: type: string format: uuid - name: page_size in: query schema: type: integer minimum: 1 maximum: 100 default: 100 - name: page_token in: query schema: type: string summary: Retrieve specific account activities responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/ActivityItem' '/accounts/{account_id}/ach_relationships': parameters: - $ref: '#/components/parameters/AccountID' get: summary: Retrieve ACH Relationships for an account tags: - Accounts - Funding responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/ACHRelationshipResource' operationId: get_ach_relationships security: - BasicAuth: [] parameters: - schema: type: string in: query name: statuses description: Comma-separated status values post: summary: Create an ACH Relationship operationId: post_ach_relationships responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/ACHRelationshipResource' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/NotAuthorized' '403': description: The account already has an active relationship. content: application/json: schema: $ref: '#/components/schemas/Error' description: '' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ACHRelationshipData' security: - BasicAuth: [] tags: - Accounts - Funding '/accounts/{account_id}/ach_relationships/{ach_relationship_id}': parameters: - $ref: '#/components/parameters/AccountID' - schema: type: string format: uuid name: ach_relationship_id in: path required: true description: ACH relationship identifier delete: summary: Delete an existing ACH relationship operationId: delete_ach_relationship responses: '204': description: Success (No Content) '404': $ref: '#/components/responses/NotFound' '422': description: Cancelation is already in progress. content: application/json: schema: $ref: '#/components/schemas/Error' security: - BasicAuth: [] tags: - Accounts - Funding '/accounts/{account_id}/transfers/{transfer_id}': parameters: - schema: type: string name: account_id in: path required: true - schema: type: string name: transfer_id in: path required: true delete: summary: Request to close a transfer operationId: delete_transfer responses: '204': description: Success (No Content) '404': $ref: '#/components/responses/NotFound' security: - BasicAuth: [] tags: - Accounts - Funding '/trading/accounts/{account_id}/account': get: operationId: get_trading_account security: - BasicAuth: [] summary: Retrieve trading details for an account. tags: - Accounts description: The response is a Trading Account model. parameters: - $ref: '#/components/parameters/AccountID' responses: '200': description: OK content: application/json: schema: type: object properties: id: type: string example: c8f1ef5d-edc0-4f23-9ee4-378f19cb92a4 account_number: type: string example: '927584925' status: $ref: '#/components/schemas/AccountStatus' currency: type: string example: USD buying_power: type: string example: '12345.6789' regt_buying_power: type: string example: '12345.6789' daytrading_buying_power: type: string example: '12345.6789' cash: type: string example: '12345.6789' cash_withdrawable: type: string example: '12345.6789' cash_transferable: type: string example: '12345.6789' pending_transfer_out: type: string example: '12345.6789' portfolio_value: type: string example: '12345.6789' pattern_day_trader: type: boolean example: false trading_blocked: type: boolean example: false transfers_blocked: type: boolean example: false account_blocked: type: boolean example: false created_at: type: string example: '2021-03-01T13:28:49.270232Z' trade_suspended_by_user: type: boolean example: false multiplier: type: string example: '2.0' shorting_enabled: type: boolean example: false equity: type: string example: '12345.6789' last_equity: type: string example: '12345.6789' long_market_value: type: string example: '12345.6789' short_market_value: type: string example: '0' initial_margin: type: string example: '12345.6789' maintenance_margin: type: string example: '12345.6789' last_maintenance_margin: type: string example: '12345.6789' sma: type: string example: '12345.6789' daytrade_count: type: integer example: 0 previous_close: type: string example: '2021-04-01T19:00:00-04:00' last_long_market_value: type: string example: '12345.6789' last_short_market_value: type: string example: '0' last_cash: type: string example: '12345.6789' last_initial_margin: type: string example: '12345.6789' last_regt_buying_power: type: string example: '12345.6789' last_daytrading_buying_power: type: string example: '12345.6789' last_buying_power: type: string example: '12345.6789' last_daytrade_count: type: integer example: 0 clearing_broker: type: string example: Velox '/trading/accounts/{account_id}/positions': parameters: - $ref: '#/components/parameters/AccountID' get: summary: List open positions for an account tags: - Trading responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Position' operationId: get_positions security: - BasicAuth: [] '/trading/accounts/{account_id}/orders/{order_id}': parameters: - $ref: '#/components/parameters/AccountID' - $ref: '#/components/parameters/OrderID' get: security: - BasicAuth: [] summary: Retrieves a single order for the given order_id. tags: - Trading description: Retrieves a single order for the given order_id. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Order' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' operationId: get_order patch: security: - BasicAuth: [] summary: Replaces a single order with updated parameters. Each parameter overrides the corresponding attribute of the existing order. tags: - Trading description: Replaces a single order with updated parameters. Each parameter overrides the corresponding attribute of the existing order. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateOrderRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Order' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' operationId: patch_order delete: security: - BasicAuth: [] summary: Attempts to cancel an open order. tags: - Trading description: Attempts to cancel an open order. responses: '204': description: OK '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' operationId: delete_order '/trading/accounts/{account_id}/orders': parameters: - $ref: '#/components/parameters/AccountID' get: parameters: - $ref: '#/components/parameters/Status' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/After' - $ref: '#/components/parameters/Until' - $ref: '#/components/parameters/Direction' - $ref: '#/components/parameters/Nested' - $ref: '#/components/parameters/Symbols' security: - BasicAuth: [] summary: 'Retrieves a list of orders for the account, filtered by the supplied query parameters.' tags: - Trading description: 'Retrieves a list of orders for the account, filtered by the supplied query parameters.' responses: '200': description: 'Retrieves a list of orders for the account, filtered by the supplied query parameters.' content: application/json: schema: type: array items: $ref: '#/components/schemas/Order' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' operationId: get_orders post: security: - BasicAuth: [] summary: Create an order for an account. tags: - Trading description: Create an order for an account. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateOrderRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Order' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' operationId: post_orders delete: security: - BasicAuth: [] summary: Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled. tags: - Trading description: Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled. responses: '207': description: OK content: application/json: schema: type: array items: type: object properties: id: type: string status: type: integer body: $ref: '#/components/schemas/Order' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' operationId: delete_orders /assets: get: security: - BasicAuth: [] tags: - Assets summary: Retrieve all assets description: Returns all assets responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Asset' operationId: get_assets '/assets/{asset_id}': get: security: - BasicAuth: [] tags: - Assets summary: Retrieve an asset by UUID description: 'Returns the requested asset, if found' parameters: - name: asset_id required: true in: path schema: type: string description: The UUID of the required asset responses: '200': description: Returns asset content: application/json: schema: $ref: '#/components/schemas/Asset' '404': description: Asset not found '/assets/{symbol}': get: security: - BasicAuth: [] tags: - Assets summary: Retrieve an asset by symbol description: 'Returns the requested asset, if found' parameters: - name: symbol required: true in: path schema: type: string description: The symbol of the required asset responses: '200': description: Returns asset content: application/json: schema: $ref: '#/components/schemas/Asset' '404': description: Asset not found /calendar: get: security: - BasicAuth: [] tags: - Calendar summary: Query market calendar parameters: - name: start description: The first date to retrieve data for. (Inclusive) in: query schema: type: string - name: end description: The last date to retrieve data for. (Inclusive) in: query schema: type: string responses: '200': description: Returns the calendar object content: application/json: schema: type: array items: $ref: '#/components/schemas/MarketDay' /clock: get: security: - BasicAuth: [] tags: - Clock summary: Query market clock responses: '200': description: The current market's timestamp content: application/json: schema: $ref: '#/components/schemas/Clock' examples: {} '/accounts/{account_id}/documents/{document_id}/download': get: security: - BasicAuth: [] summary: Download a document file that belongs to an account. tags: - Documents description: | The operation returns a pre-signed downloadable link as a redirect with HTTP status code 301 if one is found. parameters: - $ref: '#/components/parameters/AccountID' - name: document_id in: path required: true schema: type: string format: uuid responses: '301': description: | Redirect to the pre-signed download link for the document PDF file. '404': description: The document is not found. '/documents/{document_id}': get: security: - BasicAuth: [] summary: Download a document file directly tags: - Documents description: | The operation returns a pre-signed downloadable link as a redirect with HTTP status code 301 if one is found. parameters: - name: document_id in: path required: true schema: type: string format: uuid responses: '301': description: | Redirect to the pre-signed download link for the document PDF file. '404': description: The document is not found. /events/accounts/status: get: security: - BasicAuth: [] summary: Subscribe to account status events (SSE). tags: - Accounts - Events description: | 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) parameters: - name: since in: query schema: type: string format: date-time - name: until in: query schema: type: string format: date-time - name: since_id in: query schema: type: integer - name: until_id in: query schema: type: integer responses: '200': description: Connected. content: application/json: schema: $ref: '#/components/schemas/AccountStatusEvent' examples: {} /events/trades: get: security: - BasicAuth: [] summary: Subscribe to events related to trade updates (SSE). tags: - Trading - Events description: | 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) parameters: - name: since in: query schema: type: string format: date-time - name: until in: query schema: type: string format: date-time - name: since_id in: query schema: type: integer - name: until_id in: query schema: type: integer responses: '200': description: Connected. content: application/json: schema: $ref: '#/components/schemas/TradeUpdatesEvent' examples: {} /events/journals/status: get: security: - BasicAuth: [] summary: Subscribe to journal events (SSE). tags: - Journals - Events description: | 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) parameters: - name: since in: query schema: type: string format: date-time - name: until in: query schema: type: string format: date-time - name: since_id in: query schema: type: integer - name: until_id in: query schema: type: integer responses: '200': description: Connected content: application/json: schema: type: object properties: event_id: type: integer at: type: string format: date-time journal_id: type: string format: uuid status_from: type: string status_to: type: string /journals: get: security: - BasicAuth: [] summary: Return a list of requested journals. tags: - Journals parameters: - name: after in: query schema: type: string format: date description: by settle_date - name: before in: query schema: type: string format: date description: by settle_date - name: status in: query schema: type: string enum: - pending - canceled - executed - name: entry_type in: query schema: type: string enum: - JNLC - JNLS - name: to_account in: query schema: type: string format: uuid - name: from_account in: query schema: type: string format: uuid responses: '200': description: OK content: application/json: schema: discriminator: propertyName: entry_type mapping: JNLC: '#/components/schemas/JNLC' JNLS: '#/components/schemas/JNLS' type: array items: $ref: '#/components/schemas/Journal' examples: example: value: - id: 3c2192da-6320-49cf-9374-ed63bbd8a5cb entry_type: JNLS from_account: 6b61532b-773c-4cc7-92bc-d78b66454fbd to_account: bee1b4d6-17cf-438b-a46d-75da5223e899 status: executed symbol: AAPL settle_date: '2020-12-24' qty: '2' price: '128.23' operationId: get_journals post: security: - BasicAuth: [] summary: Request a journal. tags: - Journals description: | A journal can be JNLC (move cash) or JNLS (move shares), dictated by `entry_type`. Generally, journal requests are subject to approval and starts from the `pending` status. The status changes are propagated through the Event API. Under certain conditions agreed for the partner, such journal transactions that meet the criteria are executed right away. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/JournalData' example: entry_type: JNLC from_account: 7c891489-574f-4f9a-82f0-4082a07f4736 to_account: 2d47a229-0c25-40a2-8cc7-b2c8821ff93a amount: '115.5' responses: '200': description: A journal is requested. content: application/json: schema: $ref: '#/components/schemas/Journal' '400': description: One of the parameters is invalid. content: application/json: schema: type: string '403': description: The amount requested to move is not available. content: application/json: schema: type: string '404': description: One of the account is not found. content: application/json: schema: type: string operationId: post_journals '/journals/{journal_id}': delete: security: - BasicAuth: [] summary: Cancel a pending journal. tags: - Journals description: | You can cancel journals while they are in the pending status. An attempt to cancel already-executed journals will return an error. parameters: - name: journal_id in: path required: true schema: type: string format: uuid responses: '204': description: | The cancel request succeeded. '404': description: | The journal is not found. '422': description: | The journal is not in the pending status. operationId: delete_journal /journals/batch: post: summary: Create a batch journal operationId: post_journals_batch responses: '200': description: '' content: application/json: schema: type: array items: $ref: '#/components/schemas/BatchJournalResponse' description: '' security: - BasicAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BatchJournalRequest' description: '' tags: - Journals '/oauth/clients/{client_id}': get: security: - BasicAuth: [] summary: Returns an OAuth client. tags: - OAuth description: | The endpoint returns the details of OAuth client to display in the authorization page. parameters: - name: client_id required: true in: path schema: type: string format: uuid - name: response_type in: query schema: type: string enum: - code - token example: token - name: redirect_uri in: query schema: type: string example: 'https://example.com/authorize' - name: scope in: query schema: type: string example: general responses: '200': description: Success. content: application/json: schema: type: object properties: client_id: type: string name: type: string description: type: string url: type: string terms_of_use: type: string description: URL of Terms of Use privacy_policy: type: string description: URL of Privacy Policy status: type: string enum: - ACTIVE - DISABLED redirect_uri: type: array items: type: string live_trading_approved: type: boolean example: true example: client_id: 7a3c52a910e1dc2abbb14da2b6b8e711 name: TradingApp description: Sample description url: 'http://test.com' terms_of_use: '' privacy_policy: '' status: ACTIVE redirect_uri: - 'http://localhost' live_trading_approved: true '401': description: | Client does not exist or you do not have access to the client. content: application/json: schema: type: string /oauth/token: post: security: - BasicAuth: [] summary: Issue a token. tags: - OAuth description: | This operation issues an access token for an account. requestBody: required: true content: application/json: schema: type: object properties: client_id: type: string description: OAuth client ID client_secret: type: string description: OAuth client secret redirect_uri: type: string description: redirect URI for the OAuth flow scope: type: string description: scopes requested by the OAuth flow account_id: type: string format: uuid description: end-user account ID example: client_id: 7a3c52a910e1dc2abbb14da2b6b8e711 client_secret: bbb14da2b6b8e7117a3c52a910e1dc2a redirect_uri: 'http://localhost' scope: general account_id: 0d18ae51-3c94-4511-b209-101e1666416b responses: '200': description: Success. content: application/json: schema: type: object properties: access_token: type: string token_type: type: string description: constant `Bearer` scope: type: string description: token's scope example: access_token: 87586f14-c3f4-4912-b107-f75bc17ff87a token_type: Bearer '401': description: | Client does not exists, you do not have access to the client, or “client_secret” is incorrect. content: application/json: schema: type: string '422': description: | Redirect URI or scope is invalid. content: application/json: schema: type: string /oauth/authorize: post: security: - BasicAuth: [] summary: Issue a code. tags: - OAuth description: | The operation issues an OAuth code which can be used in the OAuth code flow. requestBody: required: true content: application/json: schema: type: object properties: client_id: type: string description: OAuth client ID client_secret: type: string description: OAuth client secret redirect_uri: type: string description: redirect URI for the OAuth flow scope: type: string description: scopes requested by the OAuth flow account_id: type: string format: uuid description: end-user account ID example: client_id: 7a3c52a910e1dc2abbb14da2b6b8e711 client_secret: bbb14da2b6b8e7117a3c52a910e1dc2a redirect_uri: 'http://localhost' scope: general account_id: 0d18ae51-3c94-4511-b209-101e1666416b responses: '200': description: Successfully issued a code. content: application/json: schema: type: object properties: code: type: string description: OAuth code to exchange with a token later. redirect_uri: type: string description: redirect URI scope: type: string description: granted scopes example: code: 912b5502-c983-40f7-a01d-6a66f13a754d client_id: 7a3c52a910e1dc2abbb14da2b6b8e711 redirect_uri: 'http://localhost' scope: general '401': description: | Client does not exists, you do not have access to the client, or “client_secret” is incorrect. content: application/json: schema: type: string '422': description: | Redirect URI or scope is invalid. content: application/json: schema: type: string '/trading/accounts/{account_id}/watchlists': parameters: - schema: type: string format: uuid name: account_id in: path required: true description: Unique identifier of an account. get: summary: Retrieve all watchlists tags: [] responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Watchlist' operationId: get-trading-accounts-account_id-watchlists description: Fetch a list of all watchlists currently in an account. post: summary: Create a new watchlist operationId: post-trading-accounts-account_id-watchlists responses: '200': description: Newly created watchlist content: application/json: schema: $ref: '#/components/schemas/Watchlist' requestBody: content: application/json: schema: $ref: '#/components/schemas/Watchlist' '/accounts/{account_id}/watchlists/{watchlist_id}': parameters: - schema: type: string format: uuid name: account_id in: path required: true description: Unique identifier of an account - schema: type: string format: uuid name: watchlist_id in: path required: true description: Unique identifier of a watchlist get: summary: Manage watchlists tags: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Watchlist' operationId: get-accounts-account_id-watchlists-watchlist_id description: Fetch a single watchlist by identifier. put: summary: Update an existing watchlist operationId: put-accounts-account_id-watchlists-watchlist_id responses: '200': description: Updated watchlist. content: application/json: schema: $ref: '#/components/schemas/Watchlist' description: Replace entirely the set of securities contained in the watchlist while optionally renaming it. Destructive operation. requestBody: content: application/json: schema: type: object properties: name: type: string pattern: '^[a-zA-Z0-9]+$' symbols: description: New set of symbols for this watch list. Will destructively replace the prior set. type: array items: type: string example: '[''AAPL'', ''GOOG'']' delete: summary: Remove a watchlist operationId: delete-accounts-account_id-watchlists-watchlist_id responses: '200': description: Watchlist deleted. description: Irrevocably delete a watchlist.