{
  "openapi": "3.1.0",
  "components": {
    "schemas": {
      "AccountDeletionRequest": {
        "type": "object",
        "properties": {
          "appleAuthorizationCode": {
            "type": "string",
            "description": "The authorization code Apple's sign-in sheet issued to the app when the person signed in with Apple once more, to confirm. The backend exchanges it for Apple's tokens and revokes them at once; it keeps nothing.",
            "maxLength": 4096
          }
        }
      },
      "AccountDeletionConfirmation": {
        "type": "object",
        "required": [
          "appleSignInUrl"
        ],
        "properties": {
          "appleSignInUrl": {
            "type": "string",
            "description": "Apple's sign-in, for the browser to go to: once the same Apple ID has signed in, the callback deletes the account, revokes TaskFest at Apple and sends the browser back signed out."
          }
        }
      },
      "AnnounceRequest": {
        "type": "object",
        "required": [
          "fileName",
          "contentType",
          "sizeBytes"
        ],
        "properties": {
          "fileName": {
            "type": "string",
            "examples": [
              "Rechnung.pdf"
            ],
            "pattern": "\\S",
            "maxLength": 1024
          },
          "contentType": {
            "type": "string",
            "examples": [
              "application/pdf"
            ],
            "maxLength": 255
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64",
            "examples": [
              48213
            ],
            "minimum": 1
          },
          "thumbnailSizeBytes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "examples": [
              6120
            ]
          }
        }
      },
      "AppSessionResponse": {
        "type": "object",
        "required": [
          "token",
          "expiresAt"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "The app session token, sent as `Authorization: Bearer <token>` on every later request. `taskfest_app_` and 43 characters of base64url, with no dot, so it is never mistaken for an ID token, which is a JWT of three dot-separated parts.",
            "pattern": "^taskfest_app_[A-Za-z0-9_-]{43}$",
            "examples": [
              "taskfest_app_q8Jx2mJ0bZ8tQ1n4Yc7d5v3s6K9wF2hL0aR1uE4oP7i"
            ],
            "maxLength": 56
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Instant"
          }
        }
      },
      "AttachmentResponse": {
        "type": "object",
        "required": [
          "id",
          "fileName",
          "contentType",
          "sizeBytes",
          "thumbnail"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "examples": [
              7
            ]
          },
          "fileName": {
            "type": "string",
            "examples": [
              "Rechnung.pdf"
            ],
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "examples": [
              "application/pdf"
            ],
            "maxLength": 255
          },
          "sizeBytes": {
            "type": "integer",
            "format": "int64",
            "examples": [
              48213
            ]
          },
          "thumbnail": {
            "type": "boolean",
            "examples": [
              false
            ]
          },
          "url": {
            "type": "string",
            "examples": [
              "https://example.com/articles/42"
            ],
            "maxLength": 2048
          }
        }
      },
      "AuthProviderResponse": {
        "required": [
          "id",
          "label",
          "available",
          "loginUrl",
          "issuer"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "google"
            ],
            "maxLength": 64
          },
          "label": {
            "type": "string",
            "examples": [
              "Google"
            ],
            "maxLength": 100
          },
          "available": {
            "type": "boolean"
          },
          "loginUrl": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "/api/auth/login"
            ],
            "maxLength": 2048
          },
          "issuer": {
            "type": "string",
            "examples": [
              "https://accounts.google.com"
            ],
            "maxLength": 2048
          }
        }
      },
      "AuthProvidersResponse": {
        "required": [
          "enabled",
          "providers"
        ],
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuthProviderResponse"
            }
          }
        }
      },
      "CurrentUserResponse": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "examples": [
              "person@example.com"
            ],
            "maxLength": 254
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "Person Example"
            ],
            "maxLength": 255
          },
          "pictureUrl": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "https://example.com/avatar.jpg"
            ],
            "maxLength": 2048
          }
        }
      },
      "DeviceRegistration": {
        "type": "object",
        "description": "The phone an app runs on, as it registers itself for push notifications (#277).",
        "additionalProperties": false,
        "required": [
          "platform",
          "token",
          "language"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "description": "Which push service reaches the device: Apple's (APNs) for `IOS`, Firebase Cloud Messaging for `ANDROID`.",
            "examples": [
              "IOS"
            ],
            "enum": [
              "IOS",
              "ANDROID"
            ]
          },
          "token": {
            "type": "string",
            "description": "The device's push token: the APNs device token in hex, or the FCM registration token, of one character at least. A new one replaces the one registered before.",
            "examples": [
              "9f2c4a7e1b3d5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8"
            ],
            "pattern": "^[A-Za-z0-9:_-]+$",
            "maxLength": 4096
          },
          "language": {
            "type": "string",
            "description": "The language the device's push notifications are written in: the app's own.",
            "examples": [
              "de"
            ],
            "enum": [
              "de",
              "en"
            ]
          }
        }
      },
      "DraftResponse": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "examples": [
              42
            ]
          }
        }
      },
      "Instant": {
        "type": "string",
        "format": "date-time",
        "examples": [
          "2022-03-10T16:15:50Z"
        ]
      },
      "LinkRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "examples": [
              "https://example.com/articles/42"
            ],
            "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://[^\\s/?#:]+(:[0-9]{1,5})?([/?#][^\\s]*)?$",
            "maxLength": 2048
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "An article worth reading"
            ],
            "maxLength": 1024
          }
        }
      },
      "LinkResponse": {
        "type": "object",
        "required": [
          "url",
          "expiresAt"
        ],
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 4096
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Instant"
          }
        }
      },
      "LocalDate": {
        "type": "string",
        "format": "date"
      },
      "RefusalResponse": {
        "type": "object",
        "required": [
          "refusal"
        ],
        "properties": {
          "refusal": {
            "type": "string",
            "examples": [
              "TASK_FULL"
            ],
            "enum": [
              "UNSUPPORTED_TYPE",
              "EMPTY",
              "TOO_LARGE",
              "TASK_FULL",
              "USER_FULL",
              "MISMATCH"
            ]
          }
        }
      },
      "TaskCreateRequest": {
        "type": "object",
        "required": [
          "description",
          "dueDate",
          "importance",
          "state"
        ],
        "properties": {
          "description": {
            "type": "string",
            "examples": [
              "Renew the passport"
            ],
            "pattern": "\\S",
            "maxLength": 255
          },
          "dueDate": {
            "type": "string",
            "examples": [
              "2026-11-30"
            ],
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueTime": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
            "description": "The time of day it is due at, to the minute (#474); none, or null, for a task due all day. Floating without a timeZone.",
            "examples": [
              "10:00"
            ]
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The IANA zone dueTime is meant in (#474), one the backend knows; only with a dueTime. None, or null, for a floating time, which follows the reader's clock.",
            "examples": [
              "Europe/Berlin"
            ],
            "maxLength": 64
          },
          "importance": {
            "type": "string",
            "examples": [
              "HIGH"
            ],
            "$ref": "#/components/schemas/TaskImportance"
          },
          "state": {
            "type": "string",
            "examples": [
              "TODO"
            ],
            "$ref": "#/components/schemas/TaskState"
          },
          "attachmentIds": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Attachments of a task deleted moments ago, for an undo to bring back (#204); only the caller's, only within the undo window.",
            "maxItems": 10
          }
        }
      },
      "TaskImportance": {
        "type": "string",
        "enum": [
          "LOW",
          "MEDIUM",
          "HIGH"
        ]
      },
      "TaskResponse": {
        "type": "object",
        "required": [
          "id",
          "description",
          "dueDate",
          "importance",
          "state"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "examples": [
              42
            ]
          },
          "description": {
            "type": "string",
            "examples": [
              "Renew the passport"
            ],
            "maxLength": 255
          },
          "dueDate": {
            "type": "string",
            "examples": [
              "2026-11-30"
            ],
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueTime": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
            "description": "The time of day it is due at, to the minute (#474); none, or null, for a task due all day. Floating without a timeZone.",
            "examples": [
              "10:00"
            ]
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The IANA zone dueTime is meant in (#474), one the backend knows; only with a dueTime. None, or null, for a floating time, which follows the reader's clock.",
            "examples": [
              "Europe/Berlin"
            ],
            "maxLength": 64
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The moment a task with a timeZone is due at (#474), worked out on every read: a time in a daylight-saving gap moves later, one in an overlap is its earlier moment. Null for an all-day or floating task.",
            "format": "date-time",
            "examples": [
              "2026-11-30T09:00:00Z"
            ]
          },
          "importance": {
            "type": "string",
            "examples": [
              "HIGH"
            ],
            "$ref": "#/components/schemas/TaskImportance"
          },
          "state": {
            "type": "string",
            "examples": [
              "TODO"
            ],
            "$ref": "#/components/schemas/TaskState"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachmentResponse"
            },
            "description": "Its available attachments (#204). Always sent; optional in the schema so the board still validates a task from a backend rolled back to before attachments."
          }
        }
      },
      "TaskState": {
        "type": "string",
        "enum": [
          "TODO",
          "WORKING",
          "DONE"
        ]
      },
      "TaskUpdateRequest": {
        "type": "object",
        "required": [
          "description",
          "dueDate",
          "importance",
          "state"
        ],
        "properties": {
          "description": {
            "type": "string",
            "examples": [
              "Renew the passport"
            ],
            "pattern": "\\S",
            "maxLength": 255
          },
          "dueDate": {
            "type": "string",
            "examples": [
              "2026-11-30"
            ],
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueTime": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
            "description": "The time of day it is due at, to the minute (#474); none, or null, for a task due all day. Floating without a timeZone. Left out together with the other of dueTime and timeZone, the task keeps both (#497), for apps that know neither. Left out alone, it counts as null, so a timeZone sent without a dueTime is refused.",
            "examples": [
              "10:00"
            ]
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The IANA zone dueTime is meant in (#474), one the backend knows; only with a dueTime. None, or null, for a floating time, which follows the reader's clock. Left out together with the other of dueTime and timeZone, the task keeps both (#497), for apps that know neither. Left out alone, it counts as null, so a timeZone sent without a dueTime is refused.",
            "examples": [
              "Europe/Berlin"
            ],
            "maxLength": 64
          },
          "importance": {
            "type": "string",
            "examples": [
              "HIGH"
            ],
            "$ref": "#/components/schemas/TaskImportance"
          },
          "state": {
            "type": "string",
            "examples": [
              "TODO"
            ],
            "$ref": "#/components/schemas/TaskState"
          }
        }
      },
      "ThumbnailUploadResponse": {
        "type": "object",
        "required": [
          "url",
          "headers"
        ],
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 4096
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "UploadResponse": {
        "type": "object",
        "required": [
          "attachment",
          "url",
          "headers",
          "expiresAt"
        ],
        "properties": {
          "attachment": {
            "$ref": "#/components/schemas/AttachmentResponse"
          },
          "url": {
            "type": "string",
            "maxLength": 4096
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "thumbnailUpload": {
            "$ref": "#/components/schemas/ThumbnailUploadResponse"
          }
        }
      },
      "VersionResponse": {
        "type": "object",
        "required": [
          "version",
          "minimumAppVersion"
        ],
        "properties": {
          "version": {
            "type": "string",
            "examples": [
              "0.11.0"
            ],
            "maxLength": 64
          },
          "minimumAppVersion": {
            "type": "string",
            "examples": [
              "1.0.0"
            ],
            "maxLength": 64
          }
        }
      }
    },
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "taskfest_session",
        "description": "The website's session: the browser holds the cookie the sign-in callback sets, and the session itself is kept by the backend. Ignored when a request has an Authorization header, which is judged by its bearer token alone."
      },
      "appSession": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "TaskFest app session",
        "description": "An app's session (#281): the token `POST /api/auth/app-session` answers with, sent as the bearer token for 30 days. It starts with `taskfest_app_`, which is how the backend tells it from an ID token."
      },
      "idToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "An ID token from the sign-in of a provider the backend is configured for (`GET /api/auth/providers`), such as Google's or Apple's, sent as the bearer token while it is valid."
      }
    }
  },
  "tags": [
    {
      "name": "Account",
      "description": "The signed-in user's own account."
    },
    {
      "name": "Attachments",
      "description": "Files on a task, transferred directly between the browser and storage."
    },
    {
      "name": "Authentication",
      "description": "The browser side of sign-in, sign-out, and the current session."
    },
    {
      "name": "Deployment",
      "description": "What a deployment runs, for the tooling that deploys it."
    },
    {
      "name": "Devices",
      "description": "The phones a signed-in app receives push notifications on."
    },
    {
      "name": "Tasks",
      "description": "Everything a signed-in user can do to their own tasks."
    }
  ],
  "paths": {
    "/api/account": {
      "delete": {
        "summary": "Delete my account",
        "description": "Deletes every task and every file of the caller, and the account itself. It cannot be undone. An account signed in with Apple is deleted only with Apple's confirmation, and its authorization at Apple is revoked once the deletion counts as done; a revocation that fails does not stop the deletion. The app confirms with Apple's sheet and sends the code it issues; the website is sent to Apple's sign-in, and its callback deletes the account.",
        "tags": [
          "Account"
        ],
        "requestBody": {
          "description": "Only for an account signed in with Apple: Apple's confirmation, so that TaskFest's authorization is revoked at Apple before the account is deleted (#635). Any other sends no body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDeletionRequest"
              }
            }
          },
          "required": false
        },
        "responses": {
          "204": {
            "description": "Deleted, and this browser's session ended."
          },
          "400": {
            "description": "The body is not an account deletion request."
          },
          "428": {
            "description": "The caller signed in with Apple, and sent no `appleAuthorizationCode`, or is the website, which confirms at Apple's sign-in rather than with a code: nothing was deleted. To the website, it names Apple's sign-in that confirms the deletion (#635); the app confirms with Apple's sheet and is sent no body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeletionConfirmation"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/auth/app-session": {
      "post": {
        "summary": "Start an app session",
        "description": "Trades the ID token the app signed in with, sent as `Authorization: Bearer`, once for a TaskFest app session token, which the app sends instead from then on. The ID token is checked exactly as on any bearer request. The session ends 30 days after it starts however much it is used, when the app ends it, or with the account. An app session token or a session cookie cannot start another.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "201": {
            "description": "The session started.",
            "content": {
              "application/json": {
                "examples": {
                  "appSession": {
                    "value": {
                      "token": "taskfest_app_q8Jx2mJ0bZ8tQ1n4Yc7d5v3s6K9wF2hL0aR1uE4oP7i",
                      "expiresAt": "2026-12-16T09:30:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/AppSessionResponse"
                }
              }
            }
          },
          "401": {
            "description": "No valid ID token was sent."
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "idToken": []
          }
        ]
      },
      "delete": {
        "summary": "End the app session",
        "description": "Signs the app out: ends the app session whose token is sent as `Authorization: Bearer`. Ending one that has ended already succeeds too. The identity provider's own session is untouched.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "204": {
            "description": "The session has ended."
          },
          "401": {
            "description": "No app session token was sent."
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "appSession": []
          }
        ]
      }
    },
    "/api/auth/login": {
      "get": {
        "summary": "Start sign-in",
        "description": "Starts sign-in with the deployment's main provider; the provider's callback completes it. Needs no authentication.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "302": {
            "description": "Redirects to the provider's sign-in."
          },
          "303": {
            "description": "The request is signed in already; redirects to the post-login URI."
          },
          "404": {
            "description": "No such provider, or not one available here."
          },
          "502": {
            "description": "The provider could not be reached."
          }
        }
      }
    },
    "/api/auth/login/{provider}": {
      "get": {
        "summary": "Start sign-in with one provider",
        "description": "For every provider but the deployment's main one, which uses /api/auth/login. The provider list names each provider's path.",
        "tags": [
          "Authentication"
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirects to the provider's sign-in."
          },
          "303": {
            "description": "The request is signed in already; redirects to the post-login URI."
          },
          "404": {
            "description": "No such provider, or not one available here."
          },
          "502": {
            "description": "The provider could not be reached."
          }
        }
      }
    },
    "/api/auth/logout": {
      "get": {
        "summary": "End the local session",
        "description": "Expires every session cookie the browser sent; the identity provider's own session is untouched.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "303": {
            "description": "Signed out; redirects to the post-login URI."
          }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "summary": "The signed-in identity",
        "description": "The only identity the frontend is allowed to know about.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "200": {
            "description": "The signed-in user.",
            "content": {
              "application/json": {
                "examples": {
                  "currentUser": {
                    "value": {
                      "email": "person@example.com",
                      "name": "Person Example",
                      "pictureUrl": "https://example.com/avatar.jpg"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/CurrentUserResponse"
                }
              }
            }
          },
          "401": {
            "description": "No one is signed in."
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/auth/providers": {
      "get": {
        "summary": "List the configured sign-in providers",
        "description": "Every provider this deployment declares, usable or not, needing no authentication to ask.",
        "tags": [
          "Authentication"
        ],
        "responses": {
          "200": {
            "description": "The configured providers.",
            "content": {
              "application/json": {
                "examples": {
                  "providers": {
                    "value": {
                      "enabled": true,
                      "providers": [
                        {
                          "id": "google",
                          "label": "Google",
                          "available": true,
                          "loginUrl": "/api/auth/login",
                          "issuer": "https://accounts.google.com"
                        }
                      ]
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/AuthProvidersResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/devices/{installationId}": {
      "put": {
        "summary": "Register the app's device",
        "description": "Registers the phone the app runs on for push notifications (#277), or updates its push token or language: one installation of the app, named by the id it generated once and keeps. The device belongs to the app session sent as `Authorization: Bearer` and lasts as long as that session: signing out, the session's end after its 30 days and deleting the account each remove it. A session has one device, so registering another installation id with it removes the one before; registering the same installation id from a new session, after signing in again on the same phone, moves the device to that session.",
        "tags": [
          "Devices"
        ],
        "parameters": [
          {
            "name": "installationId",
            "in": "path",
            "required": true,
            "description": "The installation's id: a UUID the app generated once, in lower case with its hyphens.",
            "schema": {
              "type": "string",
              "examples": [
                "3f2b8c1e-9a4d-4e7f-8b6a-2c5d1e0f9a7b"
              ],
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "maxLength": 36
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceRegistration"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "The device is registered."
          },
          "400": {
            "description": "The installation id is no UUID in lower case, or a field failed validation."
          },
          "401": {
            "description": "No app session token was sent, or its session has ended: a provider's ID token or the website's session cookie registers no device."
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "appSession": []
          }
        ]
      }
    },
    "/api/tasks": {
      "get": {
        "summary": "List the caller's tasks",
        "description": "Ordered by due date, then by importance, high first, then id.",
        "tags": [
          "Tasks"
        ],
        "responses": {
          "200": {
            "description": "The caller's tasks.",
            "content": {
              "application/json": {
                "examples": {
                  "tasks": {
                    "value": [
                      {
                        "id": 42,
                        "description": "Renew the passport",
                        "dueDate": "2026-11-30",
                        "importance": "HIGH",
                        "state": "TODO"
                      }
                    ]
                  }
                },
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TaskResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      },
      "post": {
        "summary": "Create a task",
        "description": "The caller becomes the owner; the id cannot be set.",
        "tags": [
          "Tasks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The task as created.",
            "content": {
              "application/json": {
                "examples": {
                  "task": {
                    "value": {
                      "id": 42,
                      "description": "Renew the passport",
                      "dueDate": "2026-11-30",
                      "importance": "HIGH",
                      "state": "TODO"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "A field failed validation, for example a blank description or a due date that is past everywhere."
          },
          "422": {
            "description": "Refused: the caller has 500 tasks already (#607)."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/drafts": {
      "post": {
        "summary": "Start a draft task",
        "description": "A task to attach files to before it is added; on no list until then (#381).",
        "tags": [
          "Tasks"
        ],
        "responses": {
          "201": {
            "description": "The draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftResponse"
                }
              }
            }
          },
          "422": {
            "description": "Refused: the caller has 5 drafts open already (#434)."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/drafts/{id}": {
      "delete": {
        "summary": "Discard a draft task",
        "description": "Its files go with it, at once.",
        "tags": [
          "Tasks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The draft was discarded."
          },
          "404": {
            "description": "No draft with this id is owned by the caller."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/drafts/{id}/add": {
      "post": {
        "summary": "Add a draft task",
        "description": "Makes the draft a task, with its files, validated as a create is. Adding it again, as a retry whose answer was lost does, applies the values to the task (#427).",
        "tags": [
          "Tasks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The task as added.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "A field failed validation, as for a create."
          },
          "404": {
            "description": "No draft or task with this id is owned by the caller."
          },
          "422": {
            "description": "Refused: the caller has 500 tasks already, and the draft would be one more (#607)."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{id}": {
      "put": {
        "summary": "Replace a task",
        "description": "Replaces every field of a task owned by the caller, except a due time and zone the request leaves out both of (#497).",
        "tags": [
          "Tasks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The task as updated.",
            "content": {
              "application/json": {
                "examples": {
                  "task": {
                    "value": {
                      "id": 42,
                      "description": "Renew the passport",
                      "dueDate": "2026-11-30",
                      "importance": "HIGH",
                      "state": "TODO"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "A field failed validation."
          },
          "404": {
            "description": "No task with this id is owned by the caller."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      },
      "delete": {
        "summary": "Delete a task",
        "tags": [
          "Tasks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The task was deleted."
          },
          "404": {
            "description": "No task with this id is owned by the caller."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments": {
      "post": {
        "summary": "Announce an upload",
        "description": "Checks the type and the limits, and answers with a link that accepts exactly this file: PUT it there with the given headers, then confirm.",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnnounceRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The attachment, pending, and its upload link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadResponse"
                }
              }
            }
          },
          "422": {
            "description": "Refused: an unsupported type, too large, or a limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefusalResponse"
                }
              }
            }
          },
          "404": {
            "description": "No task with this id is owned by the caller."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          },
          "400": {
            "description": "Bad Request"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments/links": {
      "post": {
        "summary": "Add a link",
        "description": "A web address, with the page's title where the sharing app gave one (#414). Counted against the same limits as files; available at once, with nothing to upload.",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The link, available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentResponse"
                }
              }
            }
          },
          "400": {
            "description": "The URL is not a web address."
          },
          "422": {
            "description": "Refused: a limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefusalResponse"
                }
              }
            }
          },
          "404": {
            "description": "No task with this id is owned by the caller."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments/{id}": {
      "delete": {
        "summary": "Remove an attachment",
        "description": "Deletes the file and its record.",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "404": {
            "description": "No such attachment on a task the caller owns."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments/{id}/confirm": {
      "post": {
        "summary": "Confirm an upload",
        "description": "Checks the file arrived as announced and makes the attachment available.",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The attachment, available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentResponse"
                }
              }
            }
          },
          "409": {
            "description": "The file has not arrived yet."
          },
          "422": {
            "description": "What arrived is not what was announced; it was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefusalResponse"
                }
              }
            }
          },
          "404": {
            "description": "No such attachment on a task the caller owns."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments/{id}/link": {
      "get": {
        "summary": "A link to open the file",
        "description": "For the owner's browser to fetch the file straight from storage. The same link is handed out again while it is fresh, and the answer may be kept for as long as that, so the browser's cache keeps the file.",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The link and until when it works.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkResponse"
                }
              }
            }
          },
          "404": {
            "description": "No such available attachment on a task the caller owns."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/tasks/{taskId}/attachments/{id}/thumbnail-link": {
      "get": {
        "summary": "A link to the preview thumbnail",
        "description": "Like the file's link, for the small preview an image's row shows (#236).",
        "tags": [
          "Attachments"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The link and until when it works.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkResponse"
                }
              }
            }
          },
          "404": {
            "description": "No such available attachment with a thumbnail on a task the caller owns."
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "sessionCookie": []
          },
          {
            "appSession": []
          },
          {
            "idToken": []
          }
        ]
      }
    },
    "/api/version": {
      "get": {
        "summary": "Report the running release",
        "description": "The version this backend was built as, and the oldest mobile app release it still serves, needing no authentication to ask.",
        "tags": [
          "Deployment"
        ],
        "responses": {
          "200": {
            "description": "The running version.",
            "content": {
              "application/json": {
                "examples": {
                  "release": {
                    "value": {
                      "version": "1.3.0",
                      "minimumAppVersion": "1.0.0"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/VersionResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "info": {
    "title": "TaskFest API",
    "version": "1.9.0",
    "description": "The task board's REST surface. Every response schema here is published as JSON Schema and checked at runtime by the frontend.",
    "license": {
      "name": "Apache-2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ]
}
