x402 Quickstart with curl: 402, Pay, Retry
Run the Proxies.sx x402 flow from a terminal: read the HTTP 402 quote, send USDC, retry with Payment-Signature and X-Claim-Secret, then test the proxy.
By Proxies.sx Team. Reviewed .
An x402 purchase at Proxies.sx takes two HTTP requests and one on-chain transfer. The first curl call returns HTTP 402 with the USDC amount, the asset and the payTo address for Base and for Solana. You send that transfer from your own wallet. The second call repeats the same URL with Payment-Signature set to the transaction hash and X-Claim-Secret set to a random value you keep, and it returns a Pool Gateway credential, a session token and the management links. Send the retry within 15 minutes of the block that carries the payment.
Read live x402 pool pricingNo key or payment needed.
In this guide
1. Read the quote (HTTP 402)
Ask for the product without paying. The query below asks for 1 GB on the peer tier with the username preset to the United States. country only presets the username; the credential routes to every country in its tier. traffic is required and starts at 0.1 GB. Optional parameters are duration in seconds, sid and rot.
The answer is HTTP 402. The body is {"x402Version":1, "error":..., "accepts":[...]} with one entry for Base and one for Solana, and the same JSON is base64-encoded in the payment-required response header. Each entry has scheme: "exact", network, maxAmountRequired, asset, payTo and maxTimeoutSeconds: 900. A pool.claim object reminds you to send X-Claim-Secret.
umask 077 # files written below are readable by you only
URL='https://api.proxies.sx/v1/x402/pool?tier=peer&country=us&traffic=1'
curl -s -o quote.json -w '%{http_code}\n' "$URL" # prints 402
jq '.accepts[] | {network, maxAmountRequired, asset, payTo, maxTimeoutSeconds}' quote.json
jq -r '.description' quote.json2. Check the quote before paying
A quote is an instruction to move money, so check it like one. The IETF draft on status code 402 warns that an attacker who can insert or modify responses can substitute their own payment information.
- Recipient.
payTomust equalrecipientAddressfor the same network in /v1/x402/pricing. - Asset.
assetmust be the official USDC contract on Base or the USDC mint on Solana (see Circle's address list in the sources). - Amount.
maxAmountRequireddivided by 1,000,000 is the USDC price. It should match the GB you asked for at the rate in /v1/x402/pool/pricing, including the volume step for 25 GB and above. - Description. The
descriptionnames the tier and GB being quoted. If it names a different GB from the one you requested, yourtrafficvalue was not accepted: fix it and ask again.
Q='.accepts[] | select(.network=="base")'
jq -r "$Q | .payTo" quote.json
curl -s https://api.proxies.sx/v1/x402/pricing | jq -r '.networks[] | select(.network=="base") | .recipientAddress'
# the two lines must be identical
jq -r "$Q | .maxAmountRequired" quote.json # "4000000" = 4 USDC3. Pay from your wallet
Send exactly maxAmountRequired of asset to payTo on the network you picked, as an ordinary token transfer from your own wallet. Wait until the transaction is confirmed. On Base you then hold a transaction hash, and on Solana a transaction signature. The Base guide shows a Foundry cast command and the Solana guide an spl-token command that read every value from quote.json.
Nothing in this flow asks you to sign a payload for the server. If a client library offers to sign an x402 authorization, it is built for a different rail; see which clients work.
4. Retry with the proof within 15 minutes
Repeat the same request with two extra headers: Payment-Signature carrying the hash or signature, and X-Claim-Secret carrying a random value of 16 to 128 characters. Present the hash within 15 minutes of the block that carries the payment; the quote says so in maxTimeoutSeconds: 900. A hash first presented inside that window stays valid for retries. A successful check answers HTTP 200.
If the check fails, the answer is 402 again with the reason in error, or a 4xx or 503 with instructions. Do not pay a second time. The x402 errors guide lists the common reasons and the right next step.
CLAIM_SECRET=$(openssl rand -hex 24) # 48 characters: store it next to the tx hash
printf '%s\n' "$CLAIM_SECRET" > claim-secret.txt
curl -s -o credential.json -w '%{http_code}\n' "$URL" \
-H "Payment-Signature: <BASE_TX_HASH_OR_SOLANA_SIGNATURE>" \
-H "X-Claim-Secret: $CLAIM_SECRET" # prints 200
jq 'keys' credential.json # field names only, no secrets5. Keep the claim secret and the session token
credential.json holds the proxy password and the session token, so keep it private. The response contains:
| Field | What it is |
|---|---|
proxy | host (gw.proxies.sx), httpPort (7000), a DSL username, the pak_ password, a ready http URL and a usernameTemplate |
credit | allocatedGB, usedGB, remainingGB, expiresAt and enabled |
sessionToken | An x402s_ token for every /v1/x402/manage/pool/* call, sent as X-Session-Token |
manage, stockUrl | Management links, and the live stock endpoint for the pool |
account | The paying wallet is also an account login: POST /v1/login/wallet/challenge, then /v1/login/wallet/verify |
If the response is lost before you save it, repeat the paid request with the same hash and the same claim secret: the server returns the credential again. Without the claim secret you would need the session token, which was in the lost response, so the secret is your safety net.
6. Test the credential
Send one request through the gateway without printing the credential. A 200 means the credential works. A gateway refusal arrives as CODE: message (req: id), explained in the proxy error codes guide. To change country, session or rotation, edit the username; the rotation cookbook has the tokens.
curl -s -o /dev/null -w '%{http_code}\n' -x "$(jq -r .proxy.http credential.json)" https://example.com7. Read usage and top up
The session token reads the credit, the connection details and the daily usage. Top up with POST /v1/x402/manage/pool/topup and {"addTrafficGB": n}: the call answers 402 with the amount, and you pay it and repeat the call with Payment-Signature. The pool credential guide describes each call. To see every purchase of this wallet in one list, or to buy Private modems, sign in with the wallet as the wallet account recipe shows.
TOKEN=$(jq -r .sessionToken credential.json)
curl -s https://api.proxies.sx/v1/x402/manage/pool/credit -H "X-Session-Token: $TOKEN" | jq .Common questions
Why do I get the same 402 again after paying?
The server could not accept the proof and put the reason in the error field. Common reasons are a transfer to a different address, an amount below the quote, or a retry later than the payment window. A payment the chain has not confirmed yet answers 409 instead: retry with the same hash after 15 seconds. Read the reason before doing anything else, and never send a second payment for the same request.
Is X-Claim-Secret required?
It is optional, and we recommend it on every paid request. It is the only way to read the credential again if the paid response is lost, because the session token travels in that same response.
Can I use POST instead of GET?
Yes. The pool endpoint accepts GET and POST with the same parameters, and the payment headers are the same.
Sources and test scope
Quotes, prices and response fields on these pages were read from the live API without payment on 30 November 2026, and the error texts come from the backend build running that day. The wallet account examples follow the source of that build, and their signing commands were checked offline against its verification code. Standards and third-party documentation were checked the same day. These pages do not establish current stock in a country.
Next steps
The x402 overview lists every endpoint. The wallet account recipe gives both purchase paths step by step: x402 direct, and signing in with the paying wallet. Agents can read the machine contracts directly: skill.md for the whole service, pool/skill.md for the Pool Gateway and marketplace/skill.md for the dedicated port. The MCP server gives Claude, Cursor and other clients the same tools, and the price list covers account purchases.
x402 guides: buy proxy access with USDC
Start from the x402 overview, or open the guide for the step you are on.