{"openapi":"3.1.0","info":{"title":"x402 Org Auth API","version":"2.0.0","description":"Pay-per-call org token issuance.","x-guidance":"POST /orgs (free) to create an org, POST /orgs/{orgId}/members (free) to add a member, then POST /orgs/{orgId}/tokens (paid) to issue a signed scoped access token. You are charged only when a signed token is actually handed back — an unknown org, a non-member userId, or a signing/store fault all cost nothing. The token's role claim comes from the member's recorded role, never from the request body.","x-payment-policy":"NEVER CHARGED FOR AN UNDELIVERABLE ANSWER. The x402 middleware cancels settlement for any response >= 400, so every error below moves $0.00 and emits no payment-response header."},"paths":{"/orgs/{orgId}/tokens":{"post":{"operationId":"issueToken","summary":"Issue a signed scoped access token","tags":["Auth"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.050000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"},"expiresInSec":{"type":"number","description":"Optional, clamped to the service min/max."}}}}}},"responses":{"201":{"description":"Signed HS256 token plus its decoded claims. The only response you are charged for."},"400":{"description":"NOT CHARGED. `invalid_request` — userId missing/not a string, or expiresInSec not a number."},"402":{"description":"Payment Required"},"404":{"description":"NOT CHARGED. `org_not_found` (no such org) or `not_a_member` (userId has no recorded membership in this org, so no scoped token can be minted). Both `retryable:false`.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["org_not_found","not_a_member"]},"message":{"type":"string"},"charged":{"type":"boolean","enum":[false]},"retryable":{"type":"boolean","enum":[false]},"orgId":{"type":"string"},"userId":{"type":"string"}}}}}},"405":{"description":"NOT CHARGED. Wrong HTTP verb for this resource; see the Allow header."},"503":{"description":"NOT CHARGED. `org_store_unavailable` (org/membership store unreadable) or `token_signing_failed` (no usable credential produced). Both `retryable:true`."}}}}}}