Get started
Quickstart.
From nothing to a protected order on a sandbox account in five minutes, in the language you use.
On this page
You will create a sandbox key, read your accounts, and place a market order with its stop loss and take profit held on our servers. Everything here runs on paper money: nothing touches your evaluation or funded accounts.
Create a sandbox key
In your dashboard, open Developers and choose Create API key. Pick Sandbox, then Read and trade, and give the key a name you will recognise, like the bot that will use it.
Sandbox keys need no email code. Your first one also opens a sandbox account of $100,000 for you, so there is something to trade on straight away.
Put the key in your environment
Every SDK and every example in these docs reads the key from
PHOENIXPERPS_API_KEY. Keeping it out of your code means it never ends up in a repository.export PHOENIXPERPS_API_KEY="ppk_test_..."$env:PHOENIXPERPS_API_KEY = "ppk_test_..."Install an SDK
Pick your language once: every sample on every page of these docs follows it.
# curl is all you need; skip this steppip install https://github.com/phoenixperps/sdk/releases/download/v1.3.1/phoenixperps-1.3.1-py3-none-any.whlnpm install https://github.com/phoenixperps/sdk/releases/download/v1.3.1/phoenixperps-sdk-1.3.1.tgzdotnet nuget add source https://phoenixperps.github.io/sdk/nuget/index.json --name phoenixperps dotnet add package PhoenixPerps.Sdkgo get github.com/phoenixperps/sdk/go// build.gradle.kts repositories { mavenCentral() maven("https://phoenixperps.github.io/sdk/maven") } dependencies { implementation("com.phoenixperpsfunding:phoenixperps-sdk:1.3.1") }cargo add phoenixperps --git https://github.com/phoenixperps/sdk --tag v1.3.1 cargo add tokio --features macros,rt-multi-thread # the samples below run in #[tokio::main] async fn main() -> phoenixperps::Result<()>, with use phoenixperps::*;composer config repositories.phoenixperps composer https://phoenixperps.github.io/sdk/composer composer require phoenixperps/sdkEvery SDK is published from github.com/phoenixperps/sdk, open source (MIT), with no account to create anywhere.
List your accounts
The key decides the host: a
ppk_test_key works on the sandbox host only, so the SDKs pick it for you. With curl, use the sandbox host.curl https://sandbox-api.phoenixperpsfunding.com/v1/accounts \ -H "Authorization: Bearer $PHOENIXPERPS_API_KEY"from phoenixperps import PhoenixPerps client = PhoenixPerps() # reads PHOENIXPERPS_API_KEY for account in client.accounts.list().data: print(account["id"], account["status"])import { PhoenixPerps } from "@phoenixperps/sdk"; const client = new PhoenixPerps(); // reads PHOENIXPERPS_API_KEY const { data } = await client.accounts.list(); for (const account of data) console.log(account.id, account.status);using PhoenixPerps; using var client = new PhoenixPerpsClient(); // reads PHOENIXPERPS_API_KEY var page = await client.Accounts.ListAsync(); foreach (var account in page.Data) Console.WriteLine($"{account.Id} {account.Status}");client, err := phoenixperps.NewClient() // reads PHOENIXPERPS_API_KEY if err != nil { log.Fatal(err) } page, err := client.Accounts.List(context.Background()) if err != nil { log.Fatal(err) } for _, account := range page.Data { fmt.Println(account.ID, account.Status) }PhoenixPerpsClient client = PhoenixPerpsClient.fromEnv(); // reads PHOENIXPERPS_API_KEY for (Account account : client.accounts().list().data()) { System.out.println(account.id() + " " + account.status()); }let client = phoenixperps::Client::from_env()?; // reads PHOENIXPERPS_API_KEY let page = client.accounts().list().await?; for account in &page.data { println!("{} {:?}", account.id, account.status); }$client = new PhoenixPerps\Client(); // reads PHOENIXPERPS_API_KEY foreach ($client->accounts->list()->data as $account) { echo $account->id, ' ', $account->status, PHP_EOL; }GET /v1/accountsYou get your sandbox account, named like
SANDBOX-00042-001. That name is its id in every path.Place an order with its exits
This buys 0.001 BTC at the market, with a take profit 2% above the fill and a stop loss 1% below it. The exits are placed when the order fills and wait on our servers as reduce-only orders: they protect the position even if your bot stops.
curl -X POST https://sandbox-api.phoenixperpsfunding.com/v1/accounts/SANDBOX-00042-001/orders \ -H "Authorization: Bearer $PHOENIXPERPS_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "market": "BTC-USD", "side": "buy", "type": "market", "size": "0.001", "exits": { "take_profit": [{ "percent": "2" }], "stop_loss": { "percent": "1" } } }'order = client.orders.create("SANDBOX-00042-001", { "market": "BTC-USD", "side": "buy", "type": "market", "size": "0.001", "exits": { "take_profit": [{"percent": "2"}], "stop_loss": {"percent": "1"}, }, }) print(order["id"], order["status"]) # ord_01JAB7Q8XK... filledconst order = await client.orders.create("SANDBOX-00042-001", { market: "BTC-USD", side: "buy", type: "market", size: "0.001", exits: { take_profit: [{ percent: "2" }], stop_loss: { percent: "1" }, }, }); console.log(order.id, order.status); // ord_01JAB7Q8XK... filledvar order = await client.Orders.CreateAsync("SANDBOX-00042-001", new CreateOrder { Market = "BTC-USD", Side = OrderSide.Buy, Type = CreateOrderType.Market, Size = 0.001m, Exits = new OrderExits { TakeProfit = new() { new OrderExitsTakeProfit { Percent = 2m } }, StopLoss = new OrderExitsStopLoss { Percent = 1m }, }, }); Console.WriteLine($"{order.Id} {order.Status}");order, err := client.Orders.Create(context.Background(), "SANDBOX-00042-001", phoenixperps.CreateOrder{ Market: "BTC-USD", Side: phoenixperps.OrderSideBuy, Type: phoenixperps.CreateOrderTypeMarket, Size: phoenixperps.Dec("0.001"), Exits: &phoenixperps.OrderExits{ TakeProfit: []phoenixperps.OrderExitsTakeProfit{{Percent: phoenixperps.Dec("2")}}, StopLoss: &phoenixperps.OrderExitsStopLoss{Percent: phoenixperps.Dec("1")}, }, }) if err != nil { log.Fatal(err) } fmt.Println(order.ID, order.Status)Order order = client.orders().create("SANDBOX-00042-001", new CreateOrder() .market("BTC-USD") .side(OrderSide.BUY) .type(CreateOrderType.MARKET) .size(new BigDecimal("0.001")) .exits(new OrderExits() .takeProfit(List.of(new OrderExitsTakeProfit().percent(new BigDecimal("2")))) .stopLoss(new OrderExitsStopLoss().percent(new BigDecimal("1"))))); System.out.println(order.id() + " " + order.status());let order = client.orders().create("SANDBOX-00042-001", &CreateOrder { market: "BTC-USD".into(), side: OrderSide::Buy, r#type: CreateOrderType::Market, size: Some(dec("0.001")), exits: Some(OrderExits { take_profit: Some(vec![OrderExitsTakeProfit { percent: Some(dec("2")), ..Default::default() }]), stop_loss: Some(OrderExitsStopLoss { percent: Some(dec("1")), ..Default::default() }), ..Default::default() }), ..Default::default() }).await?; println!("{} {:?}", order.id, order.status);$order = $client->orders->create('SANDBOX-00042-001', [ 'market' => 'BTC-USD', 'side' => 'buy', 'type' => 'market', 'size' => '0.001', 'exits' => [ 'take_profit' => [['percent' => '2']], 'stop_loss' => ['percent' => '1'], ], ]); echo $order->id, ' ', $order->status, PHP_EOL;POST /v1/accounts/{account_id}/ordersThe SDKs send an
Idempotency-Keyfor you and reuse it if they retry, so a dropped connection never places the order twice. With curl, send your own.
What you just did#
You traded through the same engine, with the same prices and the same rules as your real accounts, on a sandbox account that will never count towards a payout. When your bot behaves, create a live key and change nothing else: the SDKs move to the live host by themselves.