{
  "openapi": "3.1.0",
  "info": {
    "title": "Kanthoruwa Public API",
    "version": "1.0.0",
    "summary": "Public, read-only job data for Sri Lanka.",
    "description": "Read-only job-board endpoints used by the Kanthoruwa website, the MCP server and AI agents. No authentication is required. Versioning: this is version 1 of the API. Breaking changes ship only as a new major version, selected with the `Kanthoruwa-Version` request header; omitting the header means version 1. A deprecated endpoint or version returns `Deprecation` (RFC 9745) and `Sunset` (RFC 8594) response headers at least 90 days before removal. Errors use the `Error` schema with a machine-readable `code`. Anonymous web clients are limited to 120 requests per minute per IP; AI agents (/mcp, /a2a, and Bearer-authenticated agent requests) are limited to 20 requests per minute and 60 requests per hour per IP (429 with Retry-After when exceeded). Link each listing to its `url` (the Kanthoruwa job page). For higher limits or commercial use, contact support@kanthoruwa.com.",
    "contact": {
      "name": "Kanthoruwa",
      "url": "https://kanthoruwa.com/about"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://kanthoruwa.com/terms"
    }
  },
  "externalDocs": {
    "description": "Kanthoruwa API documentation",
    "url": "https://kanthoruwa.com/docs"
  },
  "servers": [
    {
      "url": "https://api.kanthoruwa.com",
      "description": "Production API"
    }
  ],
  "tags": [
    {
      "name": "Jobs",
      "description": "Active vacancies"
    },
    {
      "name": "Categories",
      "description": "Job categories and subcategories"
    },
    {
      "name": "Locations",
      "description": "Sri Lankan districts and cities"
    },
    {
      "name": "Companies",
      "description": "Public employer profiles"
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol endpoint"
    }
  ],
  "paths": {
    "/api/vacancies": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "operationId": "listVacancies",
        "summary": "List active job vacancies",
        "description": "Public job board. Returns 20 results per page, newest and featured first.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Keyword matched against the job title.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cityId",
            "in": "query",
            "required": false,
            "description": "A single city id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cityIds",
            "in": "query",
            "required": false,
            "description": "Comma-separated city ids (used for major-city hubs).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "districtId",
            "in": "query",
            "required": false,
            "description": "A district id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "description": "A category id from /api/categories.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subcategoryId",
            "in": "query",
            "required": false,
            "description": "A subcategory id from /api/categories.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "remote",
                "hybrid",
                "onsite"
              ]
            }
          },
          {
            "name": "jobType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "full-time",
                "part-time",
                "contract",
                "internship"
              ]
            }
          },
          {
            "name": "experienceLevel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "entry",
                "mid",
                "senior",
                "executive"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of active vacancies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "vacancies",
                    "page"
                  ],
                  "properties": {
                    "page": {
                      "type": "integer"
                    },
                    "vacancies": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VacancySummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/vacancies/{slug}": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "operationId": "getVacancy",
        "summary": "Get one vacancy",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The vacancy, including its full description.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vacancy"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/categories": {
      "get": {
        "tags": [
          "Categories"
        ],
        "operationId": "listCategories",
        "summary": "List job categories and subcategories",
        "responses": {
          "200": {
            "description": "Active categories with nested subcategories.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Category"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ]
      }
    },
    "/api/companies": {
      "get": {
        "tags": [
          "Companies"
        ],
        "operationId": "listCompanies",
        "summary": "List companies with active vacancies",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of public company profiles.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer"
                    },
                    "companies": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Company"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/locations/major-cities": {
      "get": {
        "tags": [
          "Locations"
        ],
        "operationId": "listMajorCities",
        "summary": "List major-city search hubs",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          },
          {
            "name": "slug",
            "in": "query",
            "required": false,
            "description": "Return one hub with its city ids.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Filter hubs by name.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Major cities or city hubs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/locations/districts": {
      "get": {
        "tags": [
          "Locations"
        ],
        "operationId": "listDistricts",
        "summary": "List Sri Lankan districts",
        "responses": {
          "200": {
            "description": "Districts sorted by English name.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "nameEn": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ]
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "operationId": "mcp",
        "summary": "MCP Streamable HTTP endpoint",
        "description": "Stateless Model Context Protocol endpoint. Tools: `search`, `fetch`, `list_categories`. Send JSON-RPC 2.0 requests with `Content-Type: application/json` and `Accept: application/json, text/event-stream`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "const": "2.0"
                  },
                  "id": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiVersion"
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "ApiVersion": {
        "name": "Kanthoruwa-Version",
        "in": "header",
        "required": false,
        "description": "API major version. Omit for the current version (1).",
        "schema": {
          "type": "string",
          "enum": [
            "1"
          ],
          "default": "1"
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Resource or route not found (code `not_found`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded (code `rate_limited`). Retry after the `Retry-After` header.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        }
      },
      "InternalError": {
        "description": "Unexpected server error (code `internal_error`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Error body returned for every 4xx and 5xx response.",
        "required": [
          "error",
          "code",
          "message",
          "status"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message (same as `message`)."
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code.",
            "examples": [
              "not_found",
              "rate_limited",
              "unauthorized",
              "forbidden",
              "http_error",
              "internal_error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable message."
          },
          "hint": {
            "type": "string",
            "description": "How to fix the request."
          },
          "status": {
            "type": "integer",
            "description": "HTTP status code."
          },
          "docs": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "VacancySummary": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "employerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "cityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "workType": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobType": {
            "type": [
              "string",
              "null"
            ]
          },
          "experienceLevel": {
            "type": [
              "string",
              "null"
            ]
          },
          "salaryMin": {
            "type": [
              "integer",
              "null"
            ]
          },
          "salaryMax": {
            "type": [
              "integer",
              "null"
            ]
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Vacancy": {
        "allOf": [
          {
            "$ref": "#/components/schemas/VacancySummary"
          },
          {
            "type": "object",
            "properties": {
              "description": {
                "type": "string"
              },
              "skills": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "applyType": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "organization": {
                "$ref": "#/components/schemas/Company"
              }
            }
          }
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "emoji": {
            "type": [
              "string",
              "null"
            ]
          },
          "subcategories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Company": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "logo": {
            "type": [
              "string",
              "null"
            ]
          },
          "activeVacancies": {
            "type": "integer"
          }
        }
      }
    }
  }
}
