{"openapi":"3.1.0","info":{"title":"Gatefare API","version":"2.0.0","summary":"x402 payment proxy for APIs. Non-custodial settlement on Base.","description":"Register APIs, discover them, pay per call in USDC via HTTP 402. All non-GET requests require the X-Gatefare-Request header.","contact":{"email":"support@gatefare.io","url":"https://gatefare.io/docs"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"}},"servers":[{"url":"https://gatefare.io","description":"Production (Base mainnet)"}],"externalDocs":{"description":"Human-readable docs + LLM context","url":"https://gatefare.io/docs"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT | gfpat_*","description":"Pass a JWT from /api/auth/login or /siwe/verify, OR a PAT prefixed gfpat_."}},"parameters":{"CsrfHeader":{"name":"X-Gatefare-Request","in":"header","required":true,"schema":{"type":"string","default":"1"},"description":"Anti-CSRF gate. Any non-empty value accepted."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-switchable code"}}},"User":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string","format":"email","nullable":true},"displayName":{"type":"string","nullable":true},"handle":{"type":"string","nullable":true},"walletAddress":{"type":"string","nullable":true},"emailVerified":{"type":"boolean"},"isAdmin":{"type":"boolean"}}},"Session":{"type":"object","properties":{"token":{"type":"string","description":"JWT (7d expiry)"},"user":{"$ref":"#/components/schemas/User"}}},"ApiItem":{"type":"object","properties":{"slug":{"type":"string"},"urlName":{"type":"string"},"handle":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"price":{"type":"string","example":"$0.01"},"network":{"type":"string","example":"eip155:8453"},"networkName":{"type":"string"},"proxyUrl":{"type":"string"},"splitAddress":{"type":"string"},"iconUrl":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}}}},"RegisterApiBody":{"type":"object","required":["urlName","name","targetUrl","price","ownerWallet","network"],"properties":{"urlName":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]$","maxLength":50},"name":{"type":"string","maxLength":80},"targetUrl":{"type":"string","format":"uri","description":"MUST NOT contain query string or fragment"},"price":{"type":"string","example":"0.01"},"ownerWallet":{"type":"string"},"network":{"type":"string","enum":["eip155:8453","eip155:84532"]},"walletSignature":{"type":"string","description":"EIP-191 signature. Required when ownerWallet differs from linked wallet."},"description":{"type":"string","maxLength":200},"categories":{"type":"array","items":{"type":"string"},"maxItems":5},"tags":{"type":"array","items":{"type":"string"},"maxItems":10},"headers":{"type":"object","additionalProperties":{"type":"string"}}}},"X402Response":{"type":"object","required":["x402Version","accepts"],"properties":{"x402Version":{"type":"integer","enum":[2]},"accepts":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string","example":"exact"},"network":{"type":"string","example":"eip155:8453"},"maxAmountRequired":{"type":"string","description":"Micro-USDC (1e-6 units)"},"resource":{"type":"string"},"description":{"type":"string"},"payTo":{"type":"string","description":"Split contract address"},"maxTimeoutSeconds":{"type":"integer"},"extra":{"type":"object"}}}}}}}},"security":[{"bearerAuth":[]}],"paths":{"/api/info":{"get":{"summary":"Service metadata + live stats","security":[],"responses":{"200":{"description":"OK"}}}},"/api/networks":{"get":{"summary":"Supported networks","security":[],"responses":{"200":{"description":"OK"}}}},"/api/catalog":{"get":{"summary":"Browse public API marketplace","security":[],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"price_max","in":"query","schema":{"type":"number"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["popular","new","price"]}},{"name":"includeTestnet","in":"query","schema":{"type":"integer","enum":[0,1]}},{"name":"page","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"}}}},"/api/catalog/{handle}/{urlName}":{"get":{"summary":"Canonical API detail","security":[],"parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string"}},{"name":"urlName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Not found"}}}},"/api/auth/register":{"post":{"summary":"Create an account with email+password","security":[],"parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password","acceptTerms"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":12},"displayName":{"type":"string"},"walletAddress":{"type":"string"},"acceptTerms":{"type":"boolean","enum":[true]}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Validation error"},"409":{"description":"Email exists"}}}},"/api/auth/login":{"post":{"summary":"Email + password login","security":[],"parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"},"401":{"description":"Bad credentials"}}}},"/api/auth/siwe/nonce":{"post":{"summary":"Request a SIWE challenge","security":[],"parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"}}}},"/api/auth/siwe/verify":{"post":{"summary":"Redeem a signed SIWE message for a JWT","security":[],"parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid signature"}}}},"/api/auth/pat":{"post":{"summary":"Mint a Personal Access Token","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["label","scopes"],"properties":{"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read","write:catalog","write:sensitive","write:wallet","admin:pat","full"]}},"expiresInDays":{"type":"integer"}}}}}},"responses":{"201":{"description":"Created"}}}},"/api/auth/me":{"get":{"summary":"Current user profile","responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update profile (handle, bio, links)","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"}}}},"/api/wallet-challenge":{"post":{"summary":"Request a signed-message challenge for a wallet","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"}}}},"/api/register":{"post":{"summary":"Register a new API (publisher)","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterApiBody"}}}},"responses":{"201":{"description":"Registered"},"400":{"description":"Validation error (HANDLE_REQUIRED, TARGET_URL_HAS_QUERY, ...)"},"403":{"description":"INSUFFICIENT_SCOPE"},"409":{"description":"SLUG_TAKEN"}}}},"/api/my":{"get":{"summary":"List your APIs","responses":{"200":{"description":"OK"}}}},"/api/my/{slug}":{"get":{"summary":"Owner view of a single API","responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update an API","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Soft-delete an API (30d window)","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"204":{"description":"Deleted"}}}},"/api/my/{slug}/distribute":{"post":{"summary":"Call distribute() on-chain — pays out the split","parameters":[{"$ref":"#/components/parameters/CsrfHeader"}],"responses":{"200":{"description":"OK — tx hash returned"}}}},"/p/{handle}/{urlName}":{"parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string"}},{"name":"urlName","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Paid proxy — first call returns 402, X-Payment header pays, response forwarded","security":[],"responses":{"200":{"description":"Upstream response (after payment)"},"402":{"description":"x402 Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/X402Response"}}}},"451":{"description":"Suspended (AUP or legal hold)"}}}}}}