{
  "openapi": "3.1.0",
  "info": {
    "title": "Inke Content API",
    "version": "1.0.0",
    "description": "Free, no-authentication API to search, read and list Inke's published editorial content. No API key required.",
    "contact": {
      "name": "Inke",
      "email": "contact@inke.app",
      "url": "https://inke.app"
    }
  },
  "servers": [
    {
      "url": "https://inke.app",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchContent",
        "summary": "Full-text search across published content",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search text."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          }
        }
      }
    },
    "/api/content": {
      "get": {
        "operationId": "getContent",
        "summary": "Fetch one content item (markdown body)",
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Content slug (see /api/list)."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ]
            },
            "description": "md returns text/markdown."
          }
        ],
        "responses": {
          "200": {
            "description": "Content item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentItem"
                }
              },
              "text/markdown": {}
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/list": {
      "get": {
        "operationId": "listContent",
        "summary": "List all published content",
        "responses": {
          "200": {
            "description": "Content list",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContentItem": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "type": "string"
          },
          "excerpt": {
            "type": "string"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContentItem"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}