{
  "openapi": "3.1.1",
  "info": {
    "title": "Dayweave Time-Block Scheduler API",
    "version": "1.0.0",
    "summary": "Fit your tasks into the free time around your meetings: deadline first, split into blocks.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://dayweavetimeblockscheduler.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Fit your tasks into the free time around your meetings: deadline first, split into blocks.",
        "description": "Give your working hours, the appointments you already have and a list of tasks with estimates, due dates and priorities: the scheduler places the tasks as time blocks into your free working time, earliest deadline first, optionally split into chunks of a minimum length with a buffer around meetings, and says what does not fit or ends after its due date.\n\nMethodology:\n- Free time = working hours on working days minus existing appointments (each widened by the buffer), in your time zone, from the first day (and the “not before” time) on.\n- Order: earliest due date first (tasks without a due date last), then priority (high first), then the longer task, then input order. The order is fixed, so the same input always gives the same plan.\n- Each task takes the earliest free gaps. With splitting, a task fills gaps of at least the minimum block length until its estimate is used up; without splitting it waits for the first gap long enough for the whole task. Blocks start on the chosen grid.\n- A block that ends after the due day is marked late; with “also plan after the due date” switched off such blocks are not placed and the task is listed as not scheduled.\n- This is a greedy earliest-deadline-first plan, not an optimum: it never moves existing appointments and does not reorder already placed tasks.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "dayweave_time_block_scheduler",
        "x-owner-app": "dayweave",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DayweaveTimeBlockSchedulerInput"
              },
              "examples": {
                "example1": {
                  "summary": "A week of tasks around stand-ups and meetings",
                  "value": {
                    "tasks": "Write migration guide, 2h, 2026-12-09, high\nAccessibility fixes, 3h, 2026-12-10, high\nUpdate dependencies, 1h30, -, normal\nCustomer interview notes, 45m, 2026-12-08, normal\nExpense report, 30m, 2026-12-11, low",
                    "busy": "2026-12-07, 09:30, 09:45, Stand-up\n2026-12-07, 10:00, 11:30, Sprint planning\n2026-12-08, 09:30, 09:45, Stand-up\n2026-12-08, 13:00, 15:00, Workshop\n2026-12-09, 09:30, 09:45, Stand-up\n2026-12-09, 14:00, 15:00, Design review",
                    "from": "2026-12-07"
                  }
                },
                "example2": {
                  "summary": "No splitting, 10-minute buffer, half-hour grid",
                  "value": {
                    "tasks": "Write migration guide, 2h, 2026-12-09, high\nAccessibility fixes, 3h, 2026-12-10, high\nUpdate dependencies, 1h30, -, normal\nCustomer interview notes, 45m, 2026-12-08, normal\nExpense report, 30m, 2026-12-11, low",
                    "busy": "2026-12-07, 09:30, 09:45, Stand-up\n2026-12-07, 10:00, 11:30, Sprint planning\n2026-12-08, 09:30, 09:45, Stand-up\n2026-12-08, 13:00, 15:00, Workshop\n2026-12-09, 09:30, 09:45, Stand-up\n2026-12-09, 14:00, 15:00, Design review",
                    "from": "2026-12-07",
                    "minChunkMinutes": 0,
                    "bufferMinutes": 10,
                    "slotMinutes": "30"
                  }
                },
                "example3": {
                  "summary": "Too much for two days",
                  "value": {
                    "tasks": "Report, 8h, 2026-12-08, high\nSlides, 4h, 2026-12-08, normal\nReview, 3h, -, low",
                    "busy": "2026-12-07, 12:00, 13:00, Lunch\n2026-12-08, 12:00, 13:00, Lunch",
                    "from": "2026-12-07",
                    "daysAhead": 2,
                    "allowAfterDue": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DayweaveTimeBlockSchedulerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "DayweaveTimeBlockSchedulerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "tasks": {
            "title": "Tasks (one per line: title, estimate, due date or -, priority)",
            "description": "Estimates like 2h, 1h30, 45m. Priority high, normal or low. Tasks are placed by due date, then priority, then longest first.",
            "type": "string",
            "maxLength": 60000,
            "default": "Write migration guide, 2h, 2026-12-09, high\nAccessibility fixes, 3h, 2026-12-10, high\nUpdate dependencies, 1h30, -, normal\nCustomer interview notes, 45m, 2026-12-08, normal\nExpense report, 30m, 2026-12-11, low"
          },
          "busy": {
            "title": "Existing appointments (one per line: date, start, end or duration, title)",
            "type": "string",
            "maxLength": 200000,
            "default": "2026-12-07, 09:30, 09:45, Stand-up\n2026-12-07, 10:00, 11:30, Sprint planning\n2026-12-08, 09:30, 09:45, Stand-up\n2026-12-08, 13:00, 15:00, Workshop\n2026-12-09, 09:30, 09:45, Stand-up\n2026-12-09, 14:00, 15:00, Design review"
          },
          "from": {
            "title": "Plan from (YYYY-MM-DD)",
            "type": "string",
            "maxLength": 10,
            "default": "2026-12-07"
          },
          "daysAhead": {
            "title": "Days to plan",
            "type": "number",
            "minimum": 1,
            "maximum": 62,
            "default": 5
          },
          "days": {
            "title": "Working days",
            "type": "string",
            "maxLength": 40,
            "default": "Mon-Fri"
          },
          "hours": {
            "title": "Working hours",
            "type": "string",
            "maxLength": 20,
            "default": "09:00-17:00"
          },
          "timeZone": {
            "title": "Time zone",
            "type": "string",
            "maxLength": 64,
            "default": "Europe/Berlin"
          },
          "minChunkMinutes": {
            "title": "Split tasks into blocks of at least (minutes, 0 = never split)",
            "type": "number",
            "minimum": 0,
            "maximum": 480,
            "default": 30
          },
          "bufferMinutes": {
            "title": "Buffer around appointments (minutes)",
            "type": "number",
            "minimum": 0,
            "maximum": 120,
            "default": 0
          },
          "slotMinutes": {
            "title": "Blocks start on a grid of",
            "type": "string",
            "enum": [
              "5",
              "15",
              "30",
              "60"
            ],
            "default": "15"
          },
          "allowAfterDue": {
            "title": "Also plan blocks after the due date (marked late)",
            "type": "boolean",
            "default": true
          },
          "notBefore": {
            "title": "Not before (HH:MM on the first day, optional)",
            "type": "string",
            "maxLength": 5,
            "default": ""
          }
        },
        "required": []
      },
      "DayweaveTimeBlockSchedulerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object"
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}