Start · Quickstart

Quickstart

Read live data with no key, then place your first trade with a scoped agent key — in about five minutes.

1. Read data — no key required

Every market-data endpoint is public. Try it with curl:

bash
curl "https://defi.venym.io/api/aggregated/candles?symbol=BTC&interval=1h&limit=5"

Or with the SDK:

typescript
import { VenymClient } from "@venym/sdk";

const venym = new VenymClient();
const candles = await venym.charts.getCandles("BTC", { interval: "1h", limit: 5 });
const book = await venym.markets.getOrderbook("BTC");
const routing = await venym.routing.getRecommendation("BTC", { side: "BUY" });

2. Get an agent key

A human owner mints scoped keys for their agents. Authenticate with your Venym (Dynamic) session and call the key API — or request one via the dashboard.

bash
curl -X POST https://defi.venym.io/api/agent/keys \
  -H "Authorization: Bearer <your-venym-jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "my-trading-agent",
    "scopes": ["market:read", "account:read", "orders:execute"],
    "policy": { "executionEnabled": true, "maxOrderUsd": 250, "dailyNotionalUsd": 1000, "maxLeverage": 5 }
  }'
The raw key is returned once. Store it as VENYM_API_KEY. Execution is off until policy.executionEnabled is true and the matching scope is granted.

3. Place your first trade

A market order, smart-routed to the best venue:

typescript
const venym = new VenymClient({ apiKey: process.env.VENYM_API_KEY });

const order = await venym.orders.place(
  { symbol: "BTC", side: "BUY", type: "MARKET", quantity: "0.001" },
  { idempotencyKey: crypto.randomUUID() },
);
console.log(order);
bash
curl -X POST https://defi.venym.io/api/agent/orders \
  -H "Authorization: Bearer $VENYM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "symbol": "BTC", "side": "BUY", "type": "MARKET", "quantity": "0.001" }'

Next