Agent APIBeta
Trade, read and journal your accounts by API. Rehearse on a paper sandbox, then trade your own accounts under the terminal's rules.
Start Here
Read Start here- Create a sandbox key with Trade access in Settings, under Developer.
- Check it:
GET /meanswers who the key is and what it may do. - Place an order on the paper account. Nothing on the sandbox counts.
export PERPSFUND_API_KEY="pk_test_your_key_here"curl https://api.perpsfund.com/v1/me -H "X-API-Key: $PERPSFUND_API_KEY"curl -X POST https://api.perpsfund.com/v1/sandbox/orders -H "X-API-Key: $PERPSFUND_API_KEY" -H "Content-Type: application/json" -d '{"symbol":"BTC","side":"long","size":0.01,"leverage":5}'
Or hand the job to an assistant. Each section of the reference carries a block like this one: the base URL, your auth, the endpoints and the rules for one task.
I am building a trading agent on the Perps Fund sandbox API.Base URL: https://api.perpsfund.com/v1Auth: send my key in the header X-API-Key: pk_test_...Quick check: GET /me -> { userId, environment, keyId }Place an order: POST /sandbox/orders { "symbol": "BTC", "side": "long", "size": 0.01, "leverage": 5 }It is a simulated paper account - no real money. Help me write a client for this API.
Trade
Live tradingA live key trades your trial, challenge, tournament and funded accounts through the terminal's own engine. Send an Idempotency-Key and a timed-out order can be resent safely.
curl -X POST https://api.perpsfund.com/v1/orders \ -H "X-API-Key: $PERPSFUND_LIVE_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"accountId":"9d01ef55-…","symbol":"BTC","side":"long","size":0.001,"leverage":2}'
Read
The streamAccounts, positions, fills and funding by REST, and one account's events as they happen on /stream, as server-sent events. A read-only key is enough.
curl -G https://api.perpsfund.com/v1/stream \ -d "accountId=$ACCOUNT_ID" \ -H "X-API-Key: $PERPSFUND_LIVE_KEY" event: filldata: {"symbol":"BTC","side":"long","leg":"open","price":83103,"size":0.001,"fee":0.0374}
Journal (MCP)
Trade journalA read-only MCP server over your trade journal: accounts, closed trades, fills, funding, daily equity and metrics. It takes a journal:read key and no other, and has no tool that places or changes anything.
curl https://mcp.perpsfund.com \ -H "Authorization: Bearer $PERPSFUND_JOURNAL_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_metrics","arguments":{"accountId":"<id>","from":"2026-10-01"}}}'
Limits
Rate limits600 per minute per key
Each key on its own.
429 rate_limited
2,000 per minute per account
Every key you hold, together.
429 user_rate_limited
150 per minute per order route
Live orders: your terminal and every key share it.
429 rate_limited
20 per minute per Pro type
Each Pro order type, live only.
429 rate_limited
Every response carries X-RateLimit-Limit, -Remaining and -Reset; a 429 carries Retry-After, the real wait.
SDKs
Client librariesTypeScript
One class, typed from the OpenAPI document. No dependencies.
sdk/typescript
Python 3.9+
One class, one method per endpoint, plain dicts. No dependencies.
sdk/python
Neither is on npm or PyPI yet: both live in the sdk folder beside the API, each with an example that places a market order with a stop.
The reference is open. Keys are in a controlled beta.
The full reference is public: the getting-started, every endpoint with its parameters and examples, the error tables and the concepts. It is a space you page through one section at a time. Creating a key is the part that needs your account enabled for the Agent API beta, and you can ask for access on Discord.