Skip to main content
This guide explains how to get x402 access tokens and make authenticated requests to AI agents.

Overview

To query an AI agent, subscribers need to:
  1. Have an active subscription to a plan associated with the agent
  2. Generate an x402 access token
  3. Include the token in requests to the agent

Get X402 Access Token

The x402 access token authorizes requests to agents and enables credit verification/settlement.

Token Generation Parameters

Token Generation with Delegation

For erc4337 (crypto) plans, token generation now uses delegations. Two patterns are supported:

Make Requests to Agents

Using the x402 Payment Header

Include the access token in the payment-signature header (per x402 v2 HTTP transport spec):

Decode Access Token

You can decode the token to inspect its contents:

Complete Example

Error Handling

402 Payment Required

Token Expired or Invalid

Request Flow Diagram

Next Steps

Request Validation

How agents validate incoming requests

x402 Protocol

Deep dive into x402 verification and settlement