{
  "openapi": "3.1.0",
  "info": {
    "title": "Ohmatic API",
    "version": "0.1",
    "description": "Deterministic circuit verifier (ERC) as an HTTP + MCP API. You send a circuit, Ohmatic returns diagnostics + pin-level repair feedback, or refuses. It verifies; it does not generate."
  },
  "paths": {
    "/v1/webhooks/polar": {
      "post": {
        "summary": "Polar Webhook",
        "operationId": "polar_webhook_v1_webhooks_polar_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/signup": {
      "post": {
        "summary": "Signup",
        "description": "ADMIN-gated. The site verifies the email/identity, then calls this server-to-server to mint a\nFRESH VERIFIED key (externalId = normalized email) on the verified free tier\n(OHMATIC_FREE_GENERATIONS per month). Records the confirmed marketing opt-in (the GDPR basis for\nthe 'trial finished' email). Idempotent \u2014 one key per identity. A 0-credit key is valid at cost=0\nfor free generations and 402s once the monthly free tier is spent; a Polar purchase then tops it\nup (binds via externalId=email). Email verification itself belongs to the site.",
        "operationId": "signup_v1_signup_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/anon-key": {
      "post": {
        "summary": "Anon Key",
        "description": "PUBLIC. Mint a free ANONYMOUS key \u2014 OHMATIC_FREE_ANON free generation(s), LIFETIME ('one and\ndone'). The zero-friction 'try it' hook; once spent, the 402 gate nudges email signup (which grants\nOHMATIC_FREE_GENERATIONS free generations a month). Anti-abuse = the swappable _anon_allowed() seam\n(light per-IP daily cap by default).",
        "operationId": "anon_key_v1_anon_key_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "summary": "Billing Checkout",
        "description": "Authed by the caller's API key. Returns a Polar hosted checkout URL to BUY A CREDIT PACK ($5 min); the pack's meter_credit benefit lands the units on the prepaid balance. Body: {pack} (a product_id from /v1/billing/catalog; defaults to the $5 pack). Anon keys are sent to sign up first.",
        "operationId": "billing_checkout_v1_billing_checkout_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/billing/status": {
      "get": {
        "summary": "Billing Status",
        "description": "Authed. Drives the frontend: {tier, free_generations_remaining, balance_usd, balance_micros, needs_topup} — the prepaid balance in USD.",
        "operationId": "billing_status_v1_billing_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/billing/subscribe": {
      "post": {
        "summary": "Billing Subscribe",
        "description": "Authed (verified). Returns a Polar hosted checkout URL to START A MONTHLY PLAN; the plan's meter_credit benefit tops up the prepaid balance each cycle, plus a one-time first-month welcome bonus. Body: {plan} (a product_id from /v1/billing/catalog). Anon keys are sent to sign up first.",
        "operationId": "billing_subscribe_v1_billing_subscribe_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/billing/catalog": {
      "get": {
        "summary": "Billing Catalog",
        "description": "PUBLIC. The buyable products: {currency, min_topup_usd, unit_price_usd, packs:[{product_id, credits_usd}], plans:[{product_id, welcome_usd}]}. Lets a client render Buy/Subscribe without hard-coding product ids.",
        "operationId": "billing_catalog_v1_billing_catalog_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/referral": {
      "post": {
        "summary": "Referral",
        "description": "Authed. Returns {code, link, referred_count, bonus_earned_usd}. The caller earns 10% of what each user they refer spends in that user's first 14 days, paid as bonus credits.",
        "operationId": "referral_v1_referral_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/internal/drain-meter": {
      "post": {
        "summary": "Drain Meter",
        "description": "ADMIN-gated. Re-ingest usage events that failed live ingestion (the durable spool). Idempotent.",
        "operationId": "drain_meter_v1_internal_drain_meter_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/internal/notify-trial-ended": {
      "post": {
        "summary": "Notify Trial Ended",
        "description": "STUB (admin-gated) \u2014 the trial-ended pricing email. NOT YET IMPLEMENTED. See the banner above.",
        "operationId": "notify_trial_ended_v1_internal_notify_trial_ended_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/onboarding": {
      "get": {
        "summary": "Onboarding",
        "operationId": "onboarding_v1_onboarding_get",
        "parameters": [
          {
            "name": "checkout_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Checkout Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_v1_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/verify": {
      "post": {
        "summary": "Verify",
        "operationId": "verify_v1_verify_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/repair-feedback": {
      "post": {
        "summary": "Repair Feedback",
        "operationId": "repair_feedback_v1_repair_feedback_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/credits": {
      "get": {
        "summary": "Credits",
        "operationId": "credits_v1_credits_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  },
  "servers": [
    {
      "url": "https://lanzo-vittoria--ohmaticmcp-api-fastapi-app.modal.run",
      "description": "Ohmatic API (production)"
    }
  ]
}