{
  "openapi": "3.1.0",
  "info": {
    "title": "ODEN Search API",
    "version": "1.0.0",
    "summary": "Web search and synthesis for LLMs and AI agents.",
    "description": "POST a natural-language query and receive a synthesized answer plus ranked, citation-backed source metadata as JSON. robots.txt and the EU TDM opt-out are honored at the source, so disallowed pages never appear in a citation. Full documentation: https://oden-api.com/docs",
    "termsOfService": "https://oden-api.com/terms",
    "contact": {
      "name": "ODEN support",
      "email": "support@oden-api.com",
      "url": "https://oden-api.com/contact"
    },
    "license": {
      "name": "Commercial",
      "url": "https://oden-api.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.oden-api.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "ODEN documentation",
    "url": "https://oden-api.com/docs"
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/search": {
      "post": {
        "operationId": "search",
        "summary": "Search the web and return a cited answer",
        "description": "Runs a live web search, extracts and ranks passages semantically, and returns a synthesized answer with the sources it drew on. One call; no follow-up scrape needed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Plain query",
                  "value": {
                    "query": "What changed in the EU AI Act in 2026?"
                  }
                },
                "citationsOnly": {
                  "summary": "Citations without a synthesized answer",
                  "value": {
                    "query": "EU AI Act 2026 changes",
                    "answer": false,
                    "max_results": 5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answer and its citations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body or missing query.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or unknown API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit hit, or the monthly quota is spent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "searchViaQuery",
        "summary": "Same search, as a GET with query parameters",
        "description": "Convenience form for shells and quick tests. Prefer POST in production.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The query."
          },
          {
            "name": "answer",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "Include a synthesized answer."
          },
          {
            "name": "depth",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "basic",
                "advanced"
              ],
              "default": "advanced"
            }
          },
          {
            "name": "max_results",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8,
              "default": 8
            }
          },
          {
            "name": "snippets",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer and its citations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "description": "No authentication required. Use for uptime checks.",
        "security": [],
        "responses": {
          "200": {
            "description": "Service is up."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from https://oden-api.com/app, sent as \"Authorization: Bearer <key>\"."
      }
    },
    "schemas": {
      "SearchRequest": {
        "type": "object",
        "required": [
          "query"
        ],
        "additionalProperties": false,
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "description": "The natural-language query."
          },
          "answer": {
            "type": "boolean",
            "default": true,
            "description": "Include a synthesized answer in results.answer. Send false for citations only."
          },
          "depth": {
            "type": "string",
            "enum": [
              "basic",
              "advanced"
            ],
            "default": "advanced",
            "description": "basic returns search snippets (~1.5 s). advanced runs full passage extraction."
          },
          "max_results": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 8,
            "description": "Cap the number of citations returned."
          },
          "include_snippets": {
            "type": "boolean",
            "default": false,
            "description": "Add one attributed sentence per citation."
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "trace_id": {
            "type": "string",
            "description": "Include this when reporting a problem."
          },
          "execution_time_ms": {
            "type": "number"
          },
          "cached": {
            "type": "boolean",
            "description": "True when served from the one-hour answer cache."
          },
          "results": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string",
                "description": "Synthesized answer. Absent when the sources did not support one — ODEN drops an answer it cannot ground rather than guessing."
              },
              "citations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Citation"
                }
              }
            }
          }
        }
      },
      "Citation": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Relevance to the query."
          },
          "snippet": {
            "type": "string",
            "description": "Present only when include_snippets was set."
          },
          "license": {
            "type": "string",
            "description": "Source licence, e.g. CC BY-SA 4.0, when one applies."
          },
          "license_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "limit": {
            "type": "integer",
            "description": "Present on quota errors."
          },
          "used": {
            "type": "integer",
            "description": "Present on quota errors."
          }
        }
      }
    }
  }
}