Live product · Access approved individually

DEVELOPER SURFACE / DOCS

FROM API KEY TOLIVE METER.

The full integration model for authentication, products, funded balances, session lifecycle events, route groups, billing logic, MCP tools, and final session records.

SESSION APILIVE SYSTEM MAP
CONTROLSESSIONSTATE / ACTIVE
01AUTHidentify seller
02STARTgrant access
03TICKrecord usage
04ENDfinalize cost
VERIFIABLE INPUTEXPLICIT LIMITREADABLE OUTPUT
01 / AUTHScoped credentials
02 / TRANSPORTREST / JSON
03 / REFERENCELegacy contract
04 / FLOWStart to close
REFERENCE STATUSFull product model restored from the legacy docs.

The schemas and route shapes below preserve the previous public contract. Confirm the active API origin, enabled rails, and account-specific capabilities during onboarding before production integration.

QUICK START / 01

FROM ACCOUNT
TO FIRST SESSION.

Create an approved merchant account, register one product, then open a session after the customer has a funded balance.

01

Apply and verify your identity

Submit the first-party merchant application, then sign in with the same email through Privy. Approval remains a separate Metr review.

STEP 01
1. Open /merchant/apply
2. Submit product and rail requirements
3. Verify the same email at /merchant/login
4. Wait for merchant status = approved
02

Define a product

Describe the billable service, rate unit, price, rail, grace period, and optional session cap.

STEP 02
curl -X POST "$METR_API/api/v1/merchant/products" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{
    "name": "GPU access",
    "chain": "base",
    "rateUnit": "minute",
    "pricePerUnit": "0.10",
    "graceSeconds": 30,
    "maxSpendPerSession": "5.00"
  }'
03

Start a session

After the customer is identified and funded, open a session and control the metering lifecycle from your product.

STEP 03
curl -X POST "$METR_API/api/v1/customer/sessions/start" \
  -H "authorization: Bearer $CUSTOMER_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "productId": "prod_abc123" }'

AUTHENTICATION / 02

IDENTITY BEFORE
VALUE MOVES.

Merchant sign-in uses a short-lived Privy access token. The Metr server verifies that token and independently checks the linked application’s approval status. Programmatic product access uses scoped merchant API keys, which should remain outside client code.

PRIVY

Merchant identity

Email OTP establishes identity; it does not automatically grant an approved merchant workspace.

metr_…

API keys

Merchant keys are created for programmatic access, displayed once, and revocable by identifier.

x-api-key

Agent clients

Machine integrations can authenticate through a header on approved API and MCP connections.

AUTHORIZATION
authorization: Bearer PRIVY_ACCESS_TOKEN

CORE CONCEPTS / 03

ONE OBJECT CONNECTS
THE LIFECYCLE.

A product defines the commercial rule. A funded balance authorizes spend. A session connects the customer, rate, active time, total charge, and final record.

Product fields

FIELDTYPEPURPOSE
namestringHuman-readable product name
chainconfigured networkSettlement environment selected for the product
rateUnitminute | hour | dayBilling interval exposed by the legacy contract
pricePerUnitnumeric stringPrice applied to one rate unit
allowedAssetsusdc | native | both | customAsset policy for the product
customTokenIdstring | nullRegistered token rail when custom is selected
graceSecondsintegerUncharged time before billing begins
maxSpendPerSessionnumeric string | nullMaximum charge for one session

Session lifecycle

STARTACTIVEPAUSERESUMEEND
BALANCE

Prepaid

Access begins against funds already available to the customer on the configured product rail.

GRACE

Grace period

Time may be observed before charges begin, based on the product’s configured allowance.

CAP

Spend ceiling

The session stops accruing charges at the explicit maximum set for the product.

CUSTOM TOKENS / 04

CONFIGURE THE RAIL.
VERIFY THE ASSET.

The legacy contract included merchant-registered SPL and ERC-20 rails. The safe operational model is register → validate contract and decimals → verify pricing/liquidity assumptions → enable per product.

