API reference ยท Alerts
/v1/accounts/{account_id}/alerts/{alert_id}Move a price alert.
Read
Changes an armed alert's level, its note, or both. A new level sets its condition again from the price now.
Path parameters#
-
The account number.
-
The alert.
Request body#
Responses#
200OK
-
The alert.
-
The account number.
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Its level.
-
above: it fires once the price reaches the level from below; below: from above. Set from the price when the level was set.
One of
abovebelow -
Your note, sent with it.
-
armed: it waits for its level. triggered: it fired (rearm arms it again). disabled: its account or market went away before it fired.
One of
armedtriggereddisabled -
The price it watches: the market's last trade (the middle of the book until there is one), the price trailing stops follow.
One of
last -
The price it fired at.
-
When it fired.
-
Why it was disabled.
One of
account_removedmarket_removed -
When it was set.
-
Its latest change.
400The request is malformed.
{
"error": {
"type": "invalid_request",
"code": "invalid_request",
"message": "The request is not valid.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#invalid_request"
}
}401The request has no Authorization header.
{
"error": {
"type": "authentication",
"code": "missing_api_key",
"message": "No API key: send it as Authorization: Bearer <key>.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#missing_api_key"
}
}403The key only works from the addresses you listed.
{
"error": {
"type": "permission",
"code": "ip_not_allowed",
"message": "This address is not on the key's allowlist.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#ip_not_allowed"
}
}404The account does not exist in this environment, or the key does not reach it.
{
"error": {
"type": "not_found",
"code": "account_not_found",
"message": "No account with that id is reachable with this key.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#account_not_found"
}
}409Only an armed alert moves; one that fired or was disabled must be armed again first (details.status).
{
"error": {
"type": "conflict",
"code": "alert_not_armed",
"message": "This alert is not armed.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#alert_not_armed"
}
}422An alert fires when the price reaches its level from one side; a level at the price now has none (details.last_price).
{
"error": {
"type": "rule_rejection",
"code": "alert_at_price",
"message": "This level is the price now.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#alert_at_price"
}
}429A request budget is used up (details.scope says which).
{
"error": {
"type": "rate_limit",
"code": "rate_limited",
"message": "Too many requests: slow down.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#rate_limited"
}
}500An error we did not expect.
{
"error": {
"type": "server",
"code": "internal_error",
"message": "Something went wrong on our side.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#internal_error"
}
}503The latest price is too old to trade against.
{
"error": {
"type": "engine",
"code": "stale_quote",
"message": "The market's price is not current.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#stale_quote"
}
}Errors#
Codes this endpoint can return. Match on the code, never on the message.
- 401
missing_api_key - 401
invalid_api_key - 401
expired_api_key - 401
revoked_api_key - 401
invalid_token - 401
expired_token - 401
revoked_token - 401
wrong_resource - 401
wrong_environment - 403
ip_not_allowed - 403
api_disabled - 429
rate_limited - 404
account_not_found - 404
alert_not_found - 409
alert_not_armed - 400
invalid_request - 400
unknown_field - 503
stale_quote - 422
alert_at_price - 404
market_not_found - 422
key_market_not_allowed