{
  "openapi": "3.1.1",
  "info": {
    "title": "Timeslice Timesheet Summary API",
    "version": "1.0.0",
    "summary": "Paste a timesheet: hours per project, task, tag or client, per day and week, billable sums.",
    "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://timeslicetimesheetsummary.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Paste a timesheet: hours per project, task, tag or client, per day and week, billable sums.",
        "description": "Totals a timesheet table (CSV from any time tracker or spreadsheet) by project, task, tag or client over a date range: hours per day and per ISO week, billable and non-billable time, amounts from hourly rates, optional rounding per entry, a stacked bar chart per day and a donut of the shares.\n\nMethodology:\n- Each row becomes one time entry: date + start + end (an end before the start means the entry runs past midnight), date + start + duration, or date + duration alone (such rows are placed one after another from 09:00 so they still add up per day).\n- Entries are cut at midnight and at the range limits, so a night shift counts on both days. Rounding (optional) applies to each entry piece, to the nearest step or always up.\n- Billable amount = rounded billable hours × the row’s rate (else the default rate). Group by tag counts an entry under each of its tags, so tag totals can add up to more than the total.\n- Weeks are ISO 8601 weeks (Monday to Sunday, week 1 contains the first Thursday of the year). Times are wall-clock times: a night with a daylight-saving change counts the clock difference.\n\nA calculation aid, not payroll or tax advice. Check rounding rules against your contract.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "timeslice_timesheet_summary",
        "x-owner-app": "timeslice",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimesliceTimesheetSummaryInput"
              },
              "examples": {
                "example1": {
                  "summary": "Freelance days for two clients",
                  "value": {
                    "entries": "date,start,end,project,client,task,tags,billable,rate,note\n2026-11-02,09:00,12:30,Brand refresh,Acme Bakery,Logo concepts,design,yes,85,Three directions\n2026-11-02,13:30,14:15,Brand refresh,Acme Bakery,Client call,meeting,yes,85,Kick-off\n2026-11-02,14:30,17:00,Shop website,Northwind Bikes,Wireframes,design,yes,70,\n2026-11-03,09:00,12:00,Shop website,Northwind Bikes,Wireframes,design,yes,70,Checkout flow\n2026-11-03,13:00,15:30,Shop website,Northwind Bikes,Product photos,photo,yes,70,\n2026-11-03,15:45,16:30,Studio admin,,Invoices,admin,no,,\n2026-11-04,08:30,11:45,Brand refresh,Acme Bakery,Packaging layout,design,yes,85,",
                    "groupBy": "project",
                    "currency": "EUR"
                  }
                },
                "example2": {
                  "summary": "Study log with durations, by tag",
                  "value": {
                    "entries": "date;duration;project;task;tags\n3.11.2026;1h30;Calculus;Lecture;lecture\n3.11.2026;2h;Calculus;Problem sets;exercise\n4.11.2026;90m;History;Reading;reading\n4.11.2026;2:15;Programming;Project work;exam\n5.11.2026;1.5;History;Essay;writing, exam",
                    "groupBy": "tag",
                    "currency": ""
                  }
                },
                "example3": {
                  "summary": "Billing in 15-minute steps, rounded up, by client",
                  "value": {
                    "entries": "date,start,end,client,task,billable,rate\n2026-11-09,09:07,10:52,Acme Bakery,Logo revisions,yes,85\n2026-11-09,11:03,11:21,Acme Bakery,Phone call,yes,85\n2026-11-09,13:12,15:40,Northwind Bikes,Banner set,yes,70\n2026-11-10,08:55,09:08,Northwind Bikes,Email,yes,70\n2026-11-10,09:10,12:47,Acme Bakery,Menu boards,yes,85",
                    "groupBy": "client",
                    "roundMinutes": "15",
                    "roundMode": "up",
                    "currency": "EUR"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimesliceTimesheetSummaryResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "TimesliceTimesheetSummaryInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "entries": {
            "title": "Timesheet table (CSV with a header row)",
            "description": "Columns (any order, comma, semicolon or tab): date, start, end or duration, project, client, task, tags, billable, rate, note. Durations like 1h30, 90m, 1:30 or 1.5 work too.",
            "type": "string",
            "maxLength": 400000,
            "default": "date,start,end,project,client,task,tags,billable,rate,note\n2026-11-02,09:00,12:30,Brand refresh,Acme Bakery,Logo concepts,design,yes,85,Three directions\n2026-11-02,13:30,14:15,Brand refresh,Acme Bakery,Client call,meeting,yes,85,Kick-off\n2026-11-02,14:30,17:00,Shop website,Northwind Bikes,Wireframes,design,yes,70,\n2026-11-03,09:00,12:00,Shop website,Northwind Bikes,Wireframes,design,yes,70,Checkout flow\n2026-11-03,13:00,15:30,Shop website,Northwind Bikes,Product photos,photo,yes,70,\n2026-11-03,15:45,16:30,Studio admin,,Invoices,admin,no,,\n2026-11-04,08:30,11:45,Brand refresh,Acme Bakery,Packaging layout,design,yes,85,"
          },
          "groupBy": {
            "title": "Group by",
            "type": "string",
            "enum": [
              "project",
              "task",
              "tag",
              "client"
            ],
            "default": "project"
          },
          "from": {
            "title": "From (YYYY-MM-DD, empty = first entry)",
            "type": "string",
            "maxLength": 10,
            "default": ""
          },
          "to": {
            "title": "To (YYYY-MM-DD, empty = last entry)",
            "type": "string",
            "maxLength": 10,
            "default": ""
          },
          "roundMinutes": {
            "title": "Round each entry to",
            "type": "string",
            "enum": [
              "0",
              "1",
              "5",
              "6",
              "10",
              "15",
              "30",
              "60"
            ],
            "default": "0"
          },
          "roundMode": {
            "title": "Rounding",
            "type": "string",
            "enum": [
              "nearest",
              "up"
            ],
            "default": "nearest"
          },
          "defaultRate": {
            "title": "Hourly rate for rows without one",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000,
            "default": 0
          },
          "currency": {
            "title": "Currency code (for example EUR, USD)",
            "type": "string",
            "maxLength": 3,
            "default": "EUR"
          },
          "dateOrder": {
            "title": "Dates like 03/11/2026 are",
            "type": "string",
            "enum": [
              "dmy",
              "mdy"
            ],
            "default": "dmy"
          },
          "billableByDefault": {
            "title": "Rows without a billable column are billable",
            "type": "boolean",
            "default": false
          }
        },
        "required": []
      },
      "TimesliceTimesheetSummaryResult": {
        "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"
              }
            }
          }
        }
      }
    }
  }
}