{
  "openapi": "3.1.0",
  "info": {
    "title": "Syntakk search API (/ask)",
    "version": "1.0.0",
    "summary": "Public, read-only NLWeb search over the articles and pages on syntakk.dk.",
    "description": "`/ask` answers natural-language questions about the EU Battery Regulation ((EU) 2023/1542) and digital battery passports by searching the content of syntakk.dk (Danish and English). It follows the NLWeb `ask` convention: a `query` goes in, a ranked list of pages with schema.org objects comes out, as JSON or as a server-sent event stream.\n\nThe API is open and read-only: no login, no API key. It is rate limited to 60 requests per minute per IP address; above that it answers `429` with a `Retry-After` header. Every response carries `RateLimit-Policy`, `RateLimit` and the older `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers (also as `X-RateLimit-*`); the numbers come from a per-instance counter and are approximate. Only the `list` mode is implemented; `summarize` and `generate` are accepted and answered as `list`. There is no pagination: one response holds at most 25 results (`limit`), so narrow the query or the `site` filter instead of paging.\n\nVersioning: the API is at major version 1, and `info.version` follows semantic versioning. Send the optional `API-Version` request header (default and only value: `1`) to pin the version; an unknown value gives `400 unsupported_version`, and every response repeats the version in `API-Version`. Breaking changes are announced at least 6 months ahead on the developer page and with `Deprecation` (RFC 9745) and `Sunset` (RFC 8594) response headers; additive changes (new optional fields or parameters) are not breaking.\n\nThe Syntakk platform itself has no public API. See https://syntakk.dk/en/developers (Danish: https://syntakk.dk/udviklere) for the MCP server, llms.txt and the agent skill.",
    "termsOfService": "https://syntakk.dk/en/developers#terms",
    "contact": {
      "name": "Syntakk ApS",
      "url": "https://syntakk.dk/en/contact/",
      "email": "hello@syntakk.dk"
    },
    "license": {
      "name": "Syntakk public API terms: free use within the rate limit, link back to the source pages",
      "url": "https://syntakk.dk/en/developers#terms"
    },
    "x-api-lifecycle": {
      "versioning": "Semantic versioning in info.version; major version selected with the optional API-Version request header (default 1).",
      "currentMajorVersion": "1",
      "supportedVersions": [
        "1"
      ],
      "breakingChangeNotice": "At least 6 months, announced on https://syntakk.dk/en/developers#versioning and with Deprecation (RFC 9745) and Sunset (RFC 8594) response headers.",
      "nonBreakingChanges": "New optional request parameters, new response fields, new error codes for new situations."
    }
  },
  "servers": [
    {
      "url": "https://syntakk.dk",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Search",
      "description": "Natural-language search over syntakk.dk",
      "externalDocs": {
        "description": "Developer documentation",
        "url": "https://syntakk.dk/en/developers"
      }
    }
  ],
  "externalDocs": {
    "description": "Developer page (English)",
    "url": "https://syntakk.dk/en/developers"
  },
  "paths": {
    "/ask": {
      "get": {
        "operationId": "askGet",
        "tags": [
          "Search"
        ],
        "summary": "Search syntakk.dk with a natural-language query",
        "description": "Returns the best matching pages for `query`. Responds with JSON by default, or with a `text/event-stream` when `streaming=true` or the request has `Accept: text/event-stream`. Any method other than GET, POST and OPTIONS is answered with `405`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/query"
          },
          {
            "$ref": "#/components/parameters/site"
          },
          {
            "$ref": "#/components/parameters/prev"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/num_results"
          },
          {
            "$ref": "#/components/parameters/streaming"
          },
          {
            "$ref": "#/components/parameters/mode"
          },
          {
            "$ref": "#/components/parameters/query_id"
          },
          {
            "$ref": "#/components/parameters/API-Version"
          }
        ],
        "responses": {
          "200": {
            "description": "The best matches, ranked by score. An empty `results` array (with `result_count: 0`) means nothing matched; it is not an error.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "Vary": {
                "description": "`Accept` on JSON responses.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The JSON answer from `/ask`.",
                  "required": [
                    "query_id",
                    "query",
                    "site",
                    "prev",
                    "mode",
                    "filters",
                    "result_count",
                    "results"
                  ],
                  "properties": {
                    "query_id": {
                      "type": "string",
                      "description": "Your `query_id`, or a deterministic id like `q_1b538d4b`."
                    },
                    "query": {
                      "type": "string",
                      "description": "The query as understood (trimmed)."
                    },
                    "site": {
                      "type": "string",
                      "description": "The `site` filter as sent, or `syntakk.dk` when none was given."
                    },
                    "prev": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The earlier queries as understood."
                    },
                    "mode": {
                      "type": "string",
                      "const": "list",
                      "description": "Always `list`."
                    },
                    "filters": {
                      "type": "object",
                      "description": "The filters that `site` was turned into.",
                      "required": [
                        "lang",
                        "type"
                      ],
                      "properties": {
                        "lang": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "da",
                            "en",
                            null
                          ],
                          "description": "Language filter, or `null` for both."
                        },
                        "type": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "article",
                            "legal",
                            "page",
                            null
                          ],
                          "description": "Type filter, or `null` for all types."
                        }
                      }
                    },
                    "result_count": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of items in `results`."
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Result"
                      }
                    }
                  }
                },
                "example": {
                  "query_id": "q_1b538d4b",
                  "query": "when is the battery passport mandatory",
                  "site": "en",
                  "prev": [],
                  "mode": "list",
                  "filters": {
                    "lang": "en",
                    "type": null
                  },
                  "result_count": 1,
                  "results": [
                    {
                      "url": "https://syntakk.dk/en/digital-battery-passport-2027",
                      "name": "Digital battery passport 2027: is your company ready?",
                      "site": "syntakk.dk",
                      "score": 100,
                      "description": "Mandatory data points in the battery passport The battery passport must contain both information about the battery model and information specific to the individual battery.",
                      "lang": "en",
                      "type": "article",
                      "schema_object": {
                        "@context": "https://schema.org",
                        "@type": "Article",
                        "name": "Digital battery passport 2027: is your company ready?",
                        "url": "https://syntakk.dk/en/digital-battery-passport-2027",
                        "description": "Digital battery passports become mandatory from 18 February 2027. See which batteries are covered, who is responsible, the data points and the timeline.",
                        "inLanguage": "en",
                        "dateModified": "2026-11-23",
                        "isPartOf": {
                          "@type": "WebSite",
                          "name": "Syntakk",
                          "url": "https://syntakk.dk"
                        },
                        "headline": "Digital battery passport 2027: is your company ready?",
                        "datePublished": "2026-01-26",
                        "publisher": {
                          "@type": "Organization",
                          "name": "Syntakk",
                          "url": "https://syntakk.dk"
                        }
                      }
                    }
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Each event is one `data: <json>` line followed by a blank line. The JSON is a `StreamResultMessage` (`message_type: \"result\"`, at most 5 results each) for every batch of results, then one `StreamCompleteMessage` (`message_type: \"complete\"`) as the last event. The stream then closes."
                },
                "example": "data: {\"message_type\":\"result\",\"query_id\":\"q_7c7607a6\",\"content\":[{\"url\":\"https://syntakk.dk/qr-kode-til-batterier\",\"name\":\"Alle batterier skal have en QR-kode fra 2027\",\"site\":\"syntakk.dk\",\"score\":100,\"description\":\"...\",\"lang\":\"da\",\"type\":\"page\",\"schema_object\":{\"@context\":\"https://schema.org\",\"@type\":\"WebPage\",\"name\":\"Alle batterier skal have en QR-kode fra 2027\",\"url\":\"https://syntakk.dk/qr-kode-til-batterier\",\"description\":\"...\",\"inLanguage\":\"da\",\"isPartOf\":{\"@type\":\"WebSite\",\"name\":\"Syntakk\",\"url\":\"https://syntakk.dk\"}}}]}\n\ndata: {\"message_type\":\"complete\",\"query_id\":\"q_7c7607a6\",\"query\":\"qr\",\"result_count\":1}\n\n"
              }
            }
          },
          "400": {
            "description": "The request could not be used. `error.code` is one of `missing_query`, `invalid_body`, `invalid_limit`, `invalid_mode`, `query_too_long`, `unsupported_version`.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "missing_query",
                    "message": "The query parameter is required, e.g. /ask?query=what+are+importers+obligations"
                  }
                }
              }
            }
          },
          "405": {
            "description": "The method is not GET, POST or OPTIONS.",
            "headers": {
              "Allow": {
                "description": "`GET, POST, OPTIONS`.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "Use GET or POST"
                  }
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests per minute from the same IP address. Wait `Retry-After` seconds and try again.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: at most 60 per minute per IP. Retry in 60 seconds."
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "askPost",
        "tags": [
          "Search"
        ],
        "summary": "Search syntakk.dk with a natural-language query (request body)",
        "description": "Same as `GET /ask`, with the parameters in a JSON or `application/x-www-form-urlencoded` body. Parameters in the query string are used for any field missing from the body, so `query` may alternatively be given in the URL. Streaming is chosen the same way as for GET.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AskRequestJson"
              },
              "example": {
                "query": "when is the battery passport mandatory",
                "site": "en",
                "limit": 3
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AskRequestForm"
              },
              "example": "query=qr+code+requirement&site=en&limit=3"
            }
          }
        },
        "responses": {
          "200": {
            "description": "The best matches, ranked by score. An empty `results` array (with `result_count: 0`) means nothing matched; it is not an error.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "Vary": {
                "description": "`Accept` on JSON responses.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The JSON answer from `/ask`.",
                  "required": [
                    "query_id",
                    "query",
                    "site",
                    "prev",
                    "mode",
                    "filters",
                    "result_count",
                    "results"
                  ],
                  "properties": {
                    "query_id": {
                      "type": "string",
                      "description": "Your `query_id`, or a deterministic id like `q_1b538d4b`."
                    },
                    "query": {
                      "type": "string",
                      "description": "The query as understood (trimmed)."
                    },
                    "site": {
                      "type": "string",
                      "description": "The `site` filter as sent, or `syntakk.dk` when none was given."
                    },
                    "prev": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The earlier queries as understood."
                    },
                    "mode": {
                      "type": "string",
                      "const": "list",
                      "description": "Always `list`."
                    },
                    "filters": {
                      "type": "object",
                      "description": "The filters that `site` was turned into.",
                      "required": [
                        "lang",
                        "type"
                      ],
                      "properties": {
                        "lang": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "da",
                            "en",
                            null
                          ],
                          "description": "Language filter, or `null` for both."
                        },
                        "type": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "article",
                            "legal",
                            "page",
                            null
                          ],
                          "description": "Type filter, or `null` for all types."
                        }
                      }
                    },
                    "result_count": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of items in `results`."
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Result"
                      }
                    }
                  }
                },
                "example": {
                  "query_id": "q_1b538d4b",
                  "query": "when is the battery passport mandatory",
                  "site": "en",
                  "prev": [],
                  "mode": "list",
                  "filters": {
                    "lang": "en",
                    "type": null
                  },
                  "result_count": 1,
                  "results": [
                    {
                      "url": "https://syntakk.dk/en/digital-battery-passport-2027",
                      "name": "Digital battery passport 2027: is your company ready?",
                      "site": "syntakk.dk",
                      "score": 100,
                      "description": "Mandatory data points in the battery passport The battery passport must contain both information about the battery model and information specific to the individual battery.",
                      "lang": "en",
                      "type": "article",
                      "schema_object": {
                        "@context": "https://schema.org",
                        "@type": "Article",
                        "name": "Digital battery passport 2027: is your company ready?",
                        "url": "https://syntakk.dk/en/digital-battery-passport-2027",
                        "description": "Digital battery passports become mandatory from 18 February 2027. See which batteries are covered, who is responsible, the data points and the timeline.",
                        "inLanguage": "en",
                        "dateModified": "2026-11-23",
                        "isPartOf": {
                          "@type": "WebSite",
                          "name": "Syntakk",
                          "url": "https://syntakk.dk"
                        },
                        "headline": "Digital battery passport 2027: is your company ready?",
                        "datePublished": "2026-01-26",
                        "publisher": {
                          "@type": "Organization",
                          "name": "Syntakk",
                          "url": "https://syntakk.dk"
                        }
                      }
                    }
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Each event is one `data: <json>` line followed by a blank line. The JSON is a `StreamResultMessage` (`message_type: \"result\"`, at most 5 results each) for every batch of results, then one `StreamCompleteMessage` (`message_type: \"complete\"`) as the last event. The stream then closes."
                },
                "example": "data: {\"message_type\":\"result\",\"query_id\":\"q_7c7607a6\",\"content\":[{\"url\":\"https://syntakk.dk/qr-kode-til-batterier\",\"name\":\"Alle batterier skal have en QR-kode fra 2027\",\"site\":\"syntakk.dk\",\"score\":100,\"description\":\"...\",\"lang\":\"da\",\"type\":\"page\",\"schema_object\":{\"@context\":\"https://schema.org\",\"@type\":\"WebPage\",\"name\":\"Alle batterier skal have en QR-kode fra 2027\",\"url\":\"https://syntakk.dk/qr-kode-til-batterier\",\"description\":\"...\",\"inLanguage\":\"da\",\"isPartOf\":{\"@type\":\"WebSite\",\"name\":\"Syntakk\",\"url\":\"https://syntakk.dk\"}}}]}\n\ndata: {\"message_type\":\"complete\",\"query_id\":\"q_7c7607a6\",\"query\":\"qr\",\"result_count\":1}\n\n"
              }
            }
          },
          "400": {
            "description": "The request could not be used. `error.code` is one of `missing_query`, `invalid_body`, `invalid_limit`, `invalid_mode`, `query_too_long`, `unsupported_version`.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "missing_query",
                    "message": "The query parameter is required, e.g. /ask?query=what+are+importers+obligations"
                  }
                }
              }
            }
          },
          "405": {
            "description": "The method is not GET, POST or OPTIONS.",
            "headers": {
              "Allow": {
                "description": "`GET, POST, OPTIONS`.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "Use GET or POST"
                  }
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests per minute from the same IP address. Wait `Retry-After` seconds and try again.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "API-Version": {
                "$ref": "#/components/headers/APIVersion"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Every error is JSON in this shape.",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "missing_query",
                            "invalid_body",
                            "invalid_limit",
                            "invalid_mode",
                            "query_too_long",
                            "unsupported_version",
                            "method_not_allowed",
                            "rate_limited"
                          ],
                          "description": "Stable machine-readable code."
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable explanation, in English."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: at most 60 per minute per IP. Retry in 60 seconds."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/API-Version"
          }
        ]
      },
      "options": {
        "operationId": "askOptions",
        "tags": [
          "Search"
        ],
        "summary": "CORS preflight",
        "description": "Answers `204` with the CORS headers. Browsers send this before cross-origin POST requests with a JSON body.",
        "responses": {
          "204": {
            "description": "No content. CORS headers allow any origin.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always `*`.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "description": "`GET, POST, OPTIONS`.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Headers": {
                "description": "`Content-Type, Accept, API-Version`.",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Max-Age": {
                "description": "`86400` (seconds).",
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Expose-Headers": {
                "description": "The response headers a browser script may read: `Retry-After`, `API-Version`, `Deprecation`, `Sunset` and the rate limit headers.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "query": {
        "name": "query",
        "in": "query",
        "required": true,
        "description": "The question or search words, in Danish or English. Leading and trailing whitespace is ignored.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "example": "when is the battery passport mandatory"
      },
      "site": {
        "name": "site",
        "in": "query",
        "required": false,
        "description": "NLWeb `site` filter, a token or a comma-separated list of tokens. Language: `da`, `en` (also `syntakk.dk/en`). Type: `articles` (also `article`, `blog`), `legal`, `pages` (also `page`). `syntakk.dk`, `all` or empty means everything. Unknown tokens are ignored. The value is echoed back in the response.",
        "schema": {
          "type": "string",
          "default": "syntakk.dk",
          "examples": [
            "en",
            "da",
            "en,articles",
            "legal"
          ]
        }
      },
      "prev": {
        "name": "prev",
        "in": "query",
        "required": false,
        "description": "Earlier queries in the same conversation, as a comma-separated list or a JSON array of strings. At most 10 are kept. They are echoed back and do not change the ranking.",
        "schema": {
          "type": "string"
        },
        "example": "what is a battery passport,who needs one"
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Maximum number of results. An integer of at least 1. Values above 25 are lowered to 25 instead of being rejected. Anything that is not a positive number gives the error `invalid_limit`.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 25,
          "default": 10
        }
      },
      "num_results": {
        "name": "num_results",
        "in": "query",
        "required": false,
        "description": "Alias for `limit`, used only when `limit` is not given.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 25
        }
      },
      "streaming": {
        "name": "streaming",
        "in": "query",
        "required": false,
        "description": "`true` answers with a server-sent event stream (`text/event-stream`), `false` (also `0`, `no`, `off`) with JSON. When omitted, the `Accept` header decides: `text/event-stream` gives a stream, anything else JSON.",
        "schema": {
          "type": "boolean"
        }
      },
      "mode": {
        "name": "mode",
        "in": "query",
        "required": false,
        "description": "NLWeb mode. Only `list` is implemented: `summarize` and `generate` are accepted but answered as `list` (the response always has `mode: \"list\"`). Any other value gives the error `invalid_mode`.",
        "schema": {
          "type": "string",
          "enum": [
            "list",
            "summarize",
            "generate"
          ],
          "default": "list"
        }
      },
      "query_id": {
        "name": "query_id",
        "in": "query",
        "required": false,
        "description": "Your own id for the query, echoed back in the response (truncated to 100 characters). When omitted, a deterministic id of the form `q_xxxxxxxx` is made from the query, `site` and `prev`.",
        "schema": {
          "type": "string",
          "maxLength": 100
        }
      },
      "API-Version": {
        "name": "API-Version",
        "in": "header",
        "required": false,
        "description": "The major API version. Optional: when omitted the current version (`1`) is used, exactly as before this header existed. `1`, `1.0` and `1.0.0` all select version 1. Any other value gives `400 unsupported_version`. The version used is repeated in the `API-Version` response header. See Versioning on the developer page.",
        "schema": {
          "type": "string",
          "enum": [
            "1"
          ],
          "default": "1"
        },
        "example": "1"
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "APIVersion": {
        "description": "The API version that answered the request (`1`).",
        "schema": {
          "type": "string",
          "enum": [
            "1"
          ]
        }
      },
      "RateLimitPolicy": {
        "description": "IETF draft `RateLimit-Policy`: the quota policy, `\"default\";q=60;w=60` (60 requests per 60-second window).",
        "schema": {
          "type": "string",
          "example": "\"default\";q=60;w=60"
        }
      },
      "RateLimit": {
        "description": "IETF draft `RateLimit`: remaining quota (`r`) and seconds until the window resets (`t`), e.g. `\"default\";r=59;t=60`. Approximate: counted per function instance.",
        "schema": {
          "type": "string",
          "example": "\"default\";r=59;t=60"
        }
      },
      "RateLimitLimit": {
        "description": "Requests allowed per window (60). Same as `X-RateLimit-Limit`.",
        "schema": {
          "type": "integer",
          "example": 60
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left in the current window. Approximate (per function instance); `0` on a `429`.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "example": 59
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "example": 60
        }
      },
      "XRateLimitLimit": {
        "description": "Same as `RateLimit-Limit`.",
        "schema": {
          "type": "integer",
          "example": 60
        }
      },
      "XRateLimitRemaining": {
        "description": "Same as `RateLimit-Remaining`.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "example": 59
        }
      },
      "XRateLimitReset": {
        "description": "Same as `RateLimit-Reset`.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "example": 60
        }
      },
      "Deprecation": {
        "description": "Only present when the version used is deprecated: `@<unix time>` per RFC 9745.",
        "schema": {
          "type": "string",
          "example": "@1798761600"
        }
      },
      "Sunset": {
        "description": "Only present when the version used has a retirement date: an HTTP date per RFC 8594. Always at least 6 months after the announcement.",
        "schema": {
          "type": "string",
          "example": "Thu, 01 Jul 2027 00:00:00 GMT"
        }
      }
    },
    "schemas": {
      "AskRequestJson": {
        "type": "object",
        "description": "JSON body for `POST /ask`. The same fields as the query-string parameters of `GET /ask`.",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The question or search words."
          },
          "site": {
            "type": "string",
            "description": "NLWeb `site` filter, see the `site` query parameter."
          },
          "prev": {
            "description": "Earlier queries in the conversation: an array of strings, or a comma-separated string. At most 10 are kept.",
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 10
              },
              {
                "type": "string"
              }
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25,
            "default": 10,
            "description": "Maximum number of results (values above 25 are lowered to 25)."
          },
          "num_results": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25,
            "description": "Alias for `limit`."
          },
          "streaming": {
            "type": "boolean",
            "description": "`true` answers with a server-sent event stream."
          },
          "mode": {
            "type": "string",
            "enum": [
              "list",
              "summarize",
              "generate"
            ],
            "default": "list",
            "description": "Only `list` is implemented."
          },
          "query_id": {
            "type": "string",
            "maxLength": 100,
            "description": "Your own id for the query, echoed back."
          }
        },
        "additionalProperties": false
      },
      "AskRequestForm": {
        "type": "object",
        "description": "Form body for `POST /ask` (`application/x-www-form-urlencoded`). Every value is a string; `prev` is comma-separated.",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The question or search words."
          },
          "site": {
            "type": "string",
            "description": "NLWeb `site` filter, see the `site` query parameter."
          },
          "prev": {
            "type": "string",
            "description": "Earlier queries, comma-separated (or a JSON array as text)."
          },
          "limit": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Maximum number of results, 1 to 25."
          },
          "num_results": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Alias for `limit`."
          },
          "streaming": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "`true` answers with a server-sent event stream."
          },
          "mode": {
            "type": "string",
            "enum": [
              "list",
              "summarize",
              "generate"
            ],
            "description": "Only `list` is implemented."
          },
          "query_id": {
            "type": "string",
            "maxLength": 100,
            "description": "Your own id for the query, echoed back."
          }
        },
        "additionalProperties": false
      },
      "AskResponse": {
        "type": "object",
        "description": "The JSON answer from `/ask`.",
        "required": [
          "query_id",
          "query",
          "site",
          "prev",
          "mode",
          "filters",
          "result_count",
          "results"
        ],
        "properties": {
          "query_id": {
            "type": "string",
            "description": "Your `query_id`, or a deterministic id like `q_1b538d4b`."
          },
          "query": {
            "type": "string",
            "description": "The query as understood (trimmed)."
          },
          "site": {
            "type": "string",
            "description": "The `site` filter as sent, or `syntakk.dk` when none was given."
          },
          "prev": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The earlier queries as understood."
          },
          "mode": {
            "type": "string",
            "const": "list",
            "description": "Always `list`."
          },
          "filters": {
            "type": "object",
            "description": "The filters that `site` was turned into.",
            "required": [
              "lang",
              "type"
            ],
            "properties": {
              "lang": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "da",
                  "en",
                  null
                ],
                "description": "Language filter, or `null` for both."
              },
              "type": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "article",
                  "legal",
                  "page",
                  null
                ],
                "description": "Type filter, or `null` for all types."
              }
            }
          },
          "result_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of items in `results`."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Result"
            }
          }
        }
      },
      "Result": {
        "type": "object",
        "description": "One matching page.",
        "required": [
          "url",
          "name",
          "site",
          "score",
          "description",
          "lang",
          "type",
          "schema_object"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Canonical URL of the page. Append `.md` for the markdown version."
          },
          "name": {
            "type": "string",
            "description": "Page title."
          },
          "site": {
            "type": "string",
            "description": "Always `syntakk.dk`."
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Relevance, normalised so the best result is 100."
          },
          "description": {
            "type": "string",
            "description": "An excerpt from the page that matches the query."
          },
          "lang": {
            "type": "string",
            "enum": [
              "da",
              "en"
            ],
            "description": "Language of the page."
          },
          "type": {
            "type": "string",
            "enum": [
              "article",
              "legal",
              "page"
            ],
            "description": "Kind of page."
          },
          "schema_object": {
            "$ref": "#/components/schemas/SchemaObject"
          }
        }
      },
      "SchemaObject": {
        "type": "object",
        "description": "The page as a schema.org `Article` (articles) or `WebPage` (other pages).",
        "required": [
          "@context",
          "@type",
          "name",
          "url",
          "description",
          "inLanguage",
          "isPartOf"
        ],
        "properties": {
          "@context": {
            "type": "string",
            "const": "https://schema.org"
          },
          "@type": {
            "type": "string",
            "enum": [
              "Article",
              "WebPage"
            ]
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "inLanguage": {
            "type": "string",
            "enum": [
              "da",
              "en"
            ]
          },
          "dateModified": {
            "type": "string",
            "format": "date",
            "description": "Date of the last update."
          },
          "isPartOf": {
            "type": "object",
            "description": "The `WebSite` the page belongs to."
          },
          "headline": {
            "type": "string",
            "description": "Articles only."
          },
          "datePublished": {
            "type": "string",
            "format": "date",
            "description": "Articles only, when known."
          },
          "publisher": {
            "type": "object",
            "description": "Articles only: the `Organization` Syntakk."
          }
        },
        "additionalProperties": true
      },
      "StreamResultMessage": {
        "type": "object",
        "description": "A `data:` event with a batch of up to 5 results.",
        "required": [
          "message_type",
          "query_id",
          "content"
        ],
        "properties": {
          "message_type": {
            "type": "string",
            "const": "result"
          },
          "query_id": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Result"
            },
            "maxItems": 5
          }
        }
      },
      "StreamCompleteMessage": {
        "type": "object",
        "description": "The last `data:` event of a stream.",
        "required": [
          "message_type",
          "query_id",
          "query",
          "result_count"
        ],
        "properties": {
          "message_type": {
            "type": "string",
            "const": "complete"
          },
          "query_id": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "result_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Every error is JSON in this shape.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "missing_query",
                  "invalid_body",
                  "invalid_limit",
                  "invalid_mode",
                  "query_too_long",
                  "unsupported_version",
                  "method_not_allowed",
                  "rate_limited"
                ],
                "description": "Stable machine-readable code."
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation, in English."
              }
            }
          }
        }
      }
    }
  }
}
