Errors
Errors are a JSON object with a stable string code, a message, and a request id:
json
{ "error": { "code": "PRICE_BAND_EXCEEDED", "message": "…" },
"request_id": "req_…" }Localize by code. HTTP status follows REST conventions (400 bad body, 401 auth, 404 not found, 409 conflict, 422 business-rule rejection, 429 rate limit).
vs. Alpaca: Alpaca uses numeric codes (
40310000). Boursa uses readable string codes.
Auth
| Code | Meaning |
|---|---|
UNAUTHENTICATED | missing/invalid key |
SIGNATURE_INVALID | bad HMAC signature |
SIGNATURE_EXPIRED | timestamp outside ±300s |
SIGNATURE_REQUIRED | signature missing on a money endpoint |
IDEMPOTENCY_KEY_REQUIRED | missing on a state change |
RATE_LIMITED | slow down |
Orders
| Code | Meaning |
|---|---|
MARKET_CLOSED | session closed (and not queueable) |
INSTRUMENT_HALTED / INSTRUMENT_UNKNOWN | instrument state |
TICK_VIOLATION | price not a tick multiple |
PRICE_BAND_EXCEEDED | price outside ±20% |
INSUFFICIENT_SETTLED_CASH / INSUFFICIENT_SETTLED_SECURITIES | balance |
SUITABILITY_REQUIRED / RISK_ACK_REQUIRED | gating |
INVESTOR_RESTRICTED / SHARIAH_RESTRICTED | account/screen |
INVALID_TIME_IN_FORCE | bad TIF |
CLIENT_ORDER_ID_EXISTS | reused client_order_id |
ORDER_NOT_CANCELLABLE | already terminal |
Funding
| Code | Meaning |
|---|---|
RAIL_LIMIT_EXCEEDED | over the per-transfer/day limit |
RAIL_FAILED / RAIL_SUBMIT_FAILED | payment-rail failure |
INVALID_AMOUNT / INVALID_DIRECTION | bad input |
KYC
| Code | Meaning |
|---|---|
DOCUMENTS_REQUIRED | both ID sides needed |
IMAGE_TOO_LARGE / IMAGE_FORMAT_UNSUPPORTED | upload validation |
SCREENING_REJECTED | broker declined |
APPLICATION_NOT_EDITABLE | wrong state |