{
  "openapi": "3.1.0",
  "info": {
    "title": "NevetsInc Website API",
    "description": "Public HTTP surface of the NevetsInc website (https://nevetsinc.vercel.app). These endpoints back the on-site NevAI assistants and the support form. They are the only public API NevetsInc offers today. Any /api/* path not listed here returns 404 with {\"error\": \"not_found\"}.\n\nMachine-readable entry points: llms.txt (https://nevetsinc.vercel.app/llms.txt), this document (/openapi.json), and the MCP server at /.well-known/mcp.",
    "version": "1.0.0",
    "contact": {
      "name": "NevetsInc Support",
      "url": "https://nevetsinc.vercel.app/support"
    }
  },
  "servers": [
    {
      "url": "https://nevetsinc.vercel.app",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/nevai": {
      "get": {
        "operationId": "getNevAiStatus",
        "summary": "NevAI assistant status",
        "description": "Returns the status of the NevAI website assistant, including how many documents and terms its local search model is trained on.",
        "responses": {
          "200": {
            "description": "NevAI is online.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "online",
                    "engine",
                    "documents",
                    "terms"
                  ],
                  "properties": {
                    "online": {
                      "type": "boolean"
                    },
                    "engine": {
                      "type": "string"
                    },
                    "documents": {
                      "type": "integer",
                      "description": "Number of indexed website pages"
                    },
                    "terms": {
                      "type": "integer",
                      "description": "Number of indexed search terms"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "askNevAi",
        "summary": "Ask the NevAI assistant",
        "description": "Ask a question about NevetsInc, its products (NevOS, Spark), policies, safety, accounts, or support. Answers are computed from published NevetsInc pages and public company data; no external AI service is used. This is the recommended endpoint for agents that need grounded answers about NevetsInc.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "message"
                ],
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "The question to answer"
                  },
                  "history": {
                    "type": "array",
                    "description": "Optional preceding messages for context",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant"
                          ]
                        },
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "NevAI answer with source links.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "text",
                    "sources"
                  ],
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "The answer in plain text"
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "description": "Public page or data resource on nevetsinc.vercel.app supporting the answer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or unreadable message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/chat": {
      "post": {
        "operationId": "chatWithAssistant",
        "summary": "Chat with the floating site assistant",
        "description": "Powers the floating chat bubble on the website. First tries to answer from local intent rules; when useGemini is true and no local answer matches, it falls back to a server-side model (only available when configured). Prefer /api/nevai for grounded Q&A.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "message"
                ],
                "properties": {
                  "message": {
                    "type": "string"
                  },
                  "history": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "isBot": {
                          "type": "boolean"
                        },
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "lastIntent": {
                    "type": "string",
                    "description": "Intent of the previous turn, for follow-up handling"
                  },
                  "useGemini": {
                    "type": "boolean",
                    "default": false,
                    "description": "Allow fallback to the server-side model"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Assistant reply.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "text",
                    "suggestions",
                    "intent",
                    "source"
                  ],
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Suggested follow-up prompts"
                    },
                    "intent": {
                      "type": "string",
                      "description": "Matched intent name, or 'fallback'"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "local",
                        "gemini"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server-side model not configured and no local answer matched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/support": {
      "post": {
        "operationId": "submitSupportRequest",
        "summary": "Submit a support request",
        "description": "Submits the support form to the NevetsInc team. Requires a Cloudflare Turnstile token from the on-site widget; unattended automated use is blocked by the captcha. Humans should use the form at /support. Responses to this endpoint are for the form; for agent-readable contact info see the Organization JSON-LD and /llms.txt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "message",
                  "token"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 200,
                    "description": "The sender's reply address"
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "token": {
                    "type": "string",
                    "description": "Cloudflare Turnstile token"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Support request delivered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required information or message too long.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Captcha verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unable to deliver the support email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "operationId": "getSystemStatus",
        "summary": "System status (self-checked)",
        "description": "Runs live self-checks against the NevetsInc website APIs, the Spark application, the NevAI engine, and the configuration of the support email and Turnstile captcha services. Nothing is hardcoded; every check is re-run on each request with an 8s timeout.",
        "responses": {
          "200": {
            "description": "Live system status report.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "summary",
                    "generatedAt",
                    "checks"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "operational",
                        "degraded",
                        "down"
                      ],
                      "description": "Overall derived status of all checks."
                    },
                    "summary": {
                      "type": "string",
                      "description": "Human-readable overall status text."
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "checks": {
                      "type": "array",
                      "description": "Individual checks, one per system.",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "name",
                          "category",
                          "type",
                          "status",
                          "latencyMs",
                          "checkedAt",
                          "detail"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "live",
                              "config",
                              "self"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "operational",
                              "degraded",
                              "down"
                            ]
                          },
                          "latencyMs": {
                            "type": "integer"
                          },
                          "checkedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "detail": {
                            "type": "string",
                            "description": "What was actually probed and the observed result."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/hiring": {
      "post": {
        "operationId": "submitHiringApplication",
        "summary": "Submit a hiring application",
        "description": "Submits the open application form to the NevetsInc hiring team. Requires a Cloudflare Turnstile token from the on-site widget; unattended automated use is blocked by the captcha. Humans should use the form at /hiring. Responses to this endpoint are for the form; for agent-readable company info see the Organization JSON-LD and /llms.txt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "role",
                  "message",
                  "token"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 200,
                    "description": "The applicant's reply address"
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "The role or area the applicant is applying for"
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "token": {
                    "type": "string",
                    "description": "Cloudflare Turnstile token"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Hiring application delivered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required information or application too long.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Captcha verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unable to deliver the hiring application email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error. Unknown /api/* paths always return {\"error\": \"not_found\"} with status 404."
          }
        }
      }
    }
  }
}
