TypeScript SDK
Using the REST API from TypeScript
Section titled “Using the REST API from TypeScript”const BASE = "https://sandbox-api.nuez.app/v1";const API_KEY = "nz_YOUR_KEY_HERE";
// 1. Exchange the API key for a JWT (see /rest-api/authentication)const { token } = await fetch(`${BASE}/auth/token`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ api_key: API_KEY }),}).then(r => r.json());
const headers = { Authorization: `Bearer ${token}`, "Content-Type": "application/json",};
// Balanceconst balance = await fetch(`${BASE}/balance`, { headers }).then(r => r.json());console.log(balance.available, balance.asset);
// Payoutconst payout = await fetch(`${BASE}/withdraws`, { method: "POST", headers: { ...headers, "Idempotency-Key": "inv-2026-04-001" }, body: JSON.stringify({ amount_ars: 5000, destination: "0000003100010000123456", destination_kind: "CBU", }),}).then(r => r.json());console.log(payout);Using MCP from TypeScript instead
Section titled “Using MCP from TypeScript instead”For an agent, calling POST /mcp directly with your raw API key skips the JWT exchange entirely — see Custom agents.