> ## Documentation Index
> Fetch the complete documentation index at: https://docs.defiloops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting Binance

> Step by step: make a trade-only API key, set the lock, sign a grant, and see what the app and the chat show. Runs on Binance's demo exchange today

**In short:** you do five things on the Binance page of the app. Pick the products, paste a public key into Binance, paste the key id back, sign the lock, then sign a grant. **Today this connects to Binance's demo exchange.**

Portfolio Margin accounts are refused. Only a classic Binance account connects.

## Connect your account

1. **Pick the products** on the Binance page: spot, USDⓈ-M futures, or both. Choose the account to connect. Press **Create key**. The app shows a **public key** and our addresses.
2. **Create an API key on Binance.** Open API Management and choose **Self-generated (Ed25519)**. Paste only the public key.
3. **Tick trade permissions only:** Enable Spot & Margin Trading, and Enable Futures if you chose futures. Open your futures account on Binance first. A key made before that cannot enable futures, and you must make a new one.
4. **Leave withdrawals, universal transfer and internal transfer off.** The enclave refuses a key that allows any of them.
5. **Restrict the key to our addresses.** On real money, turn on Binance's trusted-IP setting and add both addresses the app shows. The enclave refuses a key with no IP restriction. Binance enforces which addresses the key accepts. Demo cannot do this, so the check is skipped there.
6. **Paste the API key id** back into the app and press **Check key**. The id is not secret. The enclave reads the key's permissions from Binance. The app shows a verified connection, or the reasons it was refused.

The app lists what the key can do: read, trade spot, trade futures, margin, withdraw, transfers, address lock and Portfolio Margin. On demo, the facts demo cannot report show as "not checkable on demo".

## Set the lock

The lock is recorded on MegaETH. You sign it once with your wallet, and our fee payer sends it, so you pay no gas. It says two things:

* **the markets** the agent may trade for you, each by name
* **the highest leverage** on futures

That is all. The lock has **no cap on total size**, and the platform imposes **no liquidation buffer**. How close to liquidation an order leaves you is your choice.

A market that is off in the lock cannot be traded, whatever a grant says. Closes and cancels never read the lock. A receipt from the enclave binds the lock to your key, so our servers cannot bind a key you did not make.

## Sign a grant

A grant lets the agent trade inside limits. It does nothing until you sign it. You arm it from a card on the card page, or from the Binance page.

* **Markets, sides and order types** it may place.
* **Most per run** and **most in total**, in USDT. Each order Binance accepts counts at its full size. On futures that is margin times leverage. It is priced at the order's limit price, or for a market order at the edge of your price tolerance. A cancelled or unfilled order still counts, and still uses a run. Only an order Binance rejects is not counted.
* **Most runs.**
* **Valid for** at most 90 days.
* **Price tolerance**, the most a market order may differ from the market price.
* **Highest leverage**, which can only be lower than the lock's.
* **When it may fire:** a price level, a percentage move or a schedule. A grant armed from a card can also have no condition: then our system decides when it fires.

When you arm from a saved card, the card's own numbers fill in. Every limit the card did not state stays empty and required. You type each one. Nothing is defaulted, and the chat never signs for you. A one-run card with no stated life is pre-filled with one day, and you can change it.

> [!WARNING]
>
> **Revoking a grant stops our relay. It does not cancel your signature.** A signed grant that has not expired stays valid. The hard stop is deleting the API key on binance.com, or tightening the markets in your lock.

## What you see in the app

* **A connection list** with each connection's status: waiting for the key id, verified, or refused with the reasons. **Remove** deletes our record of the connection. It does not delete the key on Binance. Delete it there too.
* **Balances** for a verified connection, on the Binance page, the chat side panel and the accounts page. See [trading](https://docs.defiloops.com/venues/binance/trading.md#balances).
* **Your grants** and each order they placed, on the card page.
* **Exits** on the card page: cancel one order, close a futures position, stop the card. Setting take-profit and stop-loss is [paused for now](https://docs.defiloops.com/venues/binance/trading.md#take-profit-and-stop-loss-on-futures).

## What you can ask in the chat

The chat reads and drafts. It never signs or arms.

* It lists your connections and what each key may do.
* It lists the markets and gives a market's public price.
* It reads your balances. It does not read open futures positions.
* It turns a saved card into an unsigned grant draft, and says which limits you still must type.
* It cancels one order or closes a futures position **only when you ask in your own words**. These cannot be taken back, and what already filled stays filled.

## Taking a connection down

Removing a connection in the app deletes our record. The API key stays valid on binance.com until you delete it there. That works at once and needs nothing from us. It is your fastest way to cut us off.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.