PhoenixPerpetualsDocs API v1
Get an API key

API reference

Error codes⁠.

Every error answers with the same envelope: a stable code to match on, a message for people, the request id to quote to support, and whether a retry can work.

CodeHTTPWhat happenedWhat to do
invalid_request400The request is malformed.Fix what details names.
invalid_parameter400A query or path parameter is out of range or the wrong kind.Use a value the reference lists for it.
unknown_field400The request carries something this route does not know, or a parameter twice.Remove what details lists.
invalid_cursor400The cursor was changed, or it belongs to another list or filter.Pass next_cursor exactly as the previous page gave it, with the same filters.
invalid_json400The body could not be read as JSON, or it is nested too deep.Send a JSON object.
missing_api_key401The request has no Authorization header.Send Authorization: Bearer with your key.
invalid_api_key401The key is mistyped, unknown, or not sent as a Bearer token.Copy the key again from your dashboard.
expired_api_key401The key was made with an end date that has passed.Make a new key in your dashboard.
revoked_api_key401The key was revoked, by you or by our team.Make a new key in your dashboard.
invalid_token401The token is mistyped, unknown, or not sent as a Bearer token.Sign in to the app again.
expired_token401Access tokens of AI assistants last an hour; any app's access ends on its end date.Refresh the token, or sign in to the app again.
revoked_token401The access was ended, by you, by a new password, or by our team.Sign in to the app again.
wrong_resource401An app's token works only on the host it was asked for (details.expected_resource names this one).Sign in again asking for this host.
wrong_environment401A live key was sent to the sandbox host, or a sandbox key to the live host.Call the host named in details.expected_host.
ip_not_allowed403The key only works from the addresses you listed.Call from a listed address, or add this one in your dashboard.
insufficient_permission403A read key was used for a trading call.Use a key with trade access.
api_disabled403API access is not open to you, or it was suspended.Contact support.
invalid_size_step400The size must be a whole number of size steps.Use one of the sizes in details.nearest.
invalid_price_tick400Prices must be whole ticks.Use one of the prices in details.nearest.
price_out_of_band422Limit and stop prices must stay within a band around the last price (details.band_pct).Bring the price closer to the market.
stop_already_triggered422A stop must be above the last price for a buy, below it for a sell.Use a market or limit order, or move the stop.
post_only_would_fill422A post-only limit must rest: its price is already through the market.Move the price, or drop post_only.
limit_inside_spread422A limit already through the last price fills at once at the best price, which is beyond your limit here (it sits inside the spread).Move the limit past the best price, or wait for the market.
order_too_small422Orders below a minimum value are refused (details.min_notional_usd).Place a larger order.
working_order_cap422Working orders per account and per customer are capped (details).Cancel some, then try again.
client_order_id_conflict409Your client_order_id is unique per environment; the order that has it is in order_id.Use a new client_order_id, or read the existing order.
order_not_working409It filled, was canceled or ended before your request (details.status).Read the order to see its state.
idempotency_key_reused422The same key came with a different body.Use a new Idempotency-Key for a new action.
operation_in_progressRetry later409A retry came while the first was not finished.Retry after the Retry-After header.
key_market_not_allowed422The key is limited to some markets (details.markets).Use a key that may trade it, or change the key's markets.
key_reduce_only422The key is reduce-only: every order it places must be reduce_only.Set reduce_only, or use another key.
key_max_order_notional422The key has a largest order value (details.max_order_usd).Place a smaller order.
key_max_position_notional422The key has a largest position value (details.max_position_usd).Place a smaller order.
key_loss_stop_active422Trading with the key is stopped on the account until the next trading day.Wait for the next trading day (details.unlocks_at).
insufficient_margin422The order needs more margin than is available (details).Place a smaller order, lower the leverage, or close positions.
exposure_cap_exceeded422Your open value on a market, across your accounts of the same product, is capped.Place a smaller order.
reduce_only_violation422A reduce-only order may only reduce or close a position.Check the position's side and size.
slippage_exceeded422The best price was beyond worst_price (or max_slippage_pct) when the order arrived.Allow more slippage, or use a limit order.
no_priceRetry later503The market has no price to fill against yet.Retry after the Retry-After header.
stale_quoteRetry later503The latest price is too old to trade against.Retry after the Retry-After header.
market_closed422The market does not trade now.Try again when it opens.
market_not_offered422The market is not offered for new positions.Choose another market.
market_halted422Trading in the market is stopped for now.Try again later.
position_liquidating422A position in liquidation takes no new order.Wait until it is closed.
account_paused422A trading rule paused the account (details.until when known).Wait until it resumes.
account_not_tradable422The account passed, failed, or was closed (details.reason).Use another account.
insufficient_balance422The account balance does not cover this.Reduce the order.
margin_mode_locked409A position or working order is open on the market.Close them, then change the mode.
invalid_leverage400Leverage is a whole number from 1 to the market's max_leverage (details).Choose a leverage within it.
liquidation_risk422The change would move the liquidation price beyond the market.Choose a lower leverage or keep more margin.
position_not_isolated409Only an isolated position has its own margin to change.Switch the market to isolated first.
engine_busyRetry later503The engine is under load and took nothing.Retry after the Retry-After header.
order_rejected422The engine refused the order for a reason without its own code.Check the order, or contact support with the request id.
account_not_found404The account does not exist in this environment, or the key does not reach it.List your accounts with GET /v1/accounts.
market_not_found404The market is not offered.List the markets with GET /v1/markets.
order_not_found404The order is not on this account.List the account's orders.
position_not_found404The account holds nothing on that market now.List the open positions.
route_not_found404The path does not exist on this host.Check the path against the reference.
method_not_allowed405The path exists, with other methods (see the Allow header).Use a method the Allow header lists.
payload_too_large413The body is over the size limit.Send a smaller body.
uri_too_long414The URL is over the length limit.Shorten the query.
unsupported_media_type415A body was sent without Content-Type: application/json.Send JSON with that header.
sandbox_limit_reached409Each customer may open a fixed number of sandbox accounts, ever.Keep using the ones you have.
account_not_readyRetry later409The account exists but is not open on the trading engine yet.Retry after the Retry-After header.
sandbox_openingRetry later409The account was reserved and is being opened.Retry after the Retry-After header.
idempotency_key_required400Calls that create something need a key that makes a retry safe.Send Idempotency-Key with a new unique value per action.
invalid_idempotency_key400The key is empty, too long, or has characters it cannot.Send 1 to 128 printable characters.
rate_limitedRetry later429A request budget is used up (details.scope says which).Wait for Retry-After, then spread your requests.
not_readyRetry later503The API is starting and has not loaded your keys yet.Retry after the Retry-After header.
state_unavailableRetry later503The trading engine did not give a complete answer in time; nothing partial is returned.Retry after the Retry-After header.
engine_unavailableRetry later503The trading engine did not answer.Retry after the Retry-After header.
limiter_unavailableRetry later503The rate limiter is unavailable, so nothing passes unmeasured.Retry after the Retry-After header.
sandbox_disabled503Sandbox accounts are not being opened.Try again later.
environment_disabled503This host takes no requests at the moment.Check GET /v1/status.
temporarily_unavailableRetry later503A service this call needs did not answer.Retry after the Retry-After header.
capacityRetry later503The API is busy.Retry after the Retry-After header.
internal_errorRetry later500An error we did not expect.Retry; if it lasts, contact support with the request id.

Guides, endpoints, fields and error codes.