EN
x402 developer tools · x402

x402-manifest-from-openapi

Turn an OpenAPI 3.x / Swagger 2.0 spec (JSON or YAML, URL or inline) into a ready-to-mount x402 V2 paywall: per-operation accepts[] (exact, CAIP-2 network, atomic USDC amount, payTo, EIP-712 extra), @x402/core route config, Bazaar discovery input/output schemas, a /.well-known/x402 document and a sample PAYMENT-REQUIRED payload.

0.003 USDC / call · {atomic} atomic · 3000 atomic

Endpoint

GET|POST https://forge-tools.dentreprise.workers.dev/api/x402-manifest-from-openapi

Parameters

NameRequiredTypeDescription
urlOptionalstringOpenAPI URL
specOptionalobjectInline spec (POST)
payToRequiredstringReceiving address
priceOptionalstringDefault USD price per call
pricesOptionalstringJSON map {"GET /path": 0.002}
networkOptionalstringCAIP-2, default eip155:8453
base_urlOptionalstringOverride server URL

Example request (unpaid — expect 402)

curl -sS -D - "https://forge-tools.dentreprise.workers.dev/api/x402-manifest-from-openapi?url=https%3A%2F%2Fpetstore3.swagger.io%2Fapi%2Fv3%2Fopenapi.json&payTo=0x7B8bf45ac6AcbA6D4CFB626b57D3f5fF3C9C89F7&price=0.001"

Example 402 challenge

The same object is also sent as a base64 PAYMENT-REQUIRED header. Amounts are atomic USDC units (6 decimals).

{
  "x402Version": 2,
  "error": "Payment required",
  "resource": {
    "url": "https://forge-tools.dentreprise.workers.dev/api/x402-manifest-from-openapi",
    "description": "Turn an OpenAPI 3.x / Swagger 2.0 spec (JSON or YAML, URL or inline) into a ready-to-mount x402 V2 paywall: per-operation accepts[] (exact, CAIP-2 network, atomic USDC amount, payTo, EIP-712 extra), @x402/core route config, Bazaar discovery input/output schemas, a /.well-known/x402 document and a sample PAYMENT-REQUIRED payload.",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "3000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0x7B8bf45ac6AcbA6D4CFB626b57D3f5fF3C9C89F7",
      "maxTimeoutSeconds": 120,
      "extra": {
        "name": "USD Coin",
        "version": "2"
      }
    }
  ]
}

Retry with payment

curl -sS "https://forge-tools.dentreprise.workers.dev/api/x402-manifest-from-openapi?url=https%3A%2F%2Fpetstore3.swagger.io%2Fapi%2Fv3%2Fopenapi.json&payTo=0x7B8bf45ac6AcbA6D4CFB626b57D3f5fF3C9C89F7&price=0.001" \
  -H "PAYMENT-SIGNATURE: $PAYMENT"

Example response

{
  "operations": 19,
  "routes": [
    {
      "method": "GET",
      "path": "/pet/{petId}",
      "accepts": [
        {
          "scheme": "exact",
          "amount": "1000"
        }
      ]
    }
  ],
  "well_known_x402": {
    "version": 1,
    "resources": []
  }
}

Related endpoints