{
  "openapi": "3.1.0",
  "info": {
    "title": "Kirjapro public discovery endpoints",
    "version": "1.0.0",
    "description": "Anonymous machine-readable entry points for discovering Kirjapro and checking public website availability. This specification does not expose customer, company, banking, invoice, or accounting data and is not a general accounting REST API.",
    "contact": {
      "name": "Kirjapro support",
      "email": "tuki@kirjapro.fi",
      "url": "https://kirjapro.fi/contact/"
    }
  },
  "servers": [
    {
      "url": "https://kirjapro.fi",
      "description": "Kirjapro public website"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getDiscoveryHealth",
        "summary": "Check discovery availability",
        "tags": [
          "Discovery"
        ],
        "description": "Returns a small anonymous status document for the public discovery surface. It never reads or returns an authenticated user, company, or accounting record.",
        "responses": {
          "200": {
            "description": "The public discovery surface is available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                },
                "example": {
                  "status": "ok",
                  "service": "kirjapro.fi",
                  "scope": "public-discovery"
                }
              }
            }
          },
          "405": {
            "description": "The HTTP method is not supported.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "default": {
            "description": "The request could not be fulfilled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headDiscoveryHealth",
        "summary": "Check discovery availability without a response body",
        "tags": [
          "Discovery"
        ],
        "description": "Returns the same status and headers as the health check without transferring the JSON body.",
        "responses": {
          "200": {
            "description": "The public discovery surface is available."
          },
          "405": {
            "description": "The HTTP method is not supported.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getAgentInstructions",
        "summary": "Read concise agent instructions",
        "tags": [
          "Discovery"
        ],
        "description": "Returns Kirjapro use cases, safety boundaries, verified provider facts, and canonical first-party links as plain-text Markdown.",
        "responses": {
          "200": {
            "description": "The concise agent instruction document.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "# Kirjapro\n\n## When to use Kirjapro\n..."
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getDiscoveryOpenApiDocument",
        "summary": "Read this discovery contract",
        "tags": [
          "Discovery"
        ],
        "description": "Returns the OpenAPI 3.1 contract for Kirjapro public discovery endpoints. The listed operations require no customer credentials and expose no accounting data.",
        "responses": {
          "200": {
            "description": "The Kirjapro public discovery OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "An OpenAPI 3.1 document."
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "service",
          "scope"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ],
            "description": "Current availability state."
          },
          "service": {
            "type": "string",
            "const": "kirjapro.fi",
            "description": "Public service identifier."
          },
          "scope": {
            "type": "string",
            "const": "public-discovery",
            "description": "Confirms that this is not an authenticated accounting API."
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "description": "RFC 9457 Problem Details with stable Kirjapro resolution extensions.",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "resolution"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "URI identifying the problem type."
          },
          "title": {
            "type": "string",
            "description": "Short summary of the problem type."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599,
            "description": "HTTP status code."
          },
          "detail": {
            "type": "string",
            "description": "Human-readable detail for this occurrence."
          },
          "instance": {
            "type": "string",
            "description": "Request URI for this occurrence."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable Kirjapro error code."
          },
          "resolution": {
            "type": "string",
            "description": "Concrete next step for the caller."
          }
        },
        "example": {
          "type": "https://kirjapro.fi/problems/api-route-not-found",
          "title": "API route not found",
          "status": 404,
          "detail": "Pyydettyä julkista API-reittiä ei löytynyt.",
          "code": "API_ROUTE_NOT_FOUND",
          "resolution": "Tarkista sallitut discovery-päätepisteet osoitteesta /openapi.json.",
          "instance": "/api/example"
        }
      }
    }
  },
  "tags": [
    {
      "name": "Discovery",
      "description": "Anonymous product-discovery operations that never expose customer data."
    }
  ]
}