Connect Binance to Nyria
End-to-end Binance setup — API key + secret, spot vs perpetuals, testnet toggle, and the permission settings that keep your account safe.
By the end you will have a Binance API key wired to a Nyria broker integration, with the correct permissions for spot or perpetual-futures trading, validated against either the live exchange or Binance Testnet.
Never enable the Withdraw permission on a Binance API key used for automated trading. Nyria only needs Read and Trade. If your key has Withdraw enabled and is ever leaked, an attacker can drain the account.
Prerequisites
- A Nyria account. If you don't have one, follow the Quick Start first.
- A Binance account in good standing. For perpetual futures you must additionally have Binance Futures enabled on the account (a one-time opt-in inside Binance — Nyria cannot enable it for you).
- Decide up front whether this integration is for Testnet (simulated funds) or Live (real funds). The API base URLs differ and a Testnet key will not authenticate against the live exchange or vice versa.
- If you plan to trade perpetual futures, read the Binance broker reference for the supported pairs and leverage rules.
Overview: what you are about to do
- Create an API key + secret on Binance (or Binance Testnet).
- Restrict the key to Read and Trade only — and optionally IP-whitelist it.
- Paste the key + secret into Nyria's Add Integration flow.
- Pick Spot or Perpetual Futures capability when prompted.
- Place a small live test order to confirm the round trip.
Binance uses an HMAC-signed API key, not OAuth. There is no "Login with Binance" — you copy the key + secret out of Binance and into Nyria. This means the key lives in Nyria's encrypted credential storage, and you (not Binance) decide when to revoke it.
Step 1: Create the API key on Binance
Sign in to Binance at binance.com (or testnet.binance.vision for Testnet) and complete any 2FA prompts.
Open the account menu in the top-right and choose API Management. On Testnet, the equivalent page is labelled Generate HMAC_SHA256 Key.
Click Create API, choose System generated, and give the key a
label that includes the word nyria (for example, nyria-spot-live or
nyria-perp-testnet). The label is for your records only — Binance does
not send it to Nyria.
Complete the 2FA challenge. Binance will show the API Key and Secret Key on a one-time-view panel. Copy both immediately into a password manager. The secret is shown only once — if you lose it you must delete the key and create a new one.
If you navigate away from the create-key page without copying the secret, it is gone. Binance will not show it again. Delete the half-configured key and start Step 1 over.
Step 2: Restrict the API key permissions
This is the most important step. By default Binance keys are read-only — you have to opt in to trading, and you must never opt in to withdrawals for an automation key.
On the API Management page, find the key you just created and click Edit restrictions.
Enable Enable Reading. Nyria needs this to fetch balances, positions, and order status.
Enable Enable Spot & Margin Trading if this integration will trade spot pairs (BTCUSDT, ETHUSDT, etc.).
Enable Enable Futures if this integration will trade USDT-M perpetuals. This option only appears after you have opened a Binance Futures account.
Leave Enable Withdrawals off. Always. Nyria does not place withdrawal requests and never will — leaving this off means a leaked key cannot move funds off the exchange.
Optional but recommended: under Restrict access to trusted IPs only, paste Nyria's outbound IP. Get the current IP from Nyria's Integrations → Binance → Connection Details panel after Step 4, then come back and add it. IP whitelisting blocks the key from working anywhere except Nyria.
Save the changes and re-confirm with 2FA.
IP whitelisting is a trade-off: it is the single biggest security win for
an exchange API key, but if Nyria's outbound IP rotates (rare, but possible
during infra migrations) your strategy will start returning auth errors
until you update the whitelist. Plan for a quick revisit if you see
-2015 Invalid API-key, IP, or permissions for action after a known
Nyria deploy window.
Step 3: Decide spot vs perpetual futures
A single Binance API key can hold both Spot and Futures permissions, but in Nyria each integration maps to one trading venue at a time:
- Spot — direct ownership of the underlying coin. No leverage, no liquidation, no funding rate. Symbols look like
BTCUSDT. - Perpetual Futures (CRYPTO_FUTURES capability) — leveraged synthetic contracts with no expiry. Long or short, 1x–125x per pair, funding charged every 8 hours. Symbols look like
BTCUSDTon the futures venue, which Nyria translates internally to the perp contract.
If you want both venues, create two integrations in Nyria using the same Binance API key — one labelled Spot, one labelled Perpetual. Strategies pick the integration, not the venue.
Whether perpetuals are available in your jurisdiction depends on Binance's regional rules, not Nyria's. If your Binance account is region-restricted to spot only, the perpetual integration will return permission errors at the first order — that is Binance enforcing the restriction, not a Nyria bug.
Step 4: Add the integration in Nyria
In the Nyria app, click Integrations in the left nav, then Add Integration.
Select Binance from the broker grid.
Choose the environment:
- Live — points at
api.binance.comand uses real funds. - Testnet — points at
testnet.binance.vision(spot) ortestnet.binancefuture.com(perp) and uses simulated funds.
The selection is locked once the integration is created — to switch environments later, delete the integration and add a new one.
Paste the API Key and Secret Key copied in Step 1.
Pick the capability: Spot or Perpetual Futures. This drives which Binance venue Nyria routes orders to and which symbol format the parser expects.
Click Connect. Nyria will immediately make a signed test call to Binance to validate the credentials. A green checkmark means the key authenticates, has the right permissions, and can read balances. A red error surfaces the raw Binance error code — see Troubleshooting below.
Step 5: Place a validation order
Before you point a real strategy at this integration, fire one manual order through the Test Order panel on the integration's detail page. This proves the full chain — credentials, capability, symbol format, balance — works end to end.
Open Integrations → Binance → Test Order.
For Spot: enter BTCUSDT, side BUY, quantity worth roughly $15
(Binance's minimum spot notional is $10 on most pairs — leave headroom
for price drift). On Testnet, the simulated balance is pre-funded.
For Perpetual Futures: enter BTCUSDT, side BUY, leverage 1x,
quantity worth roughly $20. Leave leverage low so the test order can
fill even if the account is near its initial margin floor.
Submit. The panel will show the Binance order ID and the filled quantity. Close the position manually from Binance's UI (or, for perpetuals, submit a matching SELL test order) so you are not left holding an unintended position.
If the test order fills and closes cleanly, the integration is ready to attach to a strategy. Head to Strategies to wire up your alert source.
Symbol formats Nyria accepts
Nyria's parser normalises symbol formats so you do not have to memorise the Binance convention. The following all route to BTCUSDT on the Binance API:
| In your alert | Nyria parses to |
|---|---|
BTC | BTCUSDT (default quote currency) |
BTCUSD | BTCUSDT |
BTCUSDT | BTCUSDT |
BTC/USDT | BTCUSDT |
BTC-USDT | BTCUSDT |
For USDC quote pairs, be explicit (BTCUSDC) — BTC alone defaults to the USDT pair. Full symbol-resolution rules and the precedence order are documented in Webhook Payload Reference.
A minimal JSON alert payload that routes a market buy through this integration:
{
"ticker": "BTCUSDT",
"action": "buy",
"sentiment": "long",
"equity_type": "crypto",
"price": 64250.50
}For perpetuals, set "equity_type": "crypto_futures" instead — the strategy's attached integration determines the venue, but the equity_type field is what the parser uses to disambiguate when a strategy has both Spot and Perp integrations available.
Rotating or revoking the key
Treat the API secret like a password — if it ever appears in a screenshot, a Discord paste, a chat log, or a git diff, rotate it the same day.
In Binance API Management, click Delete on the compromised key. Confirm with 2FA. The key stops authenticating immediately worldwide.
Repeat Steps 1 and 2 to create a fresh key with the same restrictions.
In Nyria, open the Binance integration and click Update Credentials. Paste the new key + secret. Strategies attached to the integration pick up the new credentials on their next order — there is no need to rewire each bot.
Troubleshooting
-2014 API-key format invalid
You pasted only part of the key, or there is a trailing newline. Re-copy the full string from your password manager and try again.
-2015 Invalid API-key, IP, or permissions for action
One of three things:
- IP whitelist — you turned on IP restriction without adding Nyria's outbound IP. Either add the IP from the Connection Details panel, or remove the IP restriction on Binance.
- Permission missing — you enabled the key for Spot but the integration is configured as Perp (or vice versa). Either flip the Binance permission or delete and re-add the Nyria integration with the matching capability.
- Wrong environment — Testnet keys do not work against live, and live keys do not work against Testnet. Confirm the integration's environment matches where the key was generated.
-1021 Timestamp for this request was 1000ms ahead of the server's time
Binance requires the signed request timestamp to be within a narrow window of the exchange clock. If you see this from a fresh integration, retry once — it usually self-resolves. If it persists, open a support ticket so we can check the server clock drift on Nyria's side.
Test order rejected with Account has insufficient balance
For Spot on a live account, fund the spot wallet with the quote currency (USDT or USDC) before testing. For Perpetuals, transfer collateral from the spot wallet to the USDT-M futures wallet inside Binance — Nyria cannot move funds between Binance sub-wallets for you.
Test order rejected with Filter failure: MIN_NOTIONAL
The order is below Binance's per-pair minimum order value (typically $10 spot, $5 perp). Increase the test quantity.
Live orders fill on Binance but Nyria shows them as errored
This is the case the trade-bot's TastyTrade order-id fix also pattern-matches — a broker returns success with a numeric ID, the client parses it as a string, and the success path throws. If you see filled orders on Binance with no corresponding fill record in Nyria, open a support ticket and include the order ID — the platform team needs the raw response to patch the client. Do not place more orders through that integration until it is resolved; close the open positions on Binance directly.
Related
- Binance broker reference — supported equity types, fees, leverage rules, and limits.
- Coinbase setup — coming soon: a USD-quoted crypto alternative.
- Webhook Payload Reference — the full alert payload spec, including symbol resolution and the
equity_typefield that picks Spot vs Perp at routing time. - Equity Types — background on how Nyria models spot vs perpetual positions.
- Quick Start — end-to-end first strategy if you haven't built one yet.