v1.0MITSolanax402

Documentation

Everything you need to monetize your API or connect your AI agent to paid services — using USDC on Solana and the x402 payment protocol.

What is Metera?

Metera is the billing infrastructure for AI agents on Solana. It implements the x402 HTTP payment protocol — the open standard backed by Google, Microsoft, Stripe, Coinbase and Cloudflare — and exposes it as a managed platform.

If you have an API, Metera lets AI agents pay you automatically in USDC, per call, with no billing setup, no credit cards, and no human approval.

If you have an AI agent, Metera gives it a Solana wallet, spending limits, and access to hundreds of paid APIs — controllable through a three-tier approval system.

No banks. No credit cards. No humans in the loop — unless you want them.

How it works

For API owners

1
Register your API
Paste your URL and set a price per call in USDC.
2
Get your public endpoint
https://api.metera.xyz/p/your-slug — ready instantly.
3
Agents call and pay
Metera detects the x402 flow, verifies payment on-chain, proxies the request, and credits USDC to your wallet.

For AI agents

1
Create an agent wallet
Solana wallet created via Privy. No seed phrase. No crypto knowledge needed.
2
Deposit USDC
Deposit via Pix (BRL). USDC arrives on Solana mainnet.
3
Your agent pays automatically
Read your skill.md URL. The agent detects HTTP 402, pays in USDC, retries — zero extra code.

Quickstart: List your first API

5 minutes from zero to a live, monetized endpoint.

