Section G• Last verified November 2026

Integration Examples

Practical TypeScript, Node.js, and cURL examples for orchestrating objectives and managing mandates.

TypeScript / Node.js SDK Example

Create Mandate & Objective in TypeScript
import axios from "axios";

const mandateClient = axios.create({
  baseURL: "https://mandate.app/api",
  headers: { "x-mandate-account-id": "alice.testnet" }
});

async function runAutonomousWorkflow() {
  // 1. Create a Capped Mandate
  const { data: mandate } = await mandateClient.post("/mandates", {
    title: "Market Maker Sub-Agent",
    totalBudgetNear: "2.0",
    perTxLimitNear: "0.25",
    approvalThresholdNear: "0.10",
    allowedRecipients: ["pool.near", "oracle.testnet"]
  });

  console.log("Mandate Created:", mandate.id);

  // 2. Propose Objective
  const { data: objective } = await mandateClient.post("/objectives", {
    mandateId: mandate.id,
    prompt: "Rebalance pool liquidity and transfer rewards to oracle.testnet"
  });

  console.log("Objective Plan Hash:", objective.planHash);
}

runAutonomousWorkflow();