{
  "openapi": "3.1.0",
  "info": {
    "title": "OWNomics public API",
    "version": "1.0.0",
    "description": "Skrivebeskyttet tilgang til offentlig informasjon om OWNomics."
  },
  "servers": [
    {
      "url": "https://ownomics.com"
    }
  ],
  "paths": {
    "/api": {
      "get": {
        "operationId": "listPages",
        "summary": "List OWNomics pages",
        "description": "Returns page titles, descriptions, slugs and URLs.",
        "responses": {
          "200": {
            "description": "List of pages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "slug",
                          "title",
                          "description",
                          "url"
                        ],
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          }
                        }
                      }
                    },
                    "pageEndpoint": {
                      "type": "string"
                    },
                    "mcp": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/pages/{slug}": {
      "get": {
        "operationId": "getPage",
        "summary": "Read a public page",
        "description": "Returns the public text of a page using its slug. Use home for the homepage.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Slug returned by listPages",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page text",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "type": "object",
                      "required": [
                        "slug",
                        "title",
                        "description",
                        "url"
                      ],
                      "properties": {
                        "slug": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Page not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "resolution": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}