Decode and validate x402 protocol messages (payment headers/payloads) from the CLI.
Project description
x402-inspect
Decode and validate x402 protocol messages from the command line.
x402 is an open payment protocol for the internet (HTTP 402), used for agent and machine payments. Its messages ride as base64-encoded JSON in three headers:
| Header | Schema | Sent by |
|---|---|---|
PAYMENT-REQUIRED (v1: none) |
PaymentRequired |
server (402 response) |
PAYMENT-SIGNATURE (v1: X-PAYMENT) |
PaymentPayload |
client (request) |
PAYMENT-RESPONSE |
SettlementResponse |
server (settlement) |
When something rejects your payment, you're usually staring at an opaque base64
blob. x402-inspect decodes it, tells you which message it is, and checks it
against the v2 spec — required fields, EVM address / amount / timestamp / nonce /
signature shape, CAIP-2 network — so you can see what's actually wrong fast.
Install
pip install x402-inspect
Usage
# paste a header value (base64) or raw JSON
x402-inspect "eyJ4NDAyVmVyc2lvbiI6Mi..."
# or pipe it
echo "$PAYMENT_SIGNATURE" | x402-inspect
# machine-readable
x402-inspect --json "$header"
Example:
$ x402-inspect "$header"
kind: PaymentPayload
encoding: base64
findings:
[warn] payload.signature: not a 65-byte 0x EVM signature
[FAIL] payload.authorization.value: required field missing
result: INVALID
Exit code is 0 when valid, 1 when invalid — usable in CI or a pre-flight check.
Library
from x402_inspect import inspect
rep = inspect(header_value) # base64 or JSON
print(rep.kind, rep.ok)
for f in rep.findings:
print(f.level, f.path, f.message)
Scope
- v2 spec (v1
X-PAYMENTheader name tolerated). - Deep validation for the exact / EVM scheme; other schemes/networks are structurally checked and flagged as warnings rather than failures (so a Solana or future-scheme payload still inspects, it just won't over-assert EVM shape).
- Validation only — it never verifies signatures on-chain or contacts a facilitator.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file x402_inspect-0.1.0.tar.gz.
File metadata
- Download URL: x402_inspect-0.1.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c034f201e50b8bd12a946152eecf2ce3eda005ad5472020f61f9452e15e2f8
|
|
| MD5 |
5ffd2ecb08e1710954301c828c334729
|
|
| BLAKE2b-256 |
63069ebf9c0c74b329ebc027a76ec2269cfcb3e69a6011025f55ddcb9428cd46
|
Provenance
The following attestation bundles were made for x402_inspect-0.1.0.tar.gz:
Publisher:
publish.yml on CedricConday/x402-inspect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
x402_inspect-0.1.0.tar.gz -
Subject digest:
f0c034f201e50b8bd12a946152eecf2ce3eda005ad5472020f61f9452e15e2f8 - Sigstore transparency entry: 2047361782
- Sigstore integration time:
-
Permalink:
CedricConday/x402-inspect@1a081b46a9cff37abf6647004466407406da133f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CedricConday
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a081b46a9cff37abf6647004466407406da133f -
Trigger Event:
release
-
Statement type:
File details
Details for the file x402_inspect-0.1.0-py3-none-any.whl.
File metadata
- Download URL: x402_inspect-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81776f141983af17bbc9a7ecf927592cc059b33f30ae5b2d0d3f6642e87f31f1
|
|
| MD5 |
d474f794df7c6d7dfa2082d76024e970
|
|
| BLAKE2b-256 |
da6566d316747ed9893ee0ebacfb1dc33f5a50131cea9f55695510a037669725
|
Provenance
The following attestation bundles were made for x402_inspect-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CedricConday/x402-inspect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
x402_inspect-0.1.0-py3-none-any.whl -
Subject digest:
81776f141983af17bbc9a7ecf927592cc059b33f30ae5b2d0d3f6642e87f31f1 - Sigstore transparency entry: 2047361841
- Sigstore integration time:
-
Permalink:
CedricConday/x402-inspect@1a081b46a9cff37abf6647004466407406da133f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CedricConday
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a081b46a9cff37abf6647004466407406da133f -
Trigger Event:
release
-
Statement type: