Skip to content

Guide / Checked Nov 2026

How do I send trade alerts from my own code with a REST API?

POST the alert as JSON to https://api.nyria.io/v1/alerts with the strategy's token in an Authorization: Bearer header. The message takes the same words a webhook does, such as BUY BTCUSDT. The reply carries an order_id for each order the alert created, and GET /v1/orders/{order_id} tracks it to the fill. Each token allows 30 requests a minute, and the same alert sent twice within two minutes answers 409. Copy it from the strategy's Integration tab; it's the 64-character string at the end of the webhook URL.

Official documentation

Send and track an alert

  1. 1

    Copy the token

    Open the strategy's Integration tab and copy the webhook URL. The 64-character string at its end is the token. The API takes it only in the header, never in the URL.

  2. 2

    Deploy a paper bot first

    Every active bot on the strategy acts on the alert, including bots on accounts that copy it. Test with a bot on Nyria Paper.

  3. 3

    POST /v1/alerts

    Send {"message": "BUY BTCUSDT"} as JSON, or the alert as a text/plain body. Up to 2000 characters, in the same words a webhook takes.

  4. 4

    Read the reply

    The status is processed, rejected or duplicate. A true live_bots means a live bot may have placed a real order. Each entry in orders carries an order_id.

  5. 5

    Poll the order

    GET /v1/orders/{order_id} gives each bot's order with status, quantity, filled quantity and fill price. orders is empty until the bots place them.

  6. 6

    Read positions and recent orders

    GET /v1/positions lists what each of your accounts with a bot on the strategy holds. GET /v1/orders?limit=20 lists orders newest first, 1 to 100.

Requests to copy

Send an alert

curl -X POST https://api.nyria.io/v1/alerts \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "BUY BTCUSDT"}'

Check the order

curl https://api.nyria.io/v1/orders/ORDER_ID \
  -H "Authorization: Bearer YOUR_TOKEN"

Open positions

curl https://api.nyria.io/v1/positions \
  -H "Authorization: Bearer YOUR_TOKEN"

REST, webhook or MCP

  • The webhook at trades.nyria.io/webhooks/{token} takes a POST and replies with a status, but no order id.
  • The REST API takes the same token in a Bearer header, gives an order_id and reads positions and orders.
  • MCP at api.nyria.io/mcp gives an AI agent the same sends and reads as seven tools.
  • All three feed the same strategy, and every active bot on it acts on the alert.

Limits and errors

  • 30 requests a minute per token. Over it, 429 with Retry-After.
  • The same alert within two minutes goes out once, and the repeat answers 409. Change the message to scale in.
  • 401 means the token is missing, mistyped or rotated. 422 means Nyria couldn't use the alert.
  • Bodies over 16 KB answer 413. A 500 may or may not have gone through, so check recent orders before you resend.
  • Accounts that copy the strategy are not shown. Account numbers show the last 4 digits only.

Questions

Do I need the REST API, or is the webhook enough?
The webhook is enough to place orders. Use the REST API when your code needs an order_id back, or wants to read positions and orders with the same token.
Can the API set the position size?
No. The alert names the trade and Budget per entry sets the size, the same as every other source.
What do I need to call it?
Any HTTP client. The token goes in the Authorization header, the body is JSON or plain text, and every route answers in JSON.
Can my code open a position and close it later?
Yes. Send the entry, then send the exit in the same words a webhook takes, such as Close BTCUSDT long. Nyria closes the whole position.
What does it cost?
Paper is free. Live trading from $15 a month.

Next

Try a paper bot first

No card required. Paper is free. Live trading from $15 a month.