{
  "openapi": "3.1.0",
  "info": {
    "title": "CourseAdvisor public API",
    "version": "1.0.0",
    "description": "Public endpoints on courseadvisor.ai. No authentication. The MCP server at /mcp offers the same demo enquiry as a tool.",
    "contact": { "name": "CourseAdvisor", "email": "hello@courseadvisor.ai", "url": "https://courseadvisor.ai/developers" }
  },
  "servers": [{ "url": "https://courseadvisor.ai" }],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "The site and its API are up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "enum": ["ok"] },
                    "time": { "type": "string", "format": "date-time" }
                  },
                  "required": ["status"]
                }
              }
            }
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "operationId": "submitDemoEnquiry",
        "summary": "Send a demo enquiry to the CourseAdvisor team",
        "description": "Needs a name, a valid work email, an organisation and a message. Single-line fields must not contain line breaks. Limited to 5 submissions per IP every 10 minutes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": { "schema": { "$ref": "#/components/schemas/Enquiry" } },
            "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/Enquiry" } },
            "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Enquiry" } }
          }
        },
        "responses": {
          "200": { "description": "Enquiry delivered.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } },
          "400": { "description": "The body could not be read.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } },
          "422": { "description": "One or more fields failed validation. See fields.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } },
          "429": { "description": "Too many submissions from this IP.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } },
          "500": { "description": "Delivery is not available. Email hello@courseadvisor.ai instead.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } },
          "502": { "description": "Delivery failed. Email hello@courseadvisor.ai instead.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Enquiry": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "maxLength": 200, "description": "Full name." },
          "email": { "type": "string", "format": "email", "maxLength": 254, "description": "Work email." },
          "organisation": { "type": "string", "maxLength": 200, "description": "Education provider or organisation." },
          "role": { "type": "string", "maxLength": 200, "description": "Job title." },
          "leadVolume": { "type": "string", "maxLength": 50, "description": "Monthly lead volume, for example 3,000." },
          "message": { "type": "string", "maxLength": 5000, "description": "Where leads are leaking, or what you want to see." }
        },
        "required": ["name", "email", "organisation", "message"]
      },
      "Result": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "error": { "type": "string" },
          "fields": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Per-field validation messages." }
        }
      }
    }
  }
}
