Skip to main content
Agent endpoints are in beta. MPP equivalent: GET /agent/mpp/api-keys/create. Overview: Agentic payments.
Agents only. This endpoint is for agents (wallet-based, programmatic access). Dashboard customers create API keys at admin.mobula.io, not via this x402 endpoint.
GET /agent/x402/api-keys/create creates a new API key for your agent. No query parameters. The paying wallet is verified against your subscription; the new key is tied to the same agent. Cost: $0.001 USDC (facilitator fee). You must have an active plan (subscribe first).

Request flow

  1. Call GET /agent/x402/api-keys/create with no payment → 402 Payment Required with $0.001 USDC.
  2. Sign the payment and retry with an x-payment header → 200 OK with api_key and user_id.
Response (200 OK):
404 — No agent for this wallet. Subscribe first via x402 Subscribe to a plan.

Reference scripts

Uses the same wallet as for subscribe.
Prerequisites: Solana wallet with USDC for $0.001 and SOL for fees.Full script (uses @solana/kit, @x402/core, @x402/svm). Inline base58ToBytes below, or use import { base58ToBytes } from './base58.ts' when running from scripts/src/x402/.

To revoke an API key: x402 Revoke API key. Full walkthrough: x402 Subscription and top-up.