{
  "openapi": "3.1.0",
  "info": {
    "title": "Inclox API",
    "version": "1.0.0",
    "description": "Public REST API of Inclox (proof-of-work time tracking). One API key belongs to one workspace; every call works on that workspace only. Same operations as the MCP server at /mcp. Guide: https://inclox.com/developers/",
    "contact": {
      "email": "info@inclox.com"
    }
  },
  "servers": [
    {
      "url": "https://inclox.com/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Workspace"
    },
    {
      "name": "Time entries"
    },
    {
      "name": "To-dos"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Webhooks"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "operationId": "getMe",
        "summary": "Check a key: workspace, plan, scopes",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": null,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/workspace": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "operationId": "getWorkspace",
        "summary": "The workspace",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "workspace:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspace": {
                      "$ref": "#/components/schemas/Workspace"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/members": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "operationId": "listMembers",
        "summary": "List members",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "workspace:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Page size."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "description": "Rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/members/{id}": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "operationId": "getMember",
        "summary": "One member",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "workspace:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Member id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "member": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/presence": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "operationId": "getPresence",
        "summary": "Who is tracking right now",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "workspace:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "tracking_now": {
                      "type": "integer"
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Presence"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/time-entries": {
      "get": {
        "tags": [
          "Time entries"
        ],
        "operationId": "listTimeEntries",
        "summary": "List time entries (newest first)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "time:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "First calendar day (workspace time zone), inclusive."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Last calendar day, inclusive."
          },
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only this member."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            },
            "description": "Page size."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "description": "Rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "time_entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimeEntry"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "tags": [
          "Time entries"
        ],
        "operationId": "createTimeEntry",
        "summary": "Add a manual time entry",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "time:write",
        "description": "started_at + ended_at, or one of them + duration_seconds. 1 minute to 24 hours, not in the future, no overlap with existing time of the member. Shown as manual time in the dashboard; source \"api\" in the API.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "time_entry": {
                      "$ref": "#/components/schemas/TimeEntry"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/time-entries/{id}": {
      "get": {
        "tags": [
          "Time entries"
        ],
        "operationId": "getTimeEntry",
        "summary": "One time entry",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "time:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Time entry id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "time_entry": {
                      "$ref": "#/components/schemas/TimeEntry"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "patch": {
        "tags": [
          "Time entries"
        ],
        "operationId": "updateTimeEntry",
        "summary": "Change the note (any entry) or the times (manual entries only)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "time:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Time entry id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimeEntryUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "time_entry": {
                      "$ref": "#/components/schemas/TimeEntry"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "delete": {
        "tags": [
          "Time entries"
        ],
        "operationId": "deleteTimeEntry",
        "summary": "Delete a manual time entry (tracked entries: 409)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "time:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Time entry id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/todos": {
      "get": {
        "tags": [
          "To-dos"
        ],
        "operationId": "listTodos",
        "summary": "List to-dos (newest first)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "todos:read",
        "parameters": [
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Assignee."
          },
          {
            "name": "completed",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Done or open."
          },
          {
            "name": "top_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "true = to-dos only, false = steps only."
          },
          {
            "name": "parent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,17}$"
            },
            "description": "Steps of this to-do."
          },
          {
            "name": "due_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Due on or before this day."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Page size."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000,
              "default": 0
            },
            "description": "Rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "todos": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Todo"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "tags": [
          "To-dos"
        ],
        "operationId": "createTodo",
        "summary": "Create a to-do (member_id) or a step (parent_id)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "todos:write",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "todo": {
                      "$ref": "#/components/schemas/Todo"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/todos/{id}": {
      "get": {
        "tags": [
          "To-dos"
        ],
        "operationId": "getTodo",
        "summary": "One to-do with steps and attachment names",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "todos:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,17}$"
            },
            "description": "To-do id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "todo": {
                      "$ref": "#/components/schemas/TodoDetail"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "patch": {
        "tags": [
          "To-dos"
        ],
        "operationId": "updateTodo",
        "summary": "Change or complete a to-do",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "todos:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,17}$"
            },
            "description": "To-do id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "todo": {
                      "$ref": "#/components/schemas/Todo"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "delete": {
        "tags": [
          "To-dos"
        ],
        "operationId": "deleteTodo",
        "summary": "Delete a to-do and its steps (with attachments: 409)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "todos:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,17}$"
            },
            "description": "To-do id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/reports/time": {
      "get": {
        "tags": [
          "Reports"
        ],
        "operationId": "getTimeReport",
        "summary": "Hours per member / day",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "reports:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Default: 6 days before to."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Default: today (UTC). Max range 366 days."
          },
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only this member."
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "member",
                "day",
                "member_day"
              ],
              "default": "member"
            },
            "description": "Grouping."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            },
            "description": "csv returns text/csv."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeReport"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/exports/time-entries": {
      "get": {
        "tags": [
          "Reports"
        ],
        "operationId": "exportTimeEntries",
        "summary": "All time entries of a range (CSV or JSON, oldest first)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "reports:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Default: 30 days before to."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-03"
            },
            "description": "Default: today (UTC). Max range 366 days."
          },
          {
            "name": "member_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only this member."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json"
              ],
              "default": "csv"
            },
            "description": "Output format."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhooks",
        "summary": "List webhook endpoints (without secrets)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "webhooks:write",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "createWebhook",
        "summary": "Add a webhook endpoint (secret shown once)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoint": {
                      "$ref": "#/components/schemas/WebhookEndpoint"
                    },
                    "secret": {
                      "type": "string",
                      "example": "whsec_…"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "deleteWebhook",
        "summary": "Delete a webhook endpoint and its delivery log",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Endpoint id"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Optional. Repeating a write with the same key within 24 h returns the first response (header Idempotent-Replayed: true) instead of running it again. Same key with a different request → 422."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An Inclox API key (icx_live_…) from Settings → API & integrations."
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request (invalid_json, invalid_body, invalid_range, invalid_date, invalid_limit, invalid_idempotency_key, …)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E401": {
        "description": "unauthorized (no key) or invalid_api_key (unknown or revoked)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E402": {
        "description": "plan_required — the workspace plan does not include API access",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "insufficient_scope — see required_scope",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E404": {
        "description": "not_found — also for ids of other workspaces",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E409": {
        "description": "overlaps_existing, tracked_entry_immutable, has_attachments, endpoint_limit, idempotency_in_progress",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E413": {
        "description": "payload_too_large (64 KB) or export_too_large",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "member_not_found, parent_not_found, member_cannot_track, idempotency_key_reused",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "rate_limited — wait Retry-After seconds",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "required_scope": {
            "type": "string"
          },
          "conflicting_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "id": {
            "type": [
              "string",
              "integer"
            ]
          }
        }
      },
      "Me": {
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string"
          },
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "plan": {
            "type": "string",
            "enum": [
              "team",
              "business"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "docs": {
            "type": "string"
          }
        }
      },
      "Workspace": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "example": "Europe/Berlin"
          },
          "daily_goal_hours": {
            "type": "number"
          },
          "seat_limit": {
            "type": "integer"
          },
          "seats_used": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Member": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "manager",
              "client",
              "employee"
            ]
          },
          "department": {
            "type": [
              "string",
              "null"
            ]
          },
          "team": {
            "type": [
              "string",
              "null"
            ]
          },
          "job_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "daily_goal_hours": {
            "type": [
              "number",
              "null"
            ]
          },
          "joined": {
            "type": "boolean",
            "description": "Accepted the invite (has a login)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Presence": {
        "type": "object",
        "properties": {
          "member_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "tracking": {
            "type": "boolean"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "current_session_seconds": {
            "type": "integer"
          },
          "activity_score": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "TimeEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "member_id": {
            "type": "string",
            "format": "uuid"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Calendar day in the workspace time zone."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_seconds": {
            "type": "integer"
          },
          "activity_score": {
            "type": [
              "integer",
              "null"
            ],
            "description": "0–100; null for manual and mobile time."
          },
          "source": {
            "type": "string",
            "enum": [
              "tracker",
              "mobile",
              "manual",
              "api"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TimeEntryCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "member_id"
        ],
        "properties": {
          "member_id": {
            "type": "string",
            "format": "uuid"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          }
        }
      },
      "TimeEntryUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Todo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "member_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "completed": {
            "type": "boolean"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_by_member_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "subtask_count": {
            "type": "integer"
          },
          "attachment_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TodoDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Todo"
          },
          {
            "type": "object",
            "properties": {
              "subtasks": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Todo"
                }
              },
              "attachments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "file_name": {
                      "type": "string"
                    },
                    "mime_type": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "size_bytes": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "TodoCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 20000
          },
          "member_id": {
            "type": "string",
            "format": "uuid",
            "description": "Assignee (for a to-do)."
          },
          "parent_id": {
            "type": [
              "string",
              "integer"
            ],
            "description": "Parent to-do (for a step; the step belongs to the parent's member)."
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "completed": {
            "type": "boolean"
          }
        }
      },
      "TodoUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 20000
          },
          "member_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reassign (top-level to-dos only; steps follow)."
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "completed": {
            "type": "boolean"
          }
        }
      },
      "TimeReport": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "example": "2026-11-03"
          },
          "to": {
            "type": "string",
            "format": "date",
            "example": "2026-11-03"
          },
          "timezone": {
            "type": "string"
          },
          "group_by": {
            "type": "string"
          },
          "total_seconds": {
            "type": "integer"
          },
          "total_hours": {
            "type": "number"
          },
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "member_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "seconds": {
                  "type": "integer"
                },
                "hours": {
                  "type": "number"
                },
                "manual_seconds": {
                  "type": "integer"
                },
                "entries": {
                  "type": "integer"
                },
                "avg_activity": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          },
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date",
                  "example": "2026-11-03"
                },
                "seconds": {
                  "type": "integer"
                },
                "hours": {
                  "type": "number"
                }
              }
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "https:// on port 443, public host name."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "time_entry.created",
                "time_entry.updated",
                "time_entry.deleted",
                "todo.created",
                "todo.updated",
                "todo.completed",
                "todo.deleted"
              ]
            }
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        }
      }
    }
  }
}
