LinkexLinkex Docs
API ReferenceGeneratedX402

Create x402 top-up order

POST
/api/user/topup/x402/orders

Creates a pending top-up order and returns an x402 v2 PaymentRequired challenge to sign. When authenticated with an agent key, the order is bound to that agent wallet and its spend caps apply (any agent_wallet_id in the body is ignored). Error codes include X402_INVALID_AMOUNT, X402_DISABLED, X402_UNSUPPORTED_ASSET, X402_PENDING_CAP (max 3 pending orders).

AuthorizationBearer <token>

Linkex API key (sk-...), including agent keys. Session cookie auth is also accepted on /api/user/* routes.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/user/topup/x402/orders" \  -H "Content-Type: application/json" \  -d '{    "amount_usd": 0  }'
{  "success": true,  "data": {    "order_id": 0,    "status": "pending",    "expires_at": 0,    "amount_usd": 0,    "challenge": {      "x402Version": 2,      "accepts": [        {          "scheme": "exact",          "network": "string",          "amount": "string",          "maxAmountRequired": "string",          "resource": "string",          "payTo": "string",          "maxTimeoutSeconds": 0,          "asset": "string",          "extra": {}        }      ]    }  }}