openapi: 3.1.0
info:
  title: solvemax API
  version: "1.0"
  description: >
    Run the solvemax decision engine: clarify, widen the option field, locked-weight scoring,
    5,000 seeded simulated futures, red team, and a blind second-pass audit. Returns the full
    verdict slip. 1 verdict credit per call; failed runs auto-refund.
servers:
  - url: https://solvemax.solveright.ai
paths:
  /api/v1/verdict:
    post:
      operationId: get_verdict
      summary: Run a decision through the full engine and get the verdict slip
      security: [{ bearerAuth: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [decision]
              properties:
                decision:
                  type: string
                  minLength: 20
                  maxLength: 6000
                  description: The decision in plain words — options optional, messy is fine.
                mode:
                  type: string
                  enum: [DECIDE, COMPARE, GRILL]
                auto:
                  type: boolean
                  default: true
                  description: Engine answers its own clarify questions with confidence-tagged recommendations.
                answers:
                  type: array
                  maxItems: 5
                  items:
                    type: object
                    required: [q, a]
                    properties: { q: { type: string }, a: { type: string } }
      responses:
        "200":
          description: Completed verdict slip
          content:
            application/json:
              schema:
                type: object
                properties:
                  slug: { type: string }
                  url: { type: string, description: Shareable slip page }
                  clarified: { type: array, items: { type: object } }
                  slip: { type: object, description: Full structured verdict (headline, podium, matrix, kill criteria, verification) }
                  credits_remaining: { type: integer }
        "401": { description: Invalid API key }
        "402": { description: Out of verdict credits }
        "429": { description: Rate limited (30/hour/key) }
        "503": { description: Engine at daily capacity }
    get:
      operationId: fetch_verdict
      summary: Retrieve one of your past verdicts by slug
      security: [{ bearerAuth: [] }]
      parameters:
        - in: query
          name: slug
          required: true
          schema: { type: string }
      responses:
        "200": { description: The run and its slip if complete }
        "404": { description: Not found }
components:
  securitySchemes:
    bearerAuth: { type: http, scheme: bearer }
