Skip to content
Agent API · Beta

Build a trading agent on Perps Fund

A REST API for the Perps Fund sandbox: your own simulated paper account, priced off real marks, the same one the demo terminal runs. Built to be handed to an AI agent - paste a context block into Cursor or Claude Code and let it write the integration.

Written to be handed to an AI

Most people building trading agents today follow a tutorial and paste context into an assistant rather than write every line by hand. So the reference is built around that: every section carries a compact, self-contained context block with the base URL, your auth, the relevant endpoints, and the rules. Copy one into your AI and it has everything it needs for that task - no synthesizing from scattered docs.

Give this to your AI (a taste)
I am building a trading agent on the Perps Fund sandbox API.
Base URL: https://api.perpsfund.com/v1
Auth: 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.

Sandbox-first, real marks

Everything runs against a simulated paper account priced off real marks. Nothing here moves real money, so it is the right place to build, break, and rehearse a strategy - and to let an autonomous agent trade a few hundred times before you ever consider real capital.

Plain REST, honest about scope

One header authenticates you, requests and responses are JSON, and errors are stable machine-readable codes. Today the surface is the sandbox only: there is no live funded-account route, WebSocket, or SDK yet. We document what exists and mark what does not, rather than overpromise.

What you can do

  • Read your account

    Balance, equity, unrealized PnL, the challenge floors and target, and lock status.

  • Place and close orders

    Market and marketable-limit orders, partial closes, all at a fresh mark.

  • Take-profit and stop-loss

    Set, edit, or clear trigger levels on any open position.

  • Live market data

    The tradeable universe, firm leverage caps, and current marks.

  • Stable error codes

    Every failure is a JSON body with a machine-readable code and a matching status.

  • OpenAPI 3.0.3 spec

    A machine-readable spec for code generators, Postman, or a Swagger viewer.

API access is in a controlled beta

Keys and the full reference - the getting-started through every endpoint - are rolling out to a limited group. Once your account is enabled, the reference unlocks and you can create keys in Settings. Create an account, then request access.