TOKEN REGISTRATION
POST /api/v1/merchant/tokens
{
  "chain": "base",
  "tokenAddress": "0x…",
  "symbol": "TOKEN",
  "name": "Example Token",
  "decimals": 18
}
AVAILABILITY NOTE

A listed asset or network is not automatically enabled for every account. Production support depends on the configured rail and verification path.

API REFERENCE / 05

THE COMPLETE
ROUTE MAP.

All legacy routes were grouped under /api/v1. Requests and responses use JSON unless a specific integration says otherwise.

METHODPATHAUTHPURPOSE
POST/merchant/applicationsPublicSubmit or update an access application
GET/merchant/accessPrivyVerify identity and read merchant approval status
GET/merchant/productsMerchantList billable products
POST/merchant/productsMerchantCreate a billable product
DELETE/merchant/products/:idMerchantRemove a product
GET/merchant/api-keysMerchantList API-key prefixes
POST/merchant/api-keysMerchantCreate an API key
GET/merchant/tokensMerchantList registered token rails
POST/merchant/tokensMerchantRegister a token configuration
GET/customer/balancesCustomerRead funded balances
GET/customer/sessionsCustomerList session history
POST/customer/sessions/startCustomerOpen a metered session
POST/customer/sessions/pauseCustomerPause active-time accrual
POST/customer/sessions/resumeCustomerResume a paused session
POST/customer/sessions/endCustomerFinalize usage and close
SESSION RESPONSE
{
  "id": "session_uuid",
  "status": "active",
  "startedAt": "2026-08-27T18:00:00.000Z",
  "totalSeconds": 0,
  "totalCharged": "0"
}

BILLING LOGIC / 06

VISIBLE RULES.
DETERMINISTIC MATH.

The legacy billing model tracked elapsed time, applied any configured grace period, rounded billable time to engine intervals, then enforced the remaining session cap before recording a charge.

ELAPSEDGRACE×RATECAP
ILLUSTRATIVE CALCULATION
rate = $0.10 / minute
elapsed = 45 seconds
grace = 30 seconds
billable = 15 seconds
charge = billable × rate_per_second

CHAINS & ASSETS / 07

PRODUCT-SCOPED
SETTLEMENT.

The prior docs modeled products on Solana, Polygon, Base, and Robinhood Chain, with stablecoin, native, or configured custom-token paths. Treat this as architecture scope; enabled production rails are confirmed per account.

SOLANAUSDC / SOL
POLYGONUSDC / POL
BASEUSDC / ETH / METR
ROBINHOOD CHAINConfigured path
NO IMPLICIT CROSS-CHAIN BILLING

Each product is pinned to its configured environment. A balance on one network should not be represented as spendable on another without an explicit bridge or messaging design.

MCP SERVER / 08

LET AGENTS DISCOVER
THE BILLING SURFACE.

The legacy MCP design exposed public discovery tools and authenticated session tools over streamable HTTP. The same deposit and session policies apply; the MCP layer does not bypass verification.

TOOLAUTHPURPOSE
list_agentsPublicSearch marketplace listings by category or rail
get_agentPublicRead one listing’s product details
get_payment_requirementsPublicRead a product’s 402 payment requirements
register_customerAPI keyIdentify a customer for a merchant
get_customer_balanceAPI keyRead a customer’s available balance
submit_depositAPI keySubmit a deposit for verification
start_sessionAPI keyOpen a metered session
end_sessionAPI keyFinalize a session charge
CLIENT CONFIG
{
  "mcpServers": {
    "metr": {
      "url": "$METR_API/api/v1/mcp",
      "headers": { "x-api-key": "metr_your_key" }
    }
  }
}

ERROR HANDLING / 09

FAIL CLEARLY.
STOP SAFELY.

STATUSMEANINGCOMMON CAUSES
400Bad requestInvalid input, missing field, or insufficient balance
401UnauthorizedMissing, invalid, or wrong credential type
404Not foundProduct, customer, or session does not exist
500Server errorUnexpected internal failure
ERROR RESPONSE
{
  "message": "insufficient balance for this product"
}
LIVE PRODUCT

BUILD WHAT
GETS METERED.

Metr is live. Access is currently approved individually for businesses, developers, and agent builders.

Request access