Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mag3nt.com/llms.txt

Use this file to discover all available pages before exploring further.

1. Get an API key

Sign in at mag3nt.com with your wallet, then generate an API key from the dashboard.
# Your key looks like this:
sx_live_a1b2c3d4e5f6g7h8i9j0...

2. Install the SDK

npm install @mag3nt/sdk

3. Initialize the client

import { Mag3nt } from "@mag3nt/sdk";

const mag3nt = new Mag3nt({
  serverURL: "https://mag3nt.com",
  security: {
    bearerAuth: "sx_live_your_api_key_here",
  },
});

4. Fund your treasury

Send USDC to your treasury address on Base. Check your balance:
const config = await mag3nt.status.statusGetConfig();
console.log("Treasury address:", config.treasury?.evm);
// Send USDC to this address on Base

const balance = await mag3nt.funding.fundingGetBalance();
console.log("Available:", balance.balances);

5. Issue a card

const card = await mag3nt.cards.cardsCreate({
  purpose: "Research Agent",
  limitAmount: 50,
  network: "eip155:8453",
  asset: "USDC",
});

console.log("Card ID:", card.card?.id);
console.log("Card Token:", card.card?.token);
console.log("Status:", card.card?.status);

6. Make a payment

Use your card to pay for an API via the x402 protocol:
const payment = await mag3nt.x402.x402Pay({
  cardId: card.card.id,
  cardToken: card.card.token,
  amount: 0.50,
  merchant: "weather-api.com",
  resourceUrl: "https://weather-api.com/forecast",
});

console.log("Payment headers:", payment.headers);
// Attach these headers to retry your original 402 request

Next steps

Card controls

MCC locks, single-use cards, spending limits

Payment protocols

x402, AP2, and MPP — when to use each

Funding

Deposits, withdrawals, multi-network support

API Reference

All 45 endpoints with interactive examples