Skip to main content
API Preview
Developers

x402 Payment Protocol

~alter uses the x402 protocol to turn HTTP 402 “Payment Required” into a real payment layer for AI agents. When an agent runs a paid query against an identity record, the individual who owns that data earns Identity Income on every read.

What is x402?

HTTP status code 402 was reserved for “Payment Required” in 1999 but never standardised. The x402 protocol finally gives it a purpose: a machine-readable payment negotiation flow that AI agents can complete without human intervention.

In ~alter’s implementation, x402 gates paid MCP tools and credential queries. Every transaction creates a micropayment that accrues to the data subject's ledger; indicative only, server-authoritative at settlement.

How it works

The x402 flow has four steps. The entire negotiation is designed for agent-to-agent commerce: no human clicks a “pay” button.

  1. 1Agent calls a paid tool

    A collective’s agent invokes a paid MCP tool (e.g. get_full_trait_vector) or hits a credential query endpoint.

  2. 2Server returns 402 with pricing metadata

    The response includes a JSON body specifying the required payment amount, currency, and recipient address. The agent reads this programmatically.

  3. 3Agent submits payment proof

    The agent completes the payment and resubmits the request with a _payment object containing the receipt or proof of payment.

  4. 4Server fulfils the request

    Payment is verified, the transaction is recorded so Identity Income accrues to the data subject’s ledger, and the full response data is returned.

Example flow

A complete x402 negotiation for the get_full_trait_vector tool:

// 1. Initial request - no payment attached
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_full_trait_vector",
    "arguments": {
      "member_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    }
  }
}

Tool pricing

Every MCP tool, free and paid, ordered by price. Paid tools settle through x402. A free tool settles a $0 signal that still lands in the queried member’s query log. Each identity record also carries a one-time free allowance sized to its engagement level, so early reads can land before any payment.

ToolPrice
alter_presence_readFree
alter_resolve_by_keyFree
alter_resolve_handleFree
begin_golden_threadFree
cancel_requirementFree
check_golden_threadFree
complete_knotFree
create_identity_stubFree
create_requirementFree
describe_traitsFree
dispute_attestationFree
get_competenciesFree
get_engagement_levelFree
get_identity_earningsFree
get_identity_trust_scoreFree
get_network_statsFree
get_privacy_budgetFree
get_profileFree
get_requirementFree
get_startedFree
golden_thread_statusFree
hello_agentFree
list_archetypesFree
list_requirementsFree
poll_requirement_matchesFree
query_matchesFree
register_autonomousFree
register_autonomous_challengeFree
search_identitiesFree
verify_identityFree
attest_domain$0.01 USD
get_trait_snapshot$0.01 USD
get_full_trait_vector$0.10 USD
get_side_quest_graph$0.10 USD
query_graph_similarity$0.30 USD
compute_belonging$0.60 USD
generate_match_narrative$1.00 USD
get_match_recommendations$1.00 USD
query_field$1.00 USD

Identity Income

Every paid query splits four ways and accrues to the data subject’s ledger; the subject keeps 75%. No wallet is needed to earn, payout is deferrable, and the facilitator is a mock today with no live rail yet. How earning, accrual, and payout work, with the worked split and the earnings endpoints, lives on the Identity Income page.

Implementation notes

Free allowance
Each identity record carries a one-time free allowance, sized to its engagement level: higher tiers and deeper trust earn a larger allowance. A free read still earns the queried member recognition, a settled $0 signal that counts toward how legible they are, but it does not earn Identity Income. Once the allowance is spent, reads settle through x402, and only those paid reads earn Identity Income.
Consent enforcement
Even with valid payment, requests are rejected if the individual has not consented to the query category. Payment is not charged for rejected requests.
Transaction recording
All x402 transactions are recorded in the audit database for earnings, compliance, and dispute resolution.
Docs | ~alter