{
  "openapi": "3.1.0",
  "info": {
    "title": "PlainlyKit Date API",
    "version": "1.0.0",
    "description": "Free, public calendar arithmetic from PlainlyKit. Add a whole number of weeks to a date. No API key or account is required. Dates use the Gregorian calendar and UTC date-only arithmetic.",
    "contact": { "name": "PlainlyKit", "url": "https://plainlykit.com/about", "email": "sofia@plainlykit.com" }
  },
  "servers": [{ "url": "https://plainlykit.com" }],
  "externalDocs": { "description": "API documentation and examples", "url": "https://plainlykit.com/developers" },
  "paths": {
    "/api/v1/weeks-from-date": {
      "get": {
        "operationId": "addWeeksToDate",
        "summary": "Add weeks to a calendar date",
        "description": "Returns the resulting date, weekday, and elapsed days. Both parameters are required. Unknown and repeated query parameters are rejected. The result must be before year 10000.",
        "tags": ["Dates"],
        "parameters": [
          { "name": "start", "in": "query", "required": true, "description": "A valid date from 0001-01-01 to 9999-12-31.", "schema": { "type": "string", "format": "date", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" }, "example": "2026-10-18" },
          { "name": "weeks", "in": "query", "required": true, "description": "A nonnegative whole number, written without leading zeros.", "schema": { "type": "integer", "minimum": 0, "maximum": 5200 }, "example": 6 }
        ],
        "responses": {
          "200": {
            "description": "Calculated calendar date. Public responses can be cached for one day. Cross-origin GET requests are supported.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DateResult" }, "example": { "start": "2026-10-18", "weeks": 6, "days": 42, "date": "2026-11-29", "weekday": "Sunday" } } }
          },
          "400": {
            "description": "Missing, invalid, repeated or unsupported parameters, or a result beyond year 9999.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": { "error": "Choose a valid date." } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DateResult": {
        "type": "object",
        "required": ["start", "weeks", "days", "date", "weekday"],
        "properties": {
          "start": { "type": "string", "format": "date" },
          "weeks": { "type": "integer", "minimum": 0, "maximum": 5200 },
          "days": { "type": "integer", "minimum": 0, "maximum": 36400 },
          "date": { "type": "string", "format": "date" },
          "weekday": { "type": "string", "enum": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] }
        },
        "additionalProperties": false
      },
      "Error": { "type": "object", "required": ["error"], "properties": { "error": { "type": "string" } }, "additionalProperties": false }
    }
  }
}
