Error Response Contract
- A successful response uses the numeric
codevalue0 - An error response may return
codeas an integer or a string; normalize it withString(code)before comparison - Do not branch on the
messagetext. It explains the error and may vary by context - The HTTP status describes the request-level outcome, while
codeidentifies the specific business reason; clients should check both
HTTP API
HTTP error responses contain at leastcode and message. Some endpoints also return error or data:
WebSocket Connection Failures
Authentication errors that occur before the WebSocket upgrade completes are regular HTTP error responses. The connection has not been established, so no WebSocket message is delivered.Errors After WebSocket Connection
Subscription or message errors after the connection is established are delivered as WebSocket messages.cmd identifies the command that caused the error:
Error Code Reference
Authentication Errors (1xxx)
Parameter Errors (2xxx)
An ambiguous symbol in an HTTP request returns the string
AMBIGUOUS_SYMBOL. An ambiguous symbol in a WebSocket subscription currently returns the numeric code 2003. In both cases, use available_types in the response to provide type.
Access and Quota Errors (3xxx)
WebSocket Channel Permission Errors (4xxx)
The current public WebSocket connection uses the following 4xxx error:
Invalid JSON and unknown commands currently return
cmd="error" with code=2001. Codes 4001–4004 are not part of the current public response contract, so clients should not depend on them.
Service Errors (5xxx)
The
data object in a WebSocket subscription response with 5004 may include these fields:
symbols: symbols already subscribed successfully; do not subscribe to them againfailed_symbols: all symbols that were not subscribed in this requestretryable_symbols: the subset that can be retried laterretryable: whether at least one symbol can be retried
String Error Codes
Financial and Fundamental API Errors
The following five-digit codes apply to standard financial and fundamental endpoints. Stock news endpoints may use a different error mapping; use thecode and message returned by those endpoints.