1
Create an account
Go to metera.xyz and sign in. No credit card required.
2
Go to /proxy and click "Register API"
The proxy dashboard is where you manage all your hosted endpoints.
3
Fill in the details
Enter your upstream URL (e.g. https://api.openweathermap.org/data/2.5/weather), set a name, category, and price per call in USDC. The minimum price is 0.001 USDC per call.
4
Your public proxy endpoint is live
Metera auto-generates a slug from your API name.
5
Test it with curl
Without a payment header, the endpoint returns HTTP 402:
bash
# Your Metera endpoint:
$ curl https://api.metera.xyz/p/weather-api
 
# Returns 402 Payment Required — as expected for unauthenticated calls
{"error":"Payment required","amount":0.001,"token":"USDC","chain":"solana"}
 
# When called by a Metera agent, payment is automatic
Agents pay → Metera verifies on-chain → proxies request → returns data

Your API is now discoverable in the Metera Marketplace and callable by any AI agent that uses the x402 protocol.

Quickstart: Make your first paid API call

1
Create an account at metera.xyz
Sign in — no crypto wallet required.
2
Go to /agents and create an agent wallet
Click "Create agent wallet", give it a name and optional spending limits. A Solana mainnet wallet is created automatically via Privy. No seed phrase.
3
Deposit USDC via Pix
Click "Deposit" on your wallet. Enter a BRL amount (minimum R$10). You'll receive a Pix QR code. Pay with any Brazilian bank app. USDC arrives on Solana mainnet — allow up to 72 hours for first-time settlement.
4
Get your skill.md URL
Copy the skill URL from your agent wallet card. It looks like: https://api.metera.xyz/skill/YOUR_AGENT_KEY
5
Connect to your AI agent
In Claude Code, Cursor, or any MCP-compatible client:
bash
Read https://api.metera.xyz/skill/YOUR_AGENT_KEY and follow the instructions

Your agent can now make paid API calls automatically. It reads the skill.md, learns its wallet address, spending limits, and available APIs, then pays in USDC when it encounters an x402 endpoint.

Agent wallets

Agent wallets are managed Solana wallets created by Metera on your behalf using Privy infrastructure. Each wallet has its own address, agent key, spending limits, and tier configuration.

Wallets run on Solana mainnet. Funds are held in USDC (mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v).

Create a wallet

1
Go to metera.xyz/agents
Sign in with any auth method.
2
Click "Create agent wallet"
Give it a name. Optionally set spending limits now — you can change them later.
3
Wallet created
A Solana address and unique agent key are generated instantly. No seed phrase. No private key setup.

Each agent wallet has:

walletAddress — your Solana address (e.g. 4Ui3P6mXH...)
agentKey — UUID used to authenticate agent proxy calls
maxPerCall / maxPerHour / maxPerDay / maxPerMonth — spending limits in USDC
tier2ThresholdUsdc — threshold above which Tier 2 rate-check activates
tier3ThresholdUsdc — threshold above which Tier 3 human approval activates
allowedEndpoints / blockedEndpoints — URL allowlist/blocklist

Spending limits

Spending limits protect your agent from runaway costs. All limits are denominated in USDC.

maxPerCallMaximum USDC paid per individual API call. Calls exceeding this are blocked.$0.01
maxPerHourRolling hourly spend cap tracked in Redis.$1.00
maxPerDayRolling daily spend cap tracked in Redis.$5.00
maxPerMonthRolling monthly spend cap tracked in Redis.$20.00

All limits are optional. A null value means no limit is enforced for that window.

3-tier spending governance

Every call through the agent proxy is evaluated by the tier router before execution. The tier is determined by the call amount relative to your configured thresholds.

TIER 1 — AUTO
Condition: amount ≤ maxPerCall
Executes immediately. For paid plans (Starter, Pro, Enterprise) this limit is enforced on-chain by a Squads v4 SpendingLimit PDA — not just in the database.
Example: amount = $0.003, maxPerCall = $0.01 → executes
TIER 2 — VERIFY
Condition: amount > maxPerCall but ≤ tier2ThresholdUsdc, OR rate/pattern anomaly detected
Two sub-cases: (1) above_tier1 — executes but logs for review. (2) rate_exceeded or pattern_detected — soft-blocked with HTTP 429, retryAfter: 60 seconds.
Example: Calling same endpoint 10x in 60s triggers pattern detection
TIER 3 — HUMAN
Condition: amount > tier3ThresholdUsdc
Call is held pending. An approval email is sent to you. You approve or reject from the Metera dashboard at metera.xyz/agents. The agent receives HTTP 402 with a TIER3_APPROVAL_REQUIRED code and an approvalId.
Example: amount = $5.00, tier3ThresholdUsdc = $1.00 → held for human approval

Tier thresholds (tier2ThresholdUsdc and tier3ThresholdUsdc) are configurable per wallet via PATCH /api/agent-wallets/:id.

Deposit USDC via Pix

Metera uses 4P Finance to convert BRL to USDC on Solana via Pix. This is currently the primary deposit method.

1
Click "Deposit" on your agent wallet card
Found at metera.xyz/agents.
2
Enter a BRL amount
Minimum deposit is R$10. There is no published maximum — contact support for large amounts.
3
Enter your CPF
Required by 4P Finance for Brazilian regulatory compliance. Stored after first use — you only need to enter it once.
4
Pay the Pix
Scan the QR code or copy the Pix Copia e Cola string. Pay from any Brazilian bank app. The QR code expires in 30 minutes.
5
Wait for USDC
Once 4P Finance confirms the Pix, they convert BRL to USDC and send it to your Solana wallet on mainnet. Allow up to 72 hours for first-time deposits.

The Pix QR code expires after 30 minutes. If you miss the window, create a new deposit from the dashboard. Your wallet is never at risk — the deposit intent simply expires.

You can poll deposit status at GET /api/deposit/status/:depositIntentId. Status transitions: pending → completed (or expired).

skill.md — agent configuration

Every agent wallet exposes a public Markdown file that teaches AI agents (Claude, Cursor, GPT) how to use Metera automatically.

bash
# Your skill URL
https://api.metera.xyz/skill/YOUR_AGENT_KEY

# In Claude Code or Cursor:
Read https://api.metera.xyz/skill/YOUR_AGENT_KEY and follow the instructions

The skill.md tells your agent:

The wallet address to use for payments
Current spending limits (maxPerCall, maxPerDay, maxPerMonth)
How to make a paid call via the agent proxy endpoint
How to check balance
Which marketplace APIs are available

The skill.md is public — it contains no private keys or secrets. The agentKey authenticates calls through the proxy, not access to funds.

On-chain protection — Squads v4

For paid plans (Starter, Pro, Enterprise), Metera creates a Squads Protocol v4 multisig for each agent wallet. This adds on-chain enforcement of the per-call spending limit — not just a database check.

multisigPdaThe Squads multisig account address
vaultPdaThe vault that holds funds
spendingLimitPdaThe SpendingLimit PDA that enforces maxPerCall on-chain

Free plan wallets use database-only enforcement. The database limit is still enforced — Squads adds a second, immutable layer on top.

Register your API

No code required. Go to metera.xyz/proxy, paste your upstream API URL and set a price. Metera generates a public proxy endpoint instantly.

example
# Your API URL:
https://your-api.com/data
 
# Metera endpoint (auto-generated):
https://api.metera.xyz/p/your-data-api

Proxy endpoints

Each registered API becomes a proxy endpoint. Agents call the Metera URL, Metera verifies payment on-chain, then proxies the request to your upstream API with your API key injected automatically.

When you create an endpoint you can configure:

targetUrlUpstream API URL. No localhost in production.required
nameDisplay name. Used to auto-generate the slug.required
pricePerCallUSDC amount charged per successful call. Default: 0.001optional
categoryCategory tag for marketplace discovery. Default: "data"optional
targetApiKeyYour upstream API key — injected server-side. Never exposed to callers.optional
targetApiHeaderHeader name to inject the API key into. Default: "x-api-key"optional
isPublicWhether to list in the public marketplace. Default: trueoptional
methodsAllowed HTTP methods, e.g. ["GET","POST"]. Default: ["GET"]optional

The public proxy URL is always: https://api.metera.xyz/p/{slug}

How agents pay

When an agent calls your endpoint without a payment header, Metera returns HTTP 402 with payment instructions. The agent signs a USDC transaction on Solana, includes the signature in the next request, and Metera verifies it on-chain before proxying.

payment flow
$ GET https://api.metera.xyz/p/your-api (no payment)
← HTTP 402: { "amount": 0.001, "token": "USDC", "chain": "solana" }
 
$ Agent signs USDC tx on Solana → gets tx hash
$ GET https://api.metera.xyz/p/your-api -H "x-payment-signature: TX_HASH"
← HTTP 200: { your API response }
 
# Total time: ~400ms. No human involved.

You receive 100% of the payment directly in your Solana wallet. Metera takes no fee from your revenue.

Browse the marketplace

The Metera Marketplace at metera.xyz/marketplace lists all public APIs available for AI agents. Browse by category, search by keyword, or sort by popularity or recency.

Each listing shows price per call in USDC, uptime %, average latency in ms, and total calls — so agents can evaluate quality before using an API.

Supported categories include: data, ai, media, finance, and others.

bash
# Browse all marketplace APIs
curl https://api.metera.xyz/api/marketplace

# Filter by category
curl "https://api.metera.xyz/api/marketplace?category=finance&sort=popular"

# Search by keyword
curl "https://api.metera.xyz/api/marketplace?search=weather"

# Get one API's full details
curl https://api.metera.xyz/api/marketplace/weather-api

List your API

Any endpoint registered with isPublic: true appears automatically in the marketplace. There is no manual review or approval process.

Agents across the Metera network discover and call your API autonomously — no signup flow, no API keys distributed to callers, no billing setup on either side.

The x402 protocol

x402 is an open HTTP standard for machine-to-machine micropayments. The HTTP status code 402 ("Payment Required") has existed since HTTP/1.1 but was never standardized. The x402 Foundation defines the spec.

When a server returns 402, the response body includes:

json
{
  "amount": 0.001,
  "token": "USDC",
  "chain": "solana",
  "recipient": "7UQctUWgfH87jjz9xjnCCKVY6Q1tMWZ8i1ZB3Whx939D"
}

The client pays on-chain and includes the transaction hash in the next request header. The server verifies on-chain before responding.

The x402 Foundation is backed by Google, Microsoft, Stripe, Coinbase and Cloudflare. Metera is a production implementation of the standard on Solana.

Payment flow step by step

x402 payment flow
# Step 1 — Agent calls the API without payment
$ GET https://api.metera.xyz/p/weather-api
← 402 Payment Required
 
# Step 2 — Agent signs a USDC transaction on Solana
amount: 0.001 USDC → recipient: 7UQctU...
tx confirms in ~400ms
 
# Step 3 — Agent retries with payment proof
$ GET https://api.metera.xyz/p/weather-api \
$ -H "x-payment-signature: 5xyz...abc"
 
# Step 4 — Metera verifies on-chain, proxies, returns data
← 200 OK: { weather data }

Deposit via Pix (4P Finance)

The primary way to fund an agent wallet is via Pix using 4P Finance, which converts BRL to USDC on Solana.

Minimum depositR$10 BRL
CurrencyBRL → USDC on Solana
QR expiry30 minutes
Settlement timeUp to 72 hours (first deposit)
CPF requiredYes — Brazilian regulatory requirement

Settlement up to 72 hours applies mainly to first-time deposits. Subsequent deposits are typically faster. If your deposit is pending beyond 72 hours, contact support.

Plans

Metera plans control how many proxy endpoints and agent wallets you can create, and which analytics features are available. All plans include the core x402 payment functionality.

FeatureFreeStarterProEnterprise
Monthly price$0$29$99Custom
Proxy endpoints310UnlimitedUnlimited
Agent wallets1520Unlimited
Calls visible52050Unlimited
Analytics window7 days30 days90 daysUnlimited
CSV exportYesYes
MRR projectionYesYes
Latency percentilesYesYes
Top paying agentsYesYes
Revenue breakdownYesYes
White-labelYes
Squads v4 on-chain protectionYesYesYes

Free plan agent wallets use database-only spending limit enforcement. Paid plans (Starter, Pro, Enterprise) also get on-chain enforcement via Squads Protocol v4 — the SpendingLimit PDA is immutable and not bypassable via the database.

Pro plan analytics (revenue breakdown, latency percentiles, top paying agents, MRR projection, CSV export) are available at metera.xyz/analytics — gated by the requirePro middleware on the server.

API reference — Authentication

All private API endpoints require a Bearer JWT in the Authorization header. You can obtain this from your session after signing in.

The agent proxy endpoints (/agent/:agentKey/*) and marketplace endpoints are public — authenticated by the agentKey UUID or no auth at all.

bash
# Private endpoints
curl https://api.metera.xyz/api/agent-wallets \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

# Public endpoints — no auth
curl https://api.metera.xyz/agent/YOUR_AGENT_KEY/balance
curl https://api.metera.xyz/api/marketplace

Agent wallets endpoints

GET/api/agent-walletsList all agent wallets for the authenticated user
POST/api/agent-walletsCreate a new agent wallet (Privy + optional Squads v4)
GET/api/agent-wallets/:idGet a single wallet by ID
PATCH/api/agent-wallets/:idUpdate limits, thresholds, allowed/blocked endpoints
DELETE/api/agent-wallets/:idDeactivate a wallet (soft delete)

POST /api/agent-wallets — request body

json
{
  "name": "my-trading-bot",           // required
  "description": "Optional note",
  "network": "mainnet",               // default: "mainnet"
  "maxPerCall": 0.01,                 // USDC — null = no limit
  "maxPerHour": 1.00,
  "maxPerDay": 5.00,
  "maxPerMonth": 20.00,
  "allowedEndpoints": [],             // URL allowlist (empty = allow all)
  "blockedEndpoints": []              // URL blocklist
}

PATCH /api/agent-wallets/:id — updatable fields

json
{
  "name": "string",
  "description": "string",
  "maxPerCall": 0.05,
  "maxPerHour": 2.00,
  "maxPerDay": 10.00,
  "maxPerMonth": 50.00,
  "tier2ThresholdUsdc": 0.10,
  "tier3ThresholdUsdc": 1.00,
  "allowedEndpoints": ["https://api.example.com"],
  "blockedEndpoints": [],
  "isActive": true
}

Proxy endpoints

GET/api/proxy-endpointsList all endpoints owned by the authenticated user
POST/api/proxy-endpointsRegister a new API (creates a /p/:slug endpoint)
PATCH/api/proxy-endpoints/:idUpdate name, price, category, visibility, API key
DELETE/api/proxy-endpoints/:idDeactivate an endpoint
GET/p/:slugPublic proxy — the URL agents call (x402 flow)public

POST /api/proxy-endpoints — request body

json
{
  "name": "Weather API",              // required — slug is auto-generated
  "targetUrl": "https://api.openweathermap.org/data/2.5/weather", // required
  "description": "Current weather by city",
  "longDescription": "Extended markdown description",
  "category": "data",                 // default: "data"
  "pricePerCall": 0.001,              // USDC — default: 0.001
  "targetApiKey": "your-upstream-key", // injected server-side, never exposed
  "targetApiHeader": "x-api-key",    // default: "x-api-key"
  "isPublic": true,                  // default: true — lists in marketplace
  "methods": ["GET"],                // default: ["GET"]
  "tags": ["weather", "data"],
  "docsUrl": "https://openweathermap.org/api",
  "responseExample": "{ \"temp\": 22.5 }"
}

Calling a proxy endpoint as an agent

bash
# Direct call — will get 402 if no payment
curl https://api.metera.xyz/p/weather-api

# Via the agent proxy (handles payment automatically)
curl -X POST https://api.metera.xyz/agent/YOUR_AGENT_KEY/fetch \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://api.metera.xyz/p/weather-api", "method": "GET" }'

Marketplace endpoints

GET/api/marketplaceList public APIs — supports ?category, ?search, ?sort, ?limit, ?cursorpublic
GET/api/marketplace/:slugGet full details, stats, and usage examples for one APIpublic

GET /api/marketplace — query params

categoryFilter by category (data, ai, media, finance, …)
searchFull-text search on name and description
sort"popular" (default) or "recent"
limitResults per page — max 50, default 20
cursorPagination cursor from previous response

Deposit endpoints

POST/api/deposit/fourpInitiate a Pix deposit via 4P Finance — returns pixCopiaECola QR string
GET/api/deposit/intent/:idPoll deposit intent status (authenticated)
GET/api/deposit/status/:idPoll deposit status — public, lightweight, UUID-securedpublic

POST /api/deposit/fourp — request body

bash
curl -X POST https://api.metera.xyz/api/deposit/fourp \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "agentWalletId": "wallet-uuid",
    "amountBRL": 50,
    "cpf": "12345678901"
  }'

# Response
{
  "depositIntentId": "uuid",
  "pixCopiaECola": "00020126...",
  "expiresAt": "2026-06-26T14:00:00Z"
}

GET /api/deposit/status/:id — poll until completed

bash
curl https://api.metera.xyz/api/deposit/status/DEPOSIT_INTENT_ID

# Response
{
  "status": "pending",   // or "completed" | "expired"
  "usdcAmount": null     // populated when completed
}

Agent proxy endpoints

These are public endpoints authenticated by the agentKey UUID. They are used by AI agents directly — not by your backend.

POST/agent/:agentKey/fetchOne-step payment proxy: detect 402 → sign → retry → return datapublic
GET/agent/:agentKey/balanceGet USDC balance and spending stats for this walletpublic
GET/skill/:agentKeyGet the skill.md Markdown file for this walletpublic

POST /agent/:agentKey/fetch — request body

bash
curl -X POST https://api.metera.xyz/agent/YOUR_AGENT_KEY/fetch \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.metera.xyz/p/weather-api",
    "method": "GET",
    "headers": {},
    "body": null
  }'

# On success:
{ "status": 200, "data": { ... }, "paymentMade": true, "amountPaid": 0.001 }

# On tier 3 block:
{ "success": false, "code": "TIER3_APPROVAL_REQUIRED", "approvalId": "uuid" }

# On tier 2 rate block:
{ "success": false, "code": "TIER2_SOFT_BLOCK", "retryAfter": 60 }

GET /agent/:agentKey/balance

bash
curl https://api.metera.xyz/agent/YOUR_AGENT_KEY/balance

{
  "walletAddress": "4Ui3P6mX...",
  "balance": { "usdc": "12.50", "currency": "USDC", "chain": "solana" },
  "stats": { "totalCalls": 142, "totalSpent": "0.142" }
}

Security overview

Metera is designed around a defense-in-depth model for AI agent spending. Multiple layers of enforcement prevent any single point of failure from draining an agent's wallet.

On-chain enforcement
Squads v4 SpendingLimit PDAs enforce the per-call limit immutably on Solana mainnet for paid plans.
Database enforcement
Per-call, per-hour, per-day, and per-month limits are checked before every proxy call for all plans.
Tier governance
Three-tier router gates every call. Tier 3 requires explicit human approval from the dashboard.
Anti-replay protection
Every Solana transaction hash can only be used once. Replay attacks are blocked at the blockchain level.

Squads Protocol v4

Squads Protocol v4 is the leading multisig and treasury management standard on Solana. Metera uses it to create a SpendingLimit PDA for each agent wallet on paid plans.

The SpendingLimit PDA enforces maxAutoApproveUsdc (your maxPerCall value) at the protocol level. No server-side code can bypass this limit — the blockchain rejects the transaction.

Setup happens automatically when you create a wallet on a paid plan. The multisig, vault, and spending limit PDAs are stored on the wallet record and visible in the dashboard.

On-chain enforcement requires the Metera treasury wallet to be funded on mainnet. If Squads setup fails at wallet creation (non-blocking), the wallet falls back to database-only enforcement. This is logged and will be hardened in a future release.

3-tier spending governance

The tier router runs on every proxied call before any payment is made. See the Tier system section above for the full decision table.

Key security properties:

Tier thresholds are per-wallet and configurable by the wallet owner only
Tier 3 approvals expire — a pending approval that is not acted on cannot be retried indefinitely
Tier 2 pattern detection resets when the agent switches to a different endpoint
All tier decisions are logged for audit

Anti-replay protection

Every USDC payment on Solana produces a unique transaction signature. Metera verifies that each signature corresponds to a real, confirmed, correctly-sized payment on-chain.

Solana's block hash mechanism means transaction signatures cannot be reused. Attempting to replay a transaction will fail at the network level before Metera even sees it.

Metera never holds funds in custody. Every payment goes directly wallet-to-wallet on Solana. Your USDC is in your wallet — not in Metera's.

FAQ