{
  "openapi": "3.1.0",
  "info": {
    "title": "karumi.ai public API for agents",
    "version": "1.0.0",
    "description": "Search karumi.ai in one request. Public, no sign-in, read-only. The JSON API is versioned in its path (/v1). A breaking change gets a new path, and the old path then answers with Deprecation and Sunset headers before it goes away. Errors are JSON objects with a machine-readable code and a message."
  },
  "servers": [
    {
      "url": "https://marketing.karumi.ai"
    },
    {
      "url": "https://karumi.ai"
    }
  ],
  "externalDocs": {
    "url": "https://karumi.ai/agent-tools.md"
  },
  "paths": {
    "/v1/search": {
      "get": {
        "operationId": "searchSiteJson",
        "summary": "Search karumi.ai (JSON)",
        "description": "Returns the karumi.ai pages that match the query, best first, as JSON, or every page when there is no query. Each result links to the page’s Markdown version. Page through results with limit and cursor. Each client may send 300 requests a minute; the RateLimit headers say how many are left.",
        "security": [],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Keywords or a question, for example \"pricing\" or \"HubSpot integration\". Leave it out to list every page.",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "example": "pricing"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Results per page, from 1 to 10.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 10
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The next_cursor of the previous page. Leave it out for the first page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of results",
            "headers": {
              "RateLimit-Limit": {
                "description": "Requests allowed per window",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in this window",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the window resets",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchPage"
                }
              }
            }
          },
          "400": {
            "description": "A limit or cursor out of range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests; retry after the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The index could not be read; retry after the Retry-After seconds",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SearchResult": {
        "type": "object",
        "required": [
          "title",
          "url",
          "description"
        ],
        "properties": {
          "title": {
            "type": "string",
            "description": "Page title"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The page’s Markdown version"
          },
          "description": {
            "type": "string",
            "description": "What the page is about"
          }
        }
      },
      "SearchPage": {
        "type": "object",
        "required": [
          "query",
          "total",
          "results",
          "next_cursor"
        ],
        "properties": {
          "query": {
            "type": "string",
            "description": "The query as searched"
          },
          "total": {
            "type": "integer",
            "description": "Number of matching pages"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as cursor to get the next page; null on the last page"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_limit",
                  "invalid_cursor",
                  "rate_limited",
                  "index_unavailable"
                ],
                "description": "Machine-readable error code"
              },
              "message": {
                "type": "string",
                "description": "What went wrong and how to fix it"
              }
            }
          }
        }
      }
    }
  }
}
