Inspect the live catalogue
curl https://the402machine.com/api/catalog
Plan prices, lifetimes, quotas and availability come from the same catalogue used by the browser checkout.
HTTP API / COMPLETE FLOW / AGENT READY
Use native Lightning, HTTP Payment Authentication, or L402. All three return the same temporary product capabilities.
READY TO IMPORT
Public API definitions with placeholders only. No live credentials.
QUICKSTART
Use a new idempotency key for each intended purchase. Repeating the same request with the same key returns the same order rather than creating another invoice.
curl https://the402machine.com/api/catalog
Plan prices, lifetimes, quotas and availability come from the same catalogue used by the browser checkout.
curl -i -X POST https://the402machine.com/api/payments/catch \
-H 'Idempotency-Key: replace-with-a-unique-key' \
-H 'Content-Type: application/json' \
--data '{"planId":"spark"}'The expected response is HTTP 402 with orderId, amountSats and bolt11.
curl https://the402machine.com/api/payments/{orderId}HTTP 402 means payment is still pending. HTTP 200 returns the product capability once. Save it immediately.
X-Payment-Protocol: payment. HTTP 402 carries WWW-Authenticate: Payment. Repeat the identical request with Authorization: Payment <credential>. HTTP 200 includes Payment-Receipt.X-Payment-Protocol: l402. HTTP 402 carries WWW-Authenticate: L402. Repeat the identical request with Authorization: L402 <macaroon>:<preimage>.Never place invoices, preimages, macaroons or product capabilities in URLs, logs, analytics or shared environments. Credentials are bound to the request method, route and body.
BEFORE YOU CALL IT
The API deliberately uses capability URLs and bearer tokens instead of user accounts. Treat every dispensed token as a password.
Owner, ingest, read and ping tokens have different roles. Send the correct value as Authorization: Bearer ***. Do not put bearer capabilities in query strings, logs, analytics or shared Postman environments.
The native flow returns a JSON quote and supports polling. Payment Authentication and L402 are optional agent adapters over the same BOLT11 invoice and provisioning path. This is not Coinbase x402 compatibility.
Encrypt WHISPER content locally with AES-256-GCM. Upload only application/octet-stream ciphertext. The encryption key never belongs in an API request.
Capabilities disappear at expiry, exhaustion or explicit destruction. Private responses use Cache-Control: no-store; clients should not assume recovery is possible.
Retry-After.Public endpoints
Operational provisioning endpoints are intentionally excluded. These are the routes intended for buyers, integrations and public status consumers.
GATE CONTRACT PREVIEW / DISABLED BY DEFAULT
/api/gate/intentsProject capabilityPOST /api/gate/intents Creates or recovers one request-bound invoice. The stored Lightning Address receives the payment directly.
/api/gate/intents/{intentId}/provePayer proofPOST /api/gate/intents/{intentId}/prove Submits a preimage or Payment Authentication credential for the existing intent. A verified success returns Gate-Receipt.
/api/gate/intents/{intentId}Optional verifyGET /api/gate/intents/{intentId} Polls provider verification only when cryptographic proof is available.
/.well-known/gate-jwks.jsonPublicPublishes the Ed25519 key for GATE receipts. GATE is HTTP 402 and Payment Authentication, not x402 compatibility.
PAYMENTS
/api/catalogPublicGET /api/catalog Returns products, plans, prices, lifetimes, quotas and current availability.
/api/payments/catchIdempotency-KeyPOST /api/payments/catch JSON body: {"planId":"spark|standard|long"}. Returns a CATCH invoice quote with HTTP 402.
/api/payments/whisperRaw ciphertextPOST /api/payments/whisper Requires X-Whisper-Plan. Set X-Whisper-Read-Limit to any whole number from 1 through the selected plan allowance. Optional X-Whisper-Reveal-At schedules reveal. Body must be client-encrypted AES-256-GCM bytes.
/api/payments/pulseIdempotency-KeyPOST /api/payments/pulse JSON body: {"planId":"spark|standard|long"}. Returns a native quote by default. Add X-Payment-Protocol: payment or X-Payment-Protocol: l402 for agent negotiation.
/api/payments/{orderId}PublicGET /api/payments/{orderId} Poll payment state. HTTP 200 returns the provisioned CATCH, WHISPER or PULSE capability.
CATCH
/c/{publicId}Optional ingest tokenPOST|PUT|PATCH|DELETE|GET|HEAD|OPTIONS /c/{publicId} Requests are accepted with or without the ingest token. Valid token-backed events are marked authenticated; tokenless or invalid-token requests remain public. Supported bodies are bounded JSON, text and form data.
/api/catch/{publicId}Owner tokenGET /api/catch/{publicId} Private resource status, lifetime and quota usage.
/api/catch/{publicId}/eventsOwner tokenGET /api/catch/{publicId}/events Cursor pagination with limit, cursor, access=public|authenticated, method, contentType and q filters. Bodies declare bodyEncoding; events include trusted sourceIp and locally resolved approximate IP location as ipLocation when available.
/api/catch/{publicId}/events/{eventId}Owner tokenDELETE /api/catch/{publicId}/events/{eventId} Permanently deletes one stored event.
/api/catch/{publicId}Owner tokenDELETE /api/catch/{publicId} Destroys the inbox, stored events and both CATCH capabilities.
WHISPER
/w/{publicId}Read tokenGET /w/{publicId} Returns application/octet-stream ciphertext and spends one successful read. Scheduled messages return HTTP 425 with Retry-After before reveal. Exhausted, expired and invalid capabilities return 404.
PULSE
/p/{publicId}Ping tokenPOST /p/{publicId} Records one heartbeat. Request bodies are ignored and never stored.
/api/pulse/{publicId}Owner tokenGET /api/pulse/{publicId} Returns private monitor state, counters, settings and expiry.
/api/pulse/{publicId}Owner tokenPATCH /api/pulse/{publicId} Updates any subset of name, description, expectedIntervalSeconds, graceSeconds and publicStatusEnabled.
/api/pulse/public/{publicStatusId}PublicWhen enabled, exposes only name, description, derived state and last signal time through an independent share-only identifier. It never exposes the heartbeat identifier, capabilities or operational settings.
/api/pulse/{publicId}Owner tokenDELETE /api/pulse/{publicId} Destroys the monitor, both private capabilities and public sharing.
MACHINE-READABLE
Use OpenAPI for the contract or Postman for prepared requests.