Fretum API

REST API for agent wallet provisioning and x402 payment signing on Base L2.

Base URL: https://fretum.ai/api  |  Auth: Authorization: Bearer fr_...

Getting Started

1. Register

POST/registerCreate account, get API keyno auth
curl -X POST https://fretum.ai/api/register \
  -H "Content-Type: application/json" \
  -d '{"name": "My Agent", "email": "[email protected]"}'

# Response: { "developerId": "...", "apiKey": "fr_..." }

2. Install SDK (optional)

npm install @mcfagentic/fretum
import { Fretum } from "@mcfagentic/fretum";
const fr = new Fretum({ apiKey: "fr_..." });

Wallets

POST/walletsCreate wallet on Base L2sign
GET/walletsList your walletsread
GET/wallets/:idWallet details + balanceread
PATCH/wallets/:id/budgetsUpdate spend limitssign
POST/wallets/:id/faucetDrip test USDC (testnet)sign

Payments

POST/wallets/:id/sign-402Sign x402 paymentsign
// Agent gets a 402 from an x402 endpoint
const res = await fetch("https://api.example.com/data");
// res.status === 402
const body = await res.json();

// Sign the payment through Fretum
const signed = await fr.sign(walletId, "https://api.example.com/data", body);

// Retry with payment header
const paid = await fetch("https://api.example.com/data", {
  headers: { "X-Payment": signed.paymentHeader }
});

// Or use payAndCall() to do it all in one step:
const result = await fr.payAndCall(walletId, "https://api.example.com/data");

Session Budgets

Cap how much an agent can spend on a single task:

const signed = await fr.sign(walletId, url, body, {
  session: { id: "task-123", cap: 5.00 }  // $5 max for this task
});
GET/wallets/:id/sessionsList active sessionsread
DELETE/wallets/:id/sessions/:sidClose a sessionsign

Account & Settings

GET/accountAccount inforead
GET/account/settingsRead settingsread
PATCH/account/settingsUpdate settingsfull
POST/account/keysCreate scoped API keyfull
GET/account/usageSpend analyticsread

API Key Scopes

full Create wallets, sign payments, manage settings

sign Sign payments + read (no wallet creation or settings)

read List wallets, balances, transactions only

Marketplace

GET/market/discoverBrowse storefrontspublic
GET/market/search?q=...Search servicespublic
GET/healthAPI health checkpublic
GET/feesFee transparencypublic

SDK

import { Fretum } from "@mcfagentic/fretum";

const fr = new Fretum({ apiKey: "fr_..." });

// Create wallet
const wallet = await fr.createWallet("my-agent");

// Fund (testnet)
await fr.faucet(wallet.walletId);

// Pay for an x402 API in one call
const response = await fr.payAndCall(
  wallet.walletId,
  "https://api.example.com/endpoint"
);
const data = await response.json();

Pricing

Wallets are free. 2% platform fee on mainnet transactions. Testnet is free.

Fee details: /api/fees (on-chain verifiable)

Home  |  Support  |  Dashboard  |  npm