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.
Endpoint
GET|POST https://forge-tools.dentreprise.workers.dev/api/x402-manifest-from-openapi
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
url | Optional | string | OpenAPI URL |
spec | Optional | object | Inline spec (POST) |
payTo | Required | string | Receiving address |
price | Optional | string | Default USD price per call |
prices | Optional | string | JSON map {"GET /path": 0.002} |
network | Optional | string | CAIP-2, default eip155:8453 |
base_url | Optional | string | Override 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
x402-compliance
x402 V2 compliance tester: probes any paid endpoint without paying and checks the 402 challenge (PAYMENT-REQUIRED header, x402Version 2, accepts[] schema, CAIP-2 network, atomic amount, canonical USDC asset, payTo, maxTimeoutSeconds, EIP-712 extra, resource, Bazaar extension, CORS) and that free 200s or forged payment headers never unlock the resource.
x402-listing-check
Checks that a host exposes a valid x402 discovery listing (/.
x402-facilitator-health
x402 facilitator health check: calls GET /supported on a facilitator (or on a default list incl.