The accounts events API provides streaming of account changes as they occur, via SSE (server sent events). Past events can also be queried.
Events are generated for changes to the following account properties:
- account_blocked
- admin_configurations
- cash_interest
- crypto_status
- kyc_results
- options
- pattern_day_trader
- status
- trading_blocked
Only the changed properties are included in the event payload.
Query Parameter Rules:
sinceis required ifuntilspecifiedsince_idis required ifuntil_idspecifiedsince_ulidis required ifuntil_ulidspecifiedsince,since_idandsince_ulidcan’t be used at the same time
Behavior: This API supports querying a range of events, starting now or in the past. If the end of the range is in the future or not specified, the connection is kept open and future events are pushed.
To be specific:
- if
since,since_idorsince_ulidis not specified, this will not return any historic data - if
until,until_idoruntil_ulidis reached, the stream will end with a status of 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.