{
    "openapi": "3.1.0",
    "info": {
        "title": "Mawerix public API",
        "version": "1.0.0",
        "summary": "Read-only access to the public content on mawerix.se.",
        "description": "Läs sajten mawerix.se: sidor som Markdown, sökning och kontaktuppgifter. Endast läsning, ingen autentisering. Max 60 anrop/minut per IP enligt RateLimit-headers. Samma verktyg finns som MCP-server på https://mawerix.se/mcp. Fel returneras som JSON med code, message och data.hint.",
        "contact": {
            "name": "Mawerix AB",
            "email": "kontakt@mawerix.se",
            "url": "https://mawerix.se/kontakt/"
        }
    },
    "servers": [
        {
            "url": "https://mawerix.se/wp-json/mawerix-public/v1"
        }
    ],
    "externalDocs": {
        "url": "https://mawerix.se/api",
        "description": "API-dokumentation"
    },
    "security": [],
    "paths": {
        "/pages": {
            "get": {
                "operationId": "listPages",
                "summary": "Lista alla publika sidor",
                "description": "Returnerar alla publika sidor på mawerix.se med titel, adress, Markdown-adress och beskrivning.",
                "responses": {
                    "200": {
                        "description": "Sidor",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "pages": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "title": {
                                                        "type": "string"
                                                    },
                                                    "url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "markdown_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "För många anrop. Se Retry-After.",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            },
                            "Retry-After": {
                                "schema": {
                                    "type": "integer"
                                },
                                "description": "Sekunder att vänta."
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/search": {
            "get": {
                "operationId": "searchSite",
                "summary": "Sök på sajten",
                "description": "Sök i sajtens innehåll (svenska). Returnerar upp till fem sidor med utdrag, bäst träff först.",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "description": "Sökord, t.ex. \"Business Central\" eller \"PIM\".",
                        "schema": {
                            "type": "string",
                            "maxLength": 200
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sökträffar",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "query": {
                                            "type": "string"
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "title": {
                                                        "type": "string"
                                                    },
                                                    "url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "markdown_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "score": {
                                                        "type": "integer"
                                                    },
                                                    "snippet": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "q saknas",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "För många anrop. Se Retry-After.",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            },
                            "Retry-After": {
                                "schema": {
                                    "type": "integer"
                                },
                                "description": "Sekunder att vänta."
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/page": {
            "get": {
                "operationId": "getPage",
                "summary": "Hämta en sida som Markdown",
                "description": "Hämtar en publik sida som Markdown. Ange sökväg eller fullständig adress på mawerix.se. Tom sökväg ger startsidan.",
                "parameters": [
                    {
                        "name": "path",
                        "in": "query",
                        "required": false,
                        "description": "Sökväg, t.ex. \"/tjanster/\", eller adress på mawerix.se.",
                        "schema": {
                            "type": "string",
                            "default": "/",
                            "maxLength": 300
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sidan som Markdown",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "path": {
                                            "type": "string"
                                        },
                                        "markdown": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Adressen ligger inte på mawerix.se",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Sidan finns inte",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "För många anrop. Se Retry-After.",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            },
                            "Retry-After": {
                                "schema": {
                                    "type": "integer"
                                },
                                "description": "Sekunder att vänta."
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/contact": {
            "get": {
                "operationId": "getContactInfo",
                "summary": "Hämta kontaktuppgifter",
                "description": "Mawerix kontaktuppgifter och hur man bäst tar kontakt. Skicka aldrig något åt användaren utan deras godkännande.",
                "responses": {
                    "200": {
                        "description": "Kontaktuppgifter",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "company": {
                                            "type": "string"
                                        },
                                        "org_number": {
                                            "type": "string"
                                        },
                                        "address": {
                                            "type": "string"
                                        },
                                        "email": {
                                            "type": "string",
                                            "format": "email"
                                        },
                                        "contact_form": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "note": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "För många anrop. Se Retry-After.",
                        "headers": {
                            "RateLimit-Limit": {
                                "$ref": "#/components/headers/RateLimit-Limit"
                            },
                            "RateLimit-Remaining": {
                                "$ref": "#/components/headers/RateLimit-Remaining"
                            },
                            "RateLimit-Reset": {
                                "$ref": "#/components/headers/RateLimit-Reset"
                            },
                            "Retry-After": {
                                "schema": {
                                    "type": "integer"
                                },
                                "description": "Sekunder att vänta."
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "code",
                    "message"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Maskinläsbar felkod"
                    },
                    "message": {
                        "type": "string"
                    },
                    "data": {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "integer"
                            },
                            "hint": {
                                "type": "string",
                                "description": "Hur felet löses"
                            }
                        }
                    }
                }
            }
        },
        "headers": {
            "RateLimit-Limit": {
                "description": "Anrop per minut",
                "schema": {
                    "type": "integer"
                }
            },
            "RateLimit-Remaining": {
                "description": "Anrop kvar i fönstret",
                "schema": {
                    "type": "integer"
                }
            },
            "RateLimit-Reset": {
                "description": "Sekunder tills fönstret nollställs",
                "schema": {
                    "type": "integer"
                }
            }
        }
    }
}