SIWX replaces the API Key. Instead of passing
X-API-KEY, you pass Authorization: SIWX <token> on each request. The gateway verifies the signature and checks for a valid x402 subscription in real time.How It Works
Unlike traditional challenge/response flows, SIWX is stateless and self-contained. The client constructs and signs the message locally, then attaches it to every request.Step-by-Step
- Construct an EIP-4361 message with your wallet address, domain, nonce, and expiration time
- Sign the message with your wallet private key
- Encode as SIWX token:
base64(message).signature - Attach to every API request:
Authorization: SIWX <token> - The gateway verifies the signature and checks that the wallet has an active x402 subscription
- If valid, the request proceeds normally (same as API Key auth)
Token Format
Required Fields
The expiration time is set by the client. You can sign a message valid for minutes, hours, or days. A longer expiration means fewer re-signs, but a shorter one is more secure.
Supported Chains
Prerequisites
SIWX authentication requires an active x402 subscription linked to the wallet address. Without a subscription, the gateway rejects the request with an error. To get a subscription:Usage Examples
cURL
SDK
CLI
The CLI uses SIWX automatically when you log in with a wallet:SIWX vs API Key
Security Considerations
- Stateless: No server-side session. Each request is independently verified.
- Expiration: The client controls token lifetime via the
Expiration Timefield. Expired tokens are rejected. - Domain binding: The message includes
api.chainstream.ioas the domain. Signatures for other domains are rejected. - No private key exposure: The wallet only signs a plaintext message — the private key is never transmitted.
- Subscription check: Even with a valid signature, the request is rejected if the wallet has no active x402 subscription.

