{
  "openapi": "3.1.0",
  "info": {
    "title": "CommitCrab public meme API",
    "version": "1.0.0",
    "description": "Small original CC0 developer meme library. Keyword matching; no generative model."
  },
  "servers": [
    {
      "url": "https://commitcrab.pages.dev"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchMemes",
        "summary": "Search original programmer memes",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "topic",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 18
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search query, total, and items with title, image URL, page URL, alt text, Markdown, and license."
          }
        }
      }
    },
    "/api/memes/{id}": {
      "get": {
        "operationId": "getMeme",
        "summary": "Get one meme",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Meme metadata."
          },
          "404": {
            "description": "Meme not found."
          }
        }
      }
    },
    "/api/match": {
      "post": {
        "operationId": "matchArticle",
        "summary": "Match memes to prose using deterministic keywords",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 30,
                    "maxLength": 20000
                  },
                  "max_matches": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5,
                    "default": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Method, explained matches, and article Markdown."
          },
          "400": {
            "description": "Invalid JSON or text."
          },
          "413": {
            "description": "Body exceeds 64 KiB."
          },
          "415": {
            "description": "Use application/json."
          }
        }
      }
    }
  }
}