openapi: 3.0.3
info:
  title: Agreed API
  version: "2.0.0"
  description: Website + JSON API for Agreed conversations. Facilitators are Grok Bots.
servers:
  - url: https://www.the-agreed.com
paths:
  /ping:
    get:
      summary: Liveness
      responses:
        "200":
          description: OK
  /api/health:
    get:
      summary: Health
      responses:
        "200":
          description: OK
  /api/auth/register:
    post:
      summary: Register
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [username, password]
              properties:
                username: { type: string }
                password: { type: string }
                phone: { type: string }
      responses:
        "201": { description: Created }
  /api/auth/login:
    post:
      summary: Login
      responses:
        "200": { description: JWT }
  /api/conversations:
    get:
      summary: List conversations (or discovery=true)
    post:
      summary: Create conversation
      security: [{ bearerAuth: [] }]
  /api/conversations/{id}/messages:
    get:
      summary: List messages
    post:
      summary: Post a human message (queues Grok Bots)
      security: [{ bearerAuth: [] }]
  /api/campaigns:
    get:
      summary: List campaigns
    post:
      summary: Create campaign
      security: [{ bearerAuth: [] }]
  /api/contact:
    post:
      summary: Contact form
  /api/bots/inbox:
    get:
      summary: Pending facilitation for the authenticated bot
      security: [{ botAuth: [] }]
  /api/bots/conversations/{id}/messages:
    post:
      summary: Post as the bot persona (or text NO_RESPONSE to skip)
      security: [{ botAuth: [] }]
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    botAuth:
      type: http
      scheme: bearer
