{"openapi":"3.1.0","info":{"title":"SigmanticAI Gateway","version":"1.0.0"},"paths":{"/v1/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Email/password login — proxied to Supabase.\n\nThe client sends credentials here instead of talking to Supabase directly.\nThis keeps the Supabase service key server-side.","operationId":"login_v1_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/otp/send":{"post":{"tags":["auth"],"summary":"Otp Send","description":"Send a one-time code to the user's email for headless CLI login.\n\nWorks for all account types (Google, email/password, etc.) as long\nas the email exists in Supabase.  Uses Supabase's built-in OTP flow.","operationId":"otp_send_v1_auth_otp_send_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpSendRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/otp/verify":{"post":{"tags":["auth"],"summary":"Otp Verify","description":"Verify the OTP code and return access/refresh tokens.\n\nThe token is the 6-digit code from the user's email.","operationId":"otp_verify_v1_auth_otp_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh","description":"Refresh an expired access token using a fresh client to avoid contamination.","operationId":"refresh_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/me":{"get":{"tags":["auth"],"summary":"Me","description":"Return the authenticated user's info.","operationId":"me_v1_auth_me_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/quota":{"get":{"tags":["auth"],"summary":"Quota","description":"Check the authenticated user's generation quota.","operationId":"quota_v1_auth_quota_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuotaInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/usage":{"post":{"tags":["auth"],"summary":"Usage Increment","description":"Increment usage after a successful generation.","operationId":"usage_increment_v1_auth_usage_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/firebase-bridge":{"post":{"tags":["auth"],"summary":"Firebase Bridge","description":"Bridge Firebase Auth → Supabase Auth.\n\nAccepts a Firebase ID token from the website, verifies it,\nfinds or creates the matching Supabase user, and returns a\nSupabase access token that works with all billing endpoints.","operationId":"firebase_bridge_v1_auth_firebase_bridge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirebaseBridgeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirebaseBridgeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/checkout":{"post":{"tags":["billing"],"summary":"Create Checkout","description":"Create a Stripe Checkout session for a subscription.","operationId":"create_checkout_v1_billing_checkout_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/portal":{"post":{"tags":["billing"],"summary":"Create Portal","description":"Create a Stripe Customer Portal session.","operationId":"create_portal_v1_billing_portal_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/webhook":{"post":{"tags":["billing"],"summary":"Stripe Webhook","description":"Stripe webhook handler — processes subscription events.\n\nThis endpoint does NOT require Bearer auth. Instead, Stripe signs\nthe payload with the webhook secret, which we verify.\n\nHandled events:\n  - checkout.session.completed  — activate plan\n  - customer.subscription.updated — update plan on change\n  - customer.subscription.deleted — downgrade to free\n  - invoice.paid — reset quota on billing cycle renewal\n  - invoice.payment_failed — log warning\n\nIMPORTANT: ``invoice.paid`` must be registered in the Stripe\nDashboard webhook settings for monthly quota reset to work.","operationId":"stripe_webhook_v1_billing_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health","description":"ALB health check endpoint.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"CheckoutRequest":{"properties":{"price_id":{"type":"string","title":"Price Id"},"success_url":{"type":"string","title":"Success Url"},"cancel_url":{"type":"string","title":"Cancel Url"}},"type":"object","required":["price_id","success_url","cancel_url"],"title":"CheckoutRequest"},"CheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"},"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["url","session_id"],"title":"CheckoutResponse"},"FirebaseBridgeRequest":{"properties":{"firebase_token":{"type":"string","title":"Firebase Token"}},"type":"object","required":["firebase_token"],"title":"FirebaseBridgeRequest"},"FirebaseBridgeResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"}},"type":"object","required":["access_token","refresh_token","user_id","email"],"title":"FirebaseBridgeResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"LoginResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"expires_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires At"},"user":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"User"}},"type":"object","required":["access_token","refresh_token"],"title":"LoginResponse"},"OtpSendRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"OtpSendRequest"},"OtpVerifyRequest":{"properties":{"email":{"type":"string","title":"Email"},"token":{"type":"string","title":"Token"}},"type":"object","required":["email","token"],"title":"OtpVerifyRequest"},"PortalRequest":{"properties":{"return_url":{"type":"string","title":"Return Url"}},"type":"object","required":["return_url"],"title":"PortalRequest"},"PortalResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"PortalResponse"},"QuotaInfo":{"properties":{"allowed":{"type":"boolean","title":"Allowed"},"used":{"type":"number","title":"Used"},"max":{"type":"number","title":"Max"},"remaining":{"type":"number","title":"Remaining"},"plan":{"type":"string","title":"Plan"}},"type":"object","required":["allowed","used","max","remaining","plan"],"title":"QuotaInfo"},"RefreshRequest":{"properties":{"refresh_token":{"type":"string","title":"Refresh Token"}},"type":"object","required":["refresh_token"],"title":"RefreshRequest"},"UserInfo":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","default":""},"email_confirmed":{"type":"boolean","title":"Email Confirmed","default":false}},"type":"object","required":["id","email"],"title":"UserInfo"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}