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_reused400The same key came with a different body.Use a new Idempotency-Key for a new action.
json_too_deep400A JSON body may hold objects and lists up to details.max_depth levels.Send a flatter body.
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_option_held422An account trades an asset on one of its markets (venue or trading hours) at a time; it holds a position or working orders on another (details.held_market).Close that position and its orders first, or trade details.held_market.
weekend_close422A market on Standard Market Hours or FX hours closes its positions 15 minutes before its weekend close and opens none until it reopens.Reduce or close only, or trade its 24/7 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.
margin_rejected422The trading engine did not take this mode or leverage for the market now.Read the market and your position, then try other settings.
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.
exits_changed409The position or its take-profit and stop-loss legs are not the ones your request was built on (a fill, a trim, another call).Build the batch again from details.exits, which is the state now.
exit_operation_failed422The engine refused one operation part way through the batch.details.results says what each operation did and details.exits what is in place now.
exit_would_fill422A take-profit must be on the profit side of the last price: above it for a long position, below it for a short one.Use a price beyond the last price, or close the position instead.
exits_exceed_position422The take-profit legs together, or the stop-loss legs together, would be more than the position.Make each group at most the position size (details.position_size).
exit_leg_cap422A position holds a limited number of take-profit and of stop-loss legs.Cancel or merge a leg first (details.max).
strategy_limit422A limit on running strategies or resting legs was reached (details.scope).End or cancel a strategy first.
strategy_not_active409Only a waiting or working strategy can be canceled.Read it again: its status and end_reason say how it ended.
strategy_not_found404The id is unknown, or belongs to another account or environment.List the account's strategies to find it.
client_strategy_id_conflict409Your id for a strategy is unique in its environment.Use another id, or read the existing one (details.strategy_id).
webhook_endpoint_not_found404The id is unknown, or belongs to another customer or environment.List your endpoints to find it.
tradingview_hook_not_found404The id is unknown, revoked, or belongs to another customer or environment.List your TradingView links to find it.
tradingview_alert_not_found404The id is unknown, or older than the alert log keeps.List the link's alerts to find it.
webhook_endpoint_not_active409Tests and resends go to active endpoints only.Turn it on again (enable, or your dashboard), then try again.
delivery_not_found404The id is unknown, or older than the delivery log keeps.List the endpoint's deliveries to find it.
event_not_found404The id is unknown, or older than the event log keeps.List the events (GET /v1/events) to find it.
rung_would_fill422A limit of a scaled order is through the last price, so it would fill at once instead of resting.Move the ladder away from the price, or send allow_marketable true.
trigger_already_met422A conditional waits for its price: on its own market a buy's level must be below the price and a sell's above it; on another market the price must not be beyond the level already (details.last_price).Place the order now, or move trigger_price.
alert_not_found404The id is unknown or deleted, or belongs to another account or environment.List the account's alerts to find it.
alert_limit422Armed alerts are capped per account and across your accounts (details.scope, details.max).Delete an alert, or wait for one to fire.
alert_at_price422An alert fires when the price reaches its level from one side; a level at the price now has none (details.last_price).Set a level above or below the price.
alert_not_armed409Only an armed alert moves; one that fired or was disabled must be armed again first (details.status).Rearm it, then move it.
strategy_type_disabled403The strategy type is switched off on the platform.Use another type, or try again later.
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.
account_closed409The account was closed: it has no live figures, positions or orders any more. GET /v1/accounts/{account_id} still shows it, as closed.Use another account (GET /v1/accounts lists them); open a new sandbox account if you need one.
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.