{"openapi":"3.0.3","info":{"title":"TaskShark Backend API","version":"1.0.0","description":"REST API for the TaskShark field service app and for third-party integrations. See the guides in `x-guides` (rendered at /docs) for conventions, authentication, file upload, sync/conflict handling, the WebSocket protocol and push notifications."},"servers":[{"url":"https://taskshark.isurus.com"}],"tags":[{"name":"App · Authentication"},{"name":"App · Sync"},{"name":"App · Tasks"},{"name":"App · Forms"},{"name":"App · Media"},{"name":"App · Documents"},{"name":"App · Messaging"},{"name":"App · Conflicts"},{"name":"App · Devices"},{"name":"Integration · General"},{"name":"Integration · Tasks & schedule"},{"name":"Integration · Files & attachments"},{"name":"Integration · Users"},{"name":"Integration · Forms"},{"name":"Integration · Documents"},{"name":"Integration · Messaging"},{"name":"Integration · Holidays"},{"name":"Integration · Conflicts"}],"x-guides":[{"title":"Overview","body":"TaskShark's backend exposes three surfaces from one server:\n\n| Surface | Base path | Who uses it | Authentication |\n|---|---|---|---|\n| App API | `/v1` | The TaskShark Android app | User access token (Bearer) |\n| Integration API | `/v1/integration` | Third-party systems uploading schedules, files, forms, documents and messages | Tenant API key |\n| Realtime | `/ws` | The app, for live messaging and task updates | User access token |\n\nThere is also an admin web UI at `/admin` for inspecting stored data and creating tenants, users and API keys.\n\nBase URL of this server: `https://taskshark.isurus.com`. A machine-readable OpenAPI 3 description is at `/v1/openapi.json`."},{"title":"Conventions","body":"**Envelope.** Every JSON response has the same shape:\n\n```json\n{ \"success\": true, \"data\": { }, \"error\": null, \"meta\": null }\n```\n\nOn failure `success` is false, `data` is normally null and `error` is `{ \"code\", \"message\", \"details\" }`. Paged list endpoints fill `meta` with `{ page, pageSize, total, hasMore }`; otherwise it is null.\n\n**Timestamps** are integers: milliseconds since the Unix epoch, UTC. Request fields that take a timestamp also accept an ISO-8601 string such as `2026-12-02T08:00:00Z`.\n\n**IDs** are strings, unique within a tenant. Clients may supply their own (1–128 characters: letters, digits and `. _ : @ -`) or let the server generate UUIDs.\n\n**Partial updates.** In PUT/PATCH bodies an omitted field is left unchanged; an explicit `null` clears it.\n\n**Tenancy.** Every token and API key belongs to exactly one tenant, and every request is confined to it. The app also sends `tenantId` on many calls; when present it must match the token or the request is refused with 403.\n\n**Errors.**\n\n| HTTP | code | Meaning |\n|---|---|---|\n| 400 | VALIDATION_ERROR, INVALID_JSON | The request is malformed; `details.field` names the offending field |\n| 401 | UNAUTHORIZED, INVALID_CREDENTIALS | Missing, invalid or expired credentials |\n| 403 | FORBIDDEN, INVALID_SIGNATURE | Authenticated but not allowed (wrong tenant, missing scope, not assigned) |\n| 404 | NOT_FOUND | No such resource in this tenant |\n| 409 | CONFLICT, ALREADY_EXISTS, UPLOAD_INCOMPLETE, AMBIGUOUS_REFERENCE | The request clashes with current state |\n| 413 | FILE_TOO_LARGE, BODY_TOO_LARGE | Upload exceeds the size limit (500 MB per file) |\n| 422 | UNKNOWN_USER, UNKNOWN_TASK, UNKNOWN_TEMPLATE, UNKNOWN_FILE, NOTHING_TO_APPLY | Well-formed but refers to something that does not exist |\n| 429 | TOO_MANY_ATTEMPTS | Too many failed sign-ins |\n| 500 | INTERNAL_ERROR | Unexpected server error |"},{"title":"Authentication","body":"**App users** sign in with `POST /v1/auth/login` and send the returned access token on every call:\n\n```\nAuthorization: Bearer tsa_…\n```\n\nAccess tokens last 60 minutes; `expiresAt` says exactly when. Before expiry (or on a 401) call `POST /v1/auth/refresh` with the refresh token to get a new pair. Refresh tokens last 60 days and are single use.\n\n**Integrations** authenticate with an API key created in the admin UI (Tenant → API keys). Send it either way:\n\n```\nX-API-Key: tsk_…\nAuthorization: Bearer tsk_…\n```\n\nA key is shown once at creation and stored only as a hash. Each key carries scopes; `*` grants everything. Available scopes: `tasks:read`, `tasks:write`, `users:read`, `users:write`, `forms:read`, `forms:write`, `submissions:read`, `media:read`, `media:write`, `documents:read`, `documents:write`, `messages:read`, `messages:write`, `conflicts:read`, `conflicts:write`, `holidays:read`, `holidays:write`. The scope each endpoint needs is shown on the endpoint.\n\n```\ncurl -H \"X-API-Key: tsk_…\" https://taskshark.isurus.com/v1/integration/ping\n```"},{"title":"Uploading a schedule","body":"Third-party systems push work to technicians with `POST /v1/integration/tasks/bulk`:\n\n```\ncurl -X POST https://taskshark.isurus.com/v1/integration/tasks/bulk \\\n  -H \"X-API-Key: tsk_…\" -H \"Content-Type: application/json\" \\\n  -d '{ \"tasks\": [ {\n        \"thirdPartyRefId\": \"WO-2026-04821\", \"externalSystemName\": \"Simpro\",\n        \"title\": \"Annual boiler service – Unit 4B\",\n        \"scheduledStart\": \"2026-12-02T08:00:00Z\", \"scheduledEnd\": \"2026-12-02T10:00:00Z\",\n        \"assignedUserIds\": [\"<user id>\"] } ] }'\n```\n\n- Identify each task by your own `id`, or omit `id` and let the server match on `thirdPartyRefId` (+ `externalSystemName`).\n- Look up user ids with `GET /v1/integration/users`, or create users with `POST /v1/integration/users`.\n- Uploads are idempotent: send the same schedule as often as you like. Only real changes bump a task's `version` and reach devices.\n- To make an upload authoritative for a period, add `\"replace\": { \"from\", \"to\", \"externalSystemName\" }`; tasks in that window that are missing from the upload are deleted.\n- Assigned technicians are told immediately (WebSocket `task_updated` and a push notification) and their app syncs.\n\nRead results back with `GET /v1/integration/tasks?updatedSince=…` (status changes, notes), `GET /v1/integration/form-submissions?updatedSince=…` (completed forms) and `GET /v1/integration/media?updatedSince=…` (photos and videos)."},{"title":"Mirroring a system of record","body":"When another system owns the staff list, the schedule and the job files, and this server only caches them for the app, push everything on a timer (every few minutes is fine). Each step is idempotent, so a push that changes nothing costs little and disturbs no device.\n\n1. **Users** — `POST /v1/integration/users/bulk` with your own prefixed ids, `isActive: true` and, to let people sign in with the password they already have, `passwordHash` (bcrypt). Add `deactivateMissingIdPrefix` so people who leave lose access.\n2. **Files** — give each file an `externalId` that changes when its content does (e.g. a hash). Ask `POST /v1/integration/files/lookup` which ids are missing and upload only those to `POST /v1/integration/files`.\n3. **Schedule** — `POST /v1/integration/tasks/bulk` with your task ids, `assignedUserIds`, a `replace` window, and on each task `attachments: [{ \"fileExternalId\": … }]`. One stored file can be attached to any number of tasks.\n4. **Holidays** — `POST /v1/integration/holidays/bulk` with a `replace` date range.\n5. **Reference documents** — `PUT /v1/integration/documents/{id}`.\n\nLeave `status` out of pushed tasks unless your system really changed it: progress recorded in the app is then preserved across pushes."},{"title":"Uploading files","body":"**From an integration** the simplest route is a multipart request with a `file` part:\n\n```\ncurl -X POST https://taskshark.isurus.com/v1/integration/tasks/<taskId>/attachments \\\n  -H \"X-API-Key: tsk_…\" -F \"file=@site-plan.pdf\"\n\ncurl -X POST https://taskshark.isurus.com/v1/integration/documents \\\n  -H \"X-API-Key: tsk_…\" -F \"file=@gas-safety-guide.pdf\" \\\n  -F \"title=Gas Safety Quick Reference\" -F \"category=SAFETY\" -F \"version=3.2\" -F \"tags=gas,safety\"\n```\n\nSmall files can instead be sent inside JSON as `contentBase64` (with `filename` and `mimeType`).\n\n**From the app, or for large files,** use the three-step signed-URL flow, which keeps storage credentials off the device:\n\n1. `POST /v1/media/presigned-url` (integrations: `POST /v1/integration/files/presigned-url`) → `{ uploadUrl, s3Key, cdnUrl, expiresAt }`\n2. `PUT <uploadUrl>` with the raw bytes as the body. No Authorization header. Upload URLs are valid for 15 minutes.\n3. App: `POST /v1/media/confirm-upload` with `{ mediaId, s3Key, cdnUrl }`. Integrations: pass `{ \"s3Key\": … }` to the attachment, document or message endpoint.\n\nStored files are served from `/files/<s3Key>`. Those URLs need no credentials — the random key is the capability — so they work directly in image loaders and browsers, and should be shared only with people entitled to the file."},{"title":"Sync and conflict handling","body":"The app is offline-first: it works from a local cache, queues changes, and syncs when it can.\n\n**Download.** `GET /v1/sync/manifest?since=<serverTime of previous sync>` returns everything that changed. Use the `serverTime` from the response, not the device clock, as the next `since`.\n\n**Upload.** Queued changes are replayed against the ordinary endpoints. All of them are safe to retry:\n\n| Change | Endpoint | Idempotency |\n|---|---|---|\n| Status change | `PATCH /v1/tasks/{id}/status` | Repeating the current status is a no-op |\n| Note | `PATCH /v1/tasks/{id}/notes` | `noteId` |\n| Form | `POST /v1/form-submissions` | `id` |\n| Media | presign → PUT → `POST /v1/media/confirm-upload` | `mediaId` |\n| Message | `POST /v1/messages` | `localId` |\n\n**Merging.** Every task has a `version` that increases with each change. A device sends the version it last saw as `clientVersion`. Merging is field-level:\n\n- Notes, media and messages are append-only and never conflict.\n- A status change is accepted unless the *status itself* was changed by somebody else after `clientVersion`. Rescheduling or editing other fields in the meantime does not block it.\n- A form re-submitted under the same id with different answers is never merged automatically.\n\n**Conflicts.** When a change cannot be merged safely the server stores a conflict record (the device's payload and the server state), answers **409** with `error.code = \"CONFLICT\"` and the server's current entity in `data`, and leaves server data untouched. It is then resolved with `POST /v1/conflicts/resolve` (or from the admin UI or integration API): `KEEP_SERVER`, `KEEP_LOCAL` or `MERGE` with a `mergedPayload`. The user who raised a conflict can settle it from the app — keep the server's version, or have their own task change applied after all; a supervisor or admin can resolve any conflict, and is needed to overwrite stored form answers or apply a merged payload.\n\nThe app resolves two cases by itself when it receives the 409: if the server already has the status it asked for, or the server's status is terminal (`COMPLETED` / `CANCELLED`), it takes the server's version and closes the conflict with `KEEP_SERVER`. Everything else is shown to the user on the app's Conflicts screen."},{"title":"WebSocket","body":"Connect to `wss://taskshark.isurus.com/ws?token=<accessToken>`. An invalid or expired token is refused with HTTP 401 during the handshake; reconnect with a fresh token. Frames are JSON text. The server pings every 30 seconds (standard WebSocket ping frames).\n\n**Server → client**\n\n| type | Fields | Meaning |\n|---|---|---|\n| `connected` | `userId`, `serverTime` | Sent once after connecting |\n| `new_message` | `conversationId`, `message` (a Message) | Someone else posted in one of your conversations |\n| `message_delivered` | `messageId`, `deliveredAt` | A message you sent reached a recipient's device |\n| `message_read` | `messageId`, `readAt` | A recipient read a message you sent |\n| `typing_start` / `typing_stop` | `conversationId`, `userId` | Another participant started/stopped typing |\n| `task_updated` | `taskId` | A task you are assigned to changed — fetch it or sync |\n| `sync_required` | — | Templates, documents or conversations changed — run a sync |\n| `pong` | `serverTime` | Reply to a client `ping` |\n\n**Client → server**\n\n| type | Fields | Meaning |\n|---|---|---|\n| `typing_start` / `typing_stop` | `conversationId` | Relayed to the other participants |\n| `ping` | — | Application-level keep-alive |\n\nMessages are *sent* with `POST /v1/messages`, not over the socket, so that offline queuing and retries work the same way online and offline. A sender does not receive `new_message` for their own message."},{"title":"Push notifications","body":"Devices register their Firebase Cloud Messaging token with `POST /v1/devices/fcm-token`. When the server is configured with a Firebase service account (`FCM_SERVICE_ACCOUNT_FILE`) it sends data messages whose `type` tells the app what to do:\n\n| data.type | Other data | Sent when |\n|---|---|---|\n| `task_assigned` | `taskId` | A task is created for, or newly assigned to, the user |\n| `task_update` | `taskId` | A task assigned to the user changed or was deleted |\n| `new_message` | `conversationId`, `messageId` | A message arrived while the user had no WebSocket connection |\n| `sync_required` | — | Templates, documents or conversations changed |\n\nWithout a service account, push is disabled and the app relies on the WebSocket and its periodic background sync. Push is currently **disabled** on this server."}],"paths":{"/v1/auth/login":{"post":{"tags":["App · Authentication"],"summary":"Sign in","description":"Exchanges email + password + organisation slug for an access token and a refresh token. After 10 failed attempts for the same email from one IP address, further attempts are rejected with 429 for five minutes.","operationId":"post_v1_auth_login","security":[],"x-auth":"none","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"},"example":{"email":"alex.morgan@taskshark-demo.co.uk","password":"demo-password","tenantSlug":"taskshark-demo","deviceId":"pixel-9-a1b2"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthTokens"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"429":{"description":"Too many attempts","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/auth/refresh":{"post":{"tags":["App · Authentication"],"summary":"Refresh the access token","description":"Returns a new access token and a new refresh token; the old pair stops working. If the response is lost, the previous refresh token is still accepted for two minutes so the device can retry.","operationId":"post_v1_auth_refresh","security":[],"x-auth":"none","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","description":"The current refresh token."}},"required":["refreshToken"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthTokens"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/auth/logout":{"post":{"tags":["App · Authentication"],"summary":"Sign out","description":"Revokes the session behind the access token and unregisters the device's push token.","operationId":"post_v1_auth_logout","security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/me":{"get":{"tags":["App · Authentication"],"summary":"Current user and tenant","operationId":"get_v1_me","security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"tenant":{"$ref":"#/components/schemas/Tenant"}}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/users":{"get":{"tags":["App · Authentication"],"summary":"Tenant user directory","description":"Active users of the tenant: for resolving names/avatars and for the schedule person filter.","operationId":"get_v1_users","security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"User id."},"name":{"type":"string","description":"Name."},"role":{"type":"string","description":"Role."},"avatarUrl":{"type":"string","description":"Avatar.","nullable":true},"email":{"type":"string","description":"Email."},"phone":{"type":"string","description":"Phone.","nullable":true}}}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/sync/manifest":{"get":{"tags":["App · Sync"],"summary":"Download everything that changed","description":"The device's main download call. Returns tasks, form templates, reference documents and conversations changed since `since`. Technicians receive the tasks assigned to them (or every task when the tenant config has `technicianTaskVisibility: \"ALL\"`); supervisors and admins receive all tasks. Store `serverTime` and send it as `since` on the next call.","operationId":"get_v1_sync_manifest","parameters":[{"name":"since","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SyncManifest"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/holidays":{"get":{"tags":["App · Sync"],"summary":"List staff holidays","description":"Who is away, for showing on the schedule. The sync manifest already carries current and future holidays; use this for other date ranges.","operationId":"get_v1_holidays","parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Only holidays ending on or after this day (yyyy-mm-dd).","required":false},{"name":"to","in":"query","schema":{"type":"string"},"description":"Only holidays starting on or before this day (yyyy-mm-dd).","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Holiday"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks":{"get":{"tags":["App · Tasks"],"summary":"List tasks (schedule)","description":"Tasks visible to the user, ordered by scheduledStart.","operationId":"get_v1_tasks","parameters":[{"name":"from","in":"query","schema":{"type":"integer"},"description":"scheduledStart ≥ this time.","required":false},{"name":"to","in":"query","schema":{"type":"integer"},"description":"scheduledStart < this time.","required":false},{"name":"status","in":"query","schema":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETED","CANCELLED"]},"description":"Filter by status.","required":false},{"name":"assignedUserId","in":"query","schema":{"type":"string"},"description":"Only tasks assigned to this user.","required":false},{"name":"since","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}":{"get":{"tags":["App · Tasks"],"summary":"Get one task","operationId":"get_v1_tasks_taskId","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true},{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}/status":{"patch":{"tags":["App · Tasks"],"summary":"Update task status","description":"Applies a status change made on the device. The change is accepted unless someone else changed the status on the server after the version the device last saw (`clientVersion`); edits to other fields never block it, and repeating the current status succeeds as a no-op. On a genuine clash the server records a conflict and answers 409 with the current server task in `data`.","operationId":"patch_v1_tasks_taskId_status","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskStatusUpdateRequest"},"example":{"taskId":"task-demo-0001","status":"COMPLETED","notes":null,"cancellationReason":null,"completedAt":1796120000000,"clientVersion":4}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}/notes":{"patch":{"tags":["App · Tasks"],"summary":"Add a note to a task","description":"Appends a note authored by the signed-in user. Notes are append-only, so they never conflict. Send `noteId` to make retries idempotent.","operationId":"patch_v1_tasks_taskId_notes","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"type":"string","description":"Note text."},"noteId":{"type":"string","description":"Optional client-generated note id."},"timestamp":{"type":"integer","format":"int64","description":"Optional: when the note was written on the device (epoch milliseconds)"}},"required":["notes"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}/history":{"get":{"tags":["App · Tasks"],"summary":"Task history","operationId":"get_v1_tasks_taskId_history","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/TaskHistoryEvent"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}/media":{"get":{"tags":["App · Tasks"],"summary":"Task attachments","description":"Photos, videos and documents attached to the task by devices or integrations.","operationId":"get_v1_tasks_taskId_media","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/tasks/{taskId}/form-submissions":{"get":{"tags":["App · Tasks"],"summary":"Forms submitted for a task","operationId":"get_v1_tasks_taskId_form_submissions","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormSubmission"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/form-templates":{"get":{"tags":["App · Forms"],"summary":"List form templates","description":"The latest version of every template in the tenant, including retired ones (`isActive: false`).","operationId":"get_v1_form_templates","parameters":[{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false},{"name":"since","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormTemplate"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/form-submissions":{"post":{"tags":["App · Forms"],"summary":"Submit a completed form","description":"Stores a submitted form. Idempotent on `id`: an identical retry returns 200 with `duplicate: true`. Re-sending the same id with different values is not merged automatically — it is recorded as a conflict for a supervisor and answered with 409.","operationId":"post_v1_form_submissions","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormSubmissionRequest"},"example":{"id":"3f0d6e9e-6f1c-4f0b-9d55-0c1d2e3f4a5b","taskId":"task-demo-0001","templateId":"form-template-service","templateVersion":1,"fieldValues":{"q1":"yes","q2":"yes","q3":"na","sig_name":"Bob Smith","sig":"[[{\"x\":0.1,\"y\":0.4},{\"x\":0.5,\"y\":0.6}]]"},"submittedAt":1796120000000}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FormSubmissionReceipt"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/media/presigned-url":{"post":{"tags":["App · Media"],"summary":"Get an upload URL","description":"Step 1 of a media upload. Returns a short-lived signed URL; PUT the file bytes to it (step 2), then call confirm-upload (step 3). The link fields (`taskId` etc.) are optional here and on confirm — send them on either call to attach the media.","operationId":"post_v1_media_presigned_url","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresignedUrlRequest"},"example":{"filename":"IMG_0042.jpg","mimeType":"image/jpeg","sizeBytes":2481923,"tenantId":"tenant-demo-0001","context":"task","taskId":"task-demo-0001"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PresignedUrlResponse"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/storage/upload/{s3Key}":{"put":{"tags":["App · Media"],"summary":"Upload file bytes","description":"Step 2. This is the `uploadUrl` from presigned-url — use it exactly as returned, including its query string. Send the raw bytes as the request body with the file's Content-Type; no Authorization header. The URL may be re-used to retry until it expires.","operationId":"put_v1_storage_upload_s3Key","parameters":[{"name":"s3Key","in":"path","schema":{"type":"string"},"description":"Object key (contains slashes).","required":true},{"name":"expires","in":"query","schema":{"type":"integer"},"description":"Expiry (part of the signed URL).","required":true},{"name":"signature","in":"query","schema":{"type":"string"},"description":"HMAC signature (part of the signed URL).","required":true}],"security":[],"x-auth":"signedUrl","requestBody":{"required":true,"description":"The raw file bytes.","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"s3Key":{"type":"string","description":"Object key."},"sizeBytes":{"type":"integer","description":"Bytes stored."},"sha256":{"type":"string","description":"SHA-256 of the content."}}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/media/confirm-upload":{"post":{"tags":["App · Media"],"summary":"Confirm an upload","description":"Step 3. Registers the uploaded file as a media attachment with the client-generated `mediaId` and links it to a task / form submission / message if link fields were supplied. Idempotent. Answers 409 UPLOAD_INCOMPLETE if the bytes have not arrived yet.","operationId":"post_v1_media_confirm_upload","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaUploadConfirmRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/files/{s3Key}":{"get":{"tags":["App · Media"],"summary":"Download a file","description":"The stable download URL (`cdnUrl`, `url`, `mediaUrl`, `fileUrl`) of a stored file. No authentication header is required: the key contains 128 bits of randomness and acts as the access capability, so treat these URLs as secrets. Supports HTTP Range requests. Add `?download=1` to force a download.","operationId":"get_files_s3Key","parameters":[{"name":"s3Key","in":"path","schema":{"type":"string"},"description":"Object key (contains slashes).","required":true},{"name":"download","in":"query","schema":{"type":"string","enum":["1"]},"description":"Send as attachment.","required":false}],"security":[],"x-auth":"none","responses":{"200":{"description":"The file content, with its stored Content-Type.","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/documents":{"get":{"tags":["App · Documents"],"summary":"List reference documents","operationId":"get_v1_documents","parameters":[{"name":"since","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"category","in":"query","schema":{"type":"string"},"description":"Filter by category.","required":false},{"name":"q","in":"query","schema":{"type":"string"},"description":"Search title and description.","required":false},{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/conversations":{"get":{"tags":["App · Messaging"],"summary":"List my conversations","operationId":"get_v1_conversations","parameters":[{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false},{"name":"since","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/conversations/{conversationId}/messages":{"get":{"tags":["App · Messaging"],"summary":"Message history","description":"Messages newest first. Page backwards by passing the `sentAt` of the oldest message you hold as `before`.","operationId":"get_v1_conversations_conversationId_messages","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true},{"name":"tenantId","in":"query","schema":{"type":"string"},"description":"Optional. If sent it must equal the tenant of the access token, otherwise 403.","required":false},{"name":"before","in":"query","schema":{"type":"integer"},"description":"Only messages sent before this time.","required":false},{"name":"after","in":"query","schema":{"type":"integer"},"description":"Only messages sent after this time.","required":false},{"name":"limit","in":"query","schema":{"type":"integer","default":50},"description":"Maximum messages (1–200).","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/messages":{"post":{"tags":["App · Messaging"],"summary":"Send a message","description":"Stores the message and delivers it to the other participants over WebSocket (`new_message`), falling back to a push notification for those not connected. Idempotent on `localId`. For photos/videos upload the file first and pass its `s3Key`.","operationId":"post_v1_messages","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"},"example":{"localId":"0b6e7f6a-0f3b-4f0e-8a51-6a0f6a3a9d10","conversationId":"conv-demo-0001","type":"TEXT","content":"On my way, 10 mins away","s3Key":null,"replyToId":null,"sentAt":1796120000000}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Message"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/conversations/{conversationId}/read":{"post":{"tags":["App · Messaging"],"summary":"Mark a conversation read","description":"Marks every message from other participants as read by the caller and notifies the senders (`message_read`).","operationId":"post_v1_conversations_conversationId_read","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true}],"security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string","description":"Optional; must match the token."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/conflicts":{"get":{"tags":["App · Conflicts"],"summary":"List conflicts","description":"Supervisors/admins (or users with the `conflicts.resolve` permission) only.","operationId":"get_v1_conflicts","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["OPEN","RESOLVED"],"default":"OPEN"},"description":"Filter by state.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"userToken":[]}],"x-auth":"user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Conflict"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/conflicts/resolve":{"post":{"tags":["App · Conflicts"],"summary":"Resolve a conflict","description":"Resolves every open conflict on the entity. Supervisors/admins (or users with the `conflicts.resolve` permission) may resolve any conflict in any way. Other users may resolve only conflicts they raised themselves, with `KEEP_SERVER`, or with `KEEP_LOCAL` for task conflicts; anything else is 403, and a conflict raised by someone else is 404.","operationId":"post_v1_conflicts_resolve","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictResolutionRequest"},"example":{"entityType":"TASK_STATUS","entityId":"task-demo-0007","resolution":"KEEP_SERVER","mergedPayload":null}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/devices/fcm-token":{"post":{"tags":["App · Devices"],"summary":"Register a push token","description":"Registers the device's Firebase Cloud Messaging token for the signed-in user. Call again whenever the token changes.","operationId":"post_v1_devices_fcm_token","security":[{"userToken":[]}],"x-auth":"user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fcmToken":{"type":"string","description":"FCM registration token."},"deviceId":{"type":"string","description":"Optional device id."},"platform":{"type":"string","description":"Optional; defaults to android."}},"required":["fcmToken"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/ping":{"get":{"tags":["Integration · General"],"summary":"Check an API key","description":"Returns the tenant and scopes the key belongs to. Useful as a connectivity test.","operationId":"get_v1_integration_ping","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"tenant":{"$ref":"#/components/schemas/Tenant"},"apiKey":{"type":"object","properties":{"id":{"type":"string","description":"Key id."},"name":{"type":"string","description":"Key name."},"scopes":{"type":"array","items":{"type":"string"},"description":"Granted scopes."}}},"serverTime":{"type":"integer","format":"int64","description":"Server clock (epoch milliseconds)"}}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/bulk":{"post":{"tags":["Integration · Tasks & schedule"],"summary":"Upload a schedule (bulk upsert)","description":"Creates and updates up to 1000 tasks in one call. Each task is matched by `id`; if `id` is omitted it is matched by `thirdPartyRefId` (plus `externalSystemName` when given), and created if there is no match. Only the fields you send are changed. Items are processed independently: the response reports the outcome of each, and the HTTP status is 207 if any item failed. Re-uploading identical data is reported as `unchanged` and does not disturb devices. Assigned users are notified in real time.\n\nRequired API key scope: `tasks:write`.","operationId":"post_v1_integration_tasks_bulk","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkTaskRequest"},"example":{"tasks":[{"thirdPartyRefId":"WO-2026-04821","externalSystemName":"Simpro","title":"Annual boiler service – Unit 4B","taskType":"BOILER_SERVICE","priority":"HIGH","scheduledStart":"2026-12-02T08:00:00Z","scheduledEnd":"2026-12-02T10:00:00Z","locationName":"Riverside Business Park","locationAddress":"Unit 4B, Riverside Business Park, Manchester, M1 2AB","assignedUserIds":["user-demo-current"],"formTemplateIds":["form-template-service"]}],"replace":{"from":"2026-12-02T00:00:00Z","to":"2026-12-03T00:00:00Z","externalSystemName":"Simpro"}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BulkTaskResult"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks":{"get":{"tags":["Integration · Tasks & schedule"],"summary":"List tasks","description":"Required API key scope: `tasks:read`.","operationId":"get_v1_integration_tasks","parameters":[{"name":"from","in":"query","schema":{"type":"integer"},"description":"scheduledStart ≥ this time.","required":false},{"name":"to","in":"query","schema":{"type":"integer"},"description":"scheduledStart < this time.","required":false},{"name":"status","in":"query","schema":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETED","CANCELLED"]},"description":"Filter by status.","required":false},{"name":"assignedUserId","in":"query","schema":{"type":"string"},"description":"Assigned to this user.","required":false},{"name":"thirdPartyRefId","in":"query","schema":{"type":"string"},"description":"Exact reference match.","required":false},{"name":"externalSystemName","in":"query","schema":{"type":"string"},"description":"Exact source-system match.","required":false},{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"q","in":"query","schema":{"type":"string"},"description":"Search title, location, asset and reference.","required":false},{"name":"includeDeleted","in":"query","schema":{"type":"boolean"},"description":"Include deleted tasks.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Tasks & schedule"],"summary":"Create a task","description":"Required API key scope: `tasks:write`.","operationId":"post_v1_integration_tasks","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/{taskId}":{"get":{"tags":["Integration · Tasks & schedule"],"summary":"Get a task","description":"Returns the task including its notes; deleted tasks are returned with `deletedAt` set.\n\nRequired API key scope: `tasks:read`.","operationId":"get_v1_integration_tasks_taskId","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"put":{"tags":["Integration · Tasks & schedule"],"summary":"Create or update a task","description":"Upsert by id: creates the task if it does not exist (201), otherwise updates the fields supplied (200). Updating a deleted task restores it.\n\nRequired API key scope: `tasks:write`.","operationId":"put_v1_integration_tasks_taskId","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"patch":{"tags":["Integration · Tasks & schedule"],"summary":"Update a task","description":"Changes only the fields supplied, e.g. reschedule, reassign or change status.\n\nRequired API key scope: `tasks:write`.","operationId":"patch_v1_integration_tasks_taskId","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"delete":{"tags":["Integration · Tasks & schedule"],"summary":"Delete a task","description":"Soft-deletes the task; devices drop it at their next sync. Attachments declared through the task's `attachments` list are removed with it (and their stored files released once nothing else uses them); photos and files added in the app stay with the deleted record.\n\nRequired API key scope: `tasks:write`.","operationId":"delete_v1_integration_tasks_taskId","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/{taskId}/notes":{"get":{"tags":["Integration · Tasks & schedule"],"summary":"List task notes","description":"Required API key scope: `tasks:read`.","operationId":"get_v1_integration_tasks_taskId_notes","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/TaskNote"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Tasks & schedule"],"summary":"Add a task note","description":"Required API key scope: `tasks:write`.","operationId":"post_v1_integration_tasks_taskId_notes","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"Note text."},"id":{"type":"string","description":"Optional note id; makes retries idempotent."},"authorId":{"type":"string","description":"Optional tenant user to attribute the note to."},"authorName":{"type":"string","description":"Optional display name (defaults to the user's name or the API key name)."},"timestamp":{"type":"integer","format":"int64","description":"Optional original time (epoch milliseconds)"}},"required":["text"]}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TaskNote"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/{taskId}/history":{"get":{"tags":["Integration · Tasks & schedule"],"summary":"Task history","description":"Required API key scope: `tasks:read`.","operationId":"get_v1_integration_tasks_taskId_history","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"tasks:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/TaskHistoryEvent"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/{taskId}/form-submissions":{"get":{"tags":["Integration · Tasks & schedule"],"summary":"Forms submitted for a task","description":"Required API key scope: `submissions:read`.","operationId":"get_v1_integration_tasks_taskId_form_submissions","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"submissions:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormSubmission"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/tasks/{taskId}/attachments":{"post":{"tags":["Integration · Files & attachments"],"summary":"Attach a file to a task","description":"Uploads a file (drawing, certificate, photo, …) and attaches it to the task so it appears on devices. Send multipart/form-data with a `file` part, or JSON with `contentBase64`, or JSON with the `s3Key` of a file uploaded through a presigned URL. Optional fields: `id` (your id for the attachment, makes retries idempotent), `filename`, `mimeType`, `mediaType`, `metadata`.\n\nRequired API key scope: `media:write`.","operationId":"post_v1_integration_tasks_taskId_attachments","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadJson"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Media"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"get":{"tags":["Integration · Files & attachments"],"summary":"List a task's attachments","description":"Includes photos and videos captured by technicians, with download URLs.\n\nRequired API key scope: `media:read`.","operationId":"get_v1_integration_tasks_taskId_attachments","parameters":[{"name":"taskId","in":"path","schema":{"type":"string"},"description":"Task id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/media":{"get":{"tags":["Integration · Files & attachments"],"summary":"List media","description":"Required API key scope: `media:read`.","operationId":"get_v1_integration_media","parameters":[{"name":"taskId","in":"query","schema":{"type":"string"},"description":"Filter by task.","required":false},{"name":"formSubmissionId","in":"query","schema":{"type":"string"},"description":"Filter by form submission.","required":false},{"name":"messageId","in":"query","schema":{"type":"string"},"description":"Filter by message.","required":false},{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Media"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/media/{mediaId}":{"get":{"tags":["Integration · Files & attachments"],"summary":"Get one media item","description":"Required API key scope: `media:read`.","operationId":"get_v1_integration_media_mediaId","parameters":[{"name":"mediaId","in":"path","schema":{"type":"string"},"description":"Media id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Media"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"delete":{"tags":["Integration · Files & attachments"],"summary":"Delete a media item","description":"Removes the attachment, and the stored file if nothing else references it.\n\nRequired API key scope: `media:write`.","operationId":"delete_v1_integration_media_mediaId","parameters":[{"name":"mediaId","in":"path","schema":{"type":"string"},"description":"Media id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/files":{"post":{"tags":["Integration · Files & attachments"],"summary":"Upload a standalone file","description":"Stores a file without attaching it to anything and returns its `s3Key` and URL — e.g. for a task `headerImageUrl`, or to reference later as `s3Key`. Multipart `file` part or JSON `contentBase64`. Optional `context` field. Optional `externalId` field: your own id for this exact content. Uploading an `externalId` that is already stored returns the existing file with HTTP 200 and discards the bytes sent, so use a new id whenever the content changes. A stored file is deleted once no attachment, document or message refers to it any more.\n\nRequired API key scope: `media:write`.","operationId":"post_v1_integration_files","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadJson"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/StoredFile"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/files/lookup":{"post":{"tags":["Integration · Files & attachments"],"summary":"Check which files are already stored","description":"Given the `externalId`s you would upload, returns the ones already stored and lists the rest. Use it before a push so each file is transferred only once.\n\nRequired API key scope: `media:read`.","operationId":"post_v1_integration_files_lookup","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:read","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileLookupRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FileLookupResult"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/files/presigned-url":{"post":{"tags":["Integration · Files & attachments"],"summary":"Get an upload URL (large files)","description":"For large files: returns a signed URL to PUT the bytes to (see \"Upload file bytes\"), then reference the returned `s3Key` in an attachment, document or message request.\n\nRequired API key scope: `media:write`.","operationId":"post_v1_integration_files_presigned_url","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"media:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresignedUrlRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PresignedUrlResponse"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/users":{"get":{"tags":["Integration · Users"],"summary":"List users","description":"Required API key scope: `users:read`.","operationId":"get_v1_integration_users","parameters":[{"name":"includeInactive","in":"query","schema":{"type":"boolean"},"description":"Include deactivated users.","required":false},{"name":"q","in":"query","schema":{"type":"string"},"description":"Search name and email.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/User"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Users"],"summary":"Create a user","description":"Required API key scope: `users:write`.","operationId":"post_v1_integration_users","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInput"}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/User"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/users/bulk":{"post":{"tags":["Integration · Users"],"summary":"Upload users (bulk upsert)","description":"Creates and updates up to 1000 users by `id` in one call, for a system of record that owns the staff list. Only the fields you send are changed, and an item that changes nothing is reported `unchanged` and does not disturb the user. Changing a password (or `passwordHash`), or setting `isActive: false`, ends that user's sessions; send `isActive: true` to re-activate. Items are processed independently; the HTTP status is 207 if any failed. User ids are unique across the whole server, so prefix yours.\n\nRequired API key scope: `users:write`.","operationId":"post_v1_integration_users_bulk","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUserRequest"},"example":{"users":[{"id":"portal-user-1042","email":"sam.installer@example.co.uk","name":"Sam Installer","role":"TECHNICIAN","isActive":true,"passwordHash":"$2y$10$abcdefghijklmnopqrstuuJ8Zc0v0uZ1q0m5Qe4h1x3o2n9s8r7t6"}],"deactivateMissingIdPrefix":"portal-user-"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BulkUserResult"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/users/{userId}":{"get":{"tags":["Integration · Users"],"summary":"Get a user","description":"Required API key scope: `users:read`.","operationId":"get_v1_integration_users_userId","parameters":[{"name":"userId","in":"path","schema":{"type":"string"},"description":"User id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/User"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"patch":{"tags":["Integration · Users"],"summary":"Update a user","description":"Required API key scope: `users:write`.","operationId":"patch_v1_integration_users_userId","parameters":[{"name":"userId","in":"path","schema":{"type":"string"},"description":"User id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/User"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"delete":{"tags":["Integration · Users"],"summary":"Deactivate a user","description":"Deactivates the user and ends their sessions. Their history is kept.\n\nRequired API key scope: `users:write`.","operationId":"delete_v1_integration_users_userId","parameters":[{"name":"userId","in":"path","schema":{"type":"string"},"description":"User id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"users:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/form-templates":{"get":{"tags":["Integration · Forms"],"summary":"List form templates","description":"Required API key scope: `forms:read`.","operationId":"get_v1_integration_form_templates","parameters":[{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"activeOnly","in":"query","schema":{"type":"boolean"},"description":"Exclude retired templates.","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormTemplate"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Forms"],"summary":"Create a form template","description":"Required API key scope: `forms:write`.","operationId":"post_v1_integration_form_templates","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormTemplateInput"},"example":{"id":"form-template-service","name":"Quality Sign Off","category":"INSPECTION","fields":[{"id":"q1","type":"select","label":"Front elevation cladding meets required standard?","required":true,"options":[{"value":"yes","label":"Yes"},{"value":"no","label":"No"}]},{"id":"q1_photo","type":"photo","label":"Photo evidence (optional)","required":false},{"id":"sig","type":"signature","label":"Customer signature","required":true}]}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FormTemplate"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/form-templates/{templateId}":{"get":{"tags":["Integration · Forms"],"summary":"Get a form template","description":"Required API key scope: `forms:read`.","operationId":"get_v1_integration_form_templates_templateId","parameters":[{"name":"templateId","in":"path","schema":{"type":"string"},"description":"Template id.","required":true},{"name":"version","in":"query","schema":{"type":"integer"},"description":"A specific version (default: latest).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FormTemplate"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"put":{"tags":["Integration · Forms"],"summary":"Create a template or publish a new version","description":"Creates the template (201) or, if anything differs from the latest version, publishes version N+1 (200). Fields you omit keep their current value. Existing submissions keep pointing at the version they were completed against.\n\nRequired API key scope: `forms:write`.","operationId":"put_v1_integration_form_templates_templateId","parameters":[{"name":"templateId","in":"path","schema":{"type":"string"},"description":"Template id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormTemplateInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FormTemplate"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"delete":{"tags":["Integration · Forms"],"summary":"Retire a form template","description":"Publishes a new version with `isActive: false`. Templates are never physically deleted because submissions reference them.\n\nRequired API key scope: `forms:write`.","operationId":"delete_v1_integration_form_templates_templateId","parameters":[{"name":"templateId","in":"path","schema":{"type":"string"},"description":"Template id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/FormTemplate"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/form-templates/{templateId}/versions":{"get":{"tags":["Integration · Forms"],"summary":"List all versions of a template","description":"Required API key scope: `forms:read`.","operationId":"get_v1_integration_form_templates_templateId_versions","parameters":[{"name":"templateId","in":"path","schema":{"type":"string"},"description":"Template id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"forms:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormTemplate"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/form-submissions":{"get":{"tags":["Integration · Forms"],"summary":"List form submissions","description":"Poll with `updatedSince` to collect completed forms.\n\nRequired API key scope: `submissions:read`.","operationId":"get_v1_integration_form_submissions","parameters":[{"name":"taskId","in":"query","schema":{"type":"string"},"description":"Filter by task.","required":false},{"name":"templateId","in":"query","schema":{"type":"string"},"description":"Filter by template.","required":false},{"name":"submittedBy","in":"query","schema":{"type":"string"},"description":"Filter by submitting user.","required":false},{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"submissions:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/FormSubmission"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/form-submissions/{submissionId}":{"get":{"tags":["Integration · Forms"],"summary":"Get a form submission","description":"The submission together with the template version it was completed against and any media linked to it.\n\nRequired API key scope: `submissions:read`.","operationId":"get_v1_integration_form_submissions_submissionId","parameters":[{"name":"submissionId","in":"path","schema":{"type":"string"},"description":"Submission id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"submissions:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"allOf":[{"$ref":"#/components/schemas/FormSubmission"},{"type":"object","properties":{"template":{"$ref":"#/components/schemas/FormTemplate","nullable":true},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"}}}}]},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/documents":{"get":{"tags":["Integration · Documents"],"summary":"List reference documents","description":"Required API key scope: `documents:read`.","operationId":"get_v1_integration_documents","parameters":[{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"category","in":"query","schema":{"type":"string"},"description":"Filter by category.","required":false},{"name":"q","in":"query","schema":{"type":"string"},"description":"Search title and description.","required":false},{"name":"includeDeleted","in":"query","schema":{"type":"boolean"},"description":"Include deleted documents.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Documents"],"summary":"Upload a reference document","description":"Publishes an SOP, manual or other reference document to every device in the tenant. Supply the content as a multipart `file` part, as `contentBase64`, as the `s3Key` of a presigned upload, or point at an external `fileUrl`. In multipart requests the other fields are ordinary form fields (or one `data` part containing a JSON object).\n\nRequired API key scope: `documents:write`.","operationId":"post_v1_integration_documents","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Document"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/documents/{documentId}":{"get":{"tags":["Integration · Documents"],"summary":"Get a document","description":"Required API key scope: `documents:read`.","operationId":"get_v1_integration_documents_documentId","parameters":[{"name":"documentId","in":"path","schema":{"type":"string"},"description":"Document id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Document"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"put":{"tags":["Integration · Documents"],"summary":"Create or replace a document","description":"Upsert by id. Supplying a new file replaces the content; bump `version` so devices know to re-download.\n\nRequired API key scope: `documents:write`.","operationId":"put_v1_integration_documents_documentId","parameters":[{"name":"documentId","in":"path","schema":{"type":"string"},"description":"Document id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Document"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"patch":{"tags":["Integration · Documents"],"summary":"Update a document","description":"Required API key scope: `documents:write`.","operationId":"patch_v1_integration_documents_documentId","parameters":[{"name":"documentId","in":"path","schema":{"type":"string"},"description":"Document id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Document"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"413":{"description":"Upload too large","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"delete":{"tags":["Integration · Documents"],"summary":"Delete a document","description":"Required API key scope: `documents:write`.","operationId":"delete_v1_integration_documents_documentId","parameters":[{"name":"documentId","in":"path","schema":{"type":"string"},"description":"Document id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"documents:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/conversations":{"get":{"tags":["Integration · Messaging"],"summary":"List conversations","description":"Required API key scope: `messages:read`.","operationId":"get_v1_integration_conversations","parameters":[{"name":"updatedSince","in":"query","schema":{"type":"integer","format":"int64"},"description":"Only items changed after this time (epoch ms or ISO-8601). Omit or 0 for everything.","required":false},{"name":"type","in":"query","schema":{"type":"string","enum":["ONE_TO_ONE","GROUP","TASK","CUSTOMER","THIRD_PARTY"]},"description":"Filter by type.","required":false},{"name":"taskId","in":"query","schema":{"type":"string"},"description":"Filter by task.","required":false},{"name":"participantId","in":"query","schema":{"type":"string"},"description":"Conversations this user is in.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Messaging"],"summary":"Create a conversation","description":"Required API key scope: `messages:write`.","operationId":"post_v1_integration_conversations","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationInput"},"example":{"type":"CUSTOMER","title":"Mrs Patel – 22 Church Lane","taskId":"task-demo-0003","participantIds":["user-demo-current","user-demo-0002"]}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Conversation"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"409":{"description":"Conflict with current state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/conversations/{conversationId}":{"get":{"tags":["Integration · Messaging"],"summary":"Get a conversation","description":"Required API key scope: `messages:read`.","operationId":"get_v1_integration_conversations_conversationId","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Conversation"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"patch":{"tags":["Integration · Messaging"],"summary":"Update a conversation","description":"Change the title or the participant list (send the complete new `participantIds`).\n\nRequired API key scope: `messages:write`.","operationId":"patch_v1_integration_conversations_conversationId","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Conversation"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/conversations/{conversationId}/messages":{"get":{"tags":["Integration · Messaging"],"summary":"List messages","description":"Newest first, each with per-user delivery/read receipts.\n\nRequired API key scope: `messages:read`.","operationId":"get_v1_integration_conversations_conversationId_messages","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true},{"name":"before","in":"query","schema":{"type":"integer"},"description":"Only messages sent before this time.","required":false},{"name":"after","in":"query","schema":{"type":"integer"},"description":"Only messages sent after this time.","required":false},{"name":"limit","in":"query","schema":{"type":"integer","default":50},"description":"Maximum messages (1–200).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Message"},{"type":"object","properties":{"receipts":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","description":"Recipient."},"deliveredAt":{"type":"integer","format":"int64","description":"Delivered (epoch milliseconds)","nullable":true},"readAt":{"type":"integer","format":"int64","description":"Read (epoch milliseconds)","nullable":true}}}}}}]}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}},"post":{"tags":["Integration · Messaging"],"summary":"Post a message","description":"Posts into a conversation as the integration (shown under `senderName`) or on behalf of a tenant user (`senderId`). Participants receive it in real time. Attach a file with a multipart `file` part, `contentBase64` or `s3Key`.\n\nRequired API key scope: `messages:write`.","operationId":"post_v1_integration_conversations_conversationId_messages","parameters":[{"name":"conversationId","in":"path","schema":{"type":"string"},"description":"Conversation id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"messages:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationMessageRequest"}},"multipart/form-data":{"schema":{"type":"object","description":"A `file` part plus the JSON body's other fields as plain form fields, or one `data` part containing them as a JSON object.","properties":{"file":{"type":"string","format":"binary","description":"The file content."},"data":{"type":"string","description":"Optional JSON object with the remaining fields."}}}}}},"responses":{"201":{"description":"Created (200 when an idempotent retry or an update)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Message"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/holidays":{"get":{"tags":["Integration · Holidays"],"summary":"List holidays","description":"Required API key scope: `holidays:read`.","operationId":"get_v1_integration_holidays","parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Only holidays ending on or after this day (yyyy-mm-dd).","required":false},{"name":"to","in":"query","schema":{"type":"string"},"description":"Only holidays starting on or before this day (yyyy-mm-dd).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"holidays:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Holiday"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/holidays/bulk":{"post":{"tags":["Integration · Holidays"],"summary":"Upload holidays (bulk upsert)","description":"Creates and updates staff holidays by `id`. Holidays are whole days. With `replace`, the upload is the complete list for a date range and anything else overlapping it is deleted. Re-uploading identical data changes nothing. Devices are told to sync when something changed.\n\nRequired API key scope: `holidays:write`.","operationId":"post_v1_integration_holidays_bulk","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"holidays:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkHolidayRequest"},"example":{"holidays":[{"id":"portal-holiday-881","userId":"portal-user-1042","name":"Sam Installer","startDate":"2026-12-21","endDate":"2026-12-24"}],"replace":{"from":"2026-11-30","to":"2026-12-27"}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BulkHolidayResult"},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/holidays/{holidayId}":{"delete":{"tags":["Integration · Holidays"],"summary":"Delete a holiday","description":"Required API key scope: `holidays:write`.","operationId":"delete_v1_integration_holidays_holidayId","parameters":[{"name":"holidayId","in":"path","schema":{"type":"string"},"description":"Holiday id.","required":true}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"holidays:write","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"nullable":true,"description":"Always null for this endpoint."},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/conflicts":{"get":{"tags":["Integration · Conflicts"],"summary":"List sync conflicts","description":"Required API key scope: `conflicts:read`.","operationId":"get_v1_integration_conflicts","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["OPEN","RESOLVED"]},"description":"Filter by state.","required":false},{"name":"entityType","in":"query","schema":{"type":"string","enum":["TASK","TASK_STATUS","NOTE","FORM_SUBMISSION"]},"description":"Filter by entity type.","required":false},{"name":"entityId","in":"query","schema":{"type":"string"},"description":"Filter by entity id.","required":false},{"name":"page","in":"query","schema":{"type":"integer","default":1},"description":"1-based page number.","required":false},{"name":"pageSize","in":"query","schema":{"type":"integer"},"description":"Items per page (max 500).","required":false}],"security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"conflicts:read","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Conflict"}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["success","data","error","meta"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}},"/v1/integration/conflicts/resolve":{"post":{"tags":["Integration · Conflicts"],"summary":"Resolve a conflict","description":"Required API key scope: `conflicts:write`.","operationId":"post_v1_integration_conflicts_resolve","security":[{"apiKeyHeader":[]},{"apiKeyBearer":[]}],"x-auth":"apiKey","x-scope":"conflicts:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictResolutionRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"resolved":{"type":"integer","description":"Number of conflict records closed."},"resolution":{"type":"string","enum":["KEEP_LOCAL","KEEP_SERVER","MERGE"],"description":"Resolution applied."}}},"error":{"nullable":true,"description":"Always null on success."},"meta":{"nullable":true,"description":"Always null for this endpoint."}},"required":["success","data","error","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}},"422":{"description":"Refers to something that does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"data":{"nullable":true,"description":"Null, except for 409 CONFLICT where it holds the server's current entity."},"error":{"$ref":"#/components/schemas/Error"},"meta":{"nullable":true}},"required":["success","error"]}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable error code, e.g. VALIDATION_ERROR, UNAUTHORIZED, NOT_FOUND, CONFLICT."},"message":{"type":"string","description":"Human-readable explanation."},"details":{"type":"object","additionalProperties":{"type":"string"},"description":"Extra context; values are always strings. Validation errors include `field`.","nullable":true}},"required":["code","message"]},"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer","description":"1-based page number."},"pageSize":{"type":"integer","description":"Items per page."},"total":{"type":"integer","description":"Total matching items."},"hasMore":{"type":"boolean","description":"Whether a further page exists."}},"required":["page","pageSize","total","hasMore"]},"Tenant":{"type":"object","properties":{"id":{"type":"string","description":"Tenant id."},"name":{"type":"string","description":"Organisation name."},"slug":{"type":"string","description":"URL-safe identifier users type at sign-in."},"logoUrl":{"type":"string","description":"Logo image URL.","nullable":true},"primaryColorHex":{"type":"string","description":"Brand colour, e.g. #00695C.","nullable":true},"accentColorHex":{"type":"string","description":"Accent colour.","nullable":true},"features":{"type":"array","items":{"type":"string"},"description":"Enabled feature flags, e.g. forms, messaging, documents, camera."},"config":{"type":"object","additionalProperties":true,"description":"Tenant configuration. `technicianTaskVisibility`: \"ASSIGNED\" (default) or \"ALL\" controls whether technicians receive only their own tasks or the whole tenant schedule."},"isActive":{"type":"boolean","description":"Inactive tenants cannot sign in."},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"User":{"type":"object","properties":{"id":{"type":"string","description":"User id."},"tenantId":{"type":"string","description":"Owning tenant."},"email":{"type":"string","description":"Sign-in email, unique within the tenant."},"name":{"type":"string","description":"Display name."},"avatarUrl":{"type":"string","description":"Avatar image URL.","nullable":true},"phone":{"type":"string","description":"Phone number.","nullable":true},"role":{"type":"string","enum":["TECHNICIAN","SUPERVISOR","ADMIN"],"description":"Role. SUPERVISOR and ADMIN see every task in the tenant and may resolve conflicts."},"permissions":{"type":"array","items":{"type":"string"},"description":"Additional permission strings. `conflicts.resolve` lets a technician resolve conflicts."},"isActive":{"type":"boolean","description":"Inactive users cannot sign in."},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"UserInput":{"type":"object","properties":{"id":{"type":"string","description":"Optional id to assign (otherwise a UUID is generated). Create only."},"email":{"type":"string","description":"Sign-in email."},"name":{"type":"string","description":"Display name."},"password":{"type":"string","description":"Password, at least 8 characters. Omit to create a user who cannot sign in yet."},"passwordHash":{"type":"string","description":"Alternative to `password`: a bcrypt hash ($2a$/$2b$/$2y$, e.g. from PHP password_hash or Laravel) copied from the system that owns the user's password, so they sign in here with the same password. Never returned by the API."},"role":{"type":"string","enum":["TECHNICIAN","SUPERVISOR","ADMIN"],"description":"Defaults to TECHNICIAN."},"permissions":{"type":"array","items":{"type":"string"},"description":"Additional permission strings."},"avatarUrl":{"type":"string","description":"Avatar image URL.","nullable":true},"phone":{"type":"string","description":"Phone number.","nullable":true},"isActive":{"type":"boolean","description":"Set false to deactivate (also ends the user's sessions)."}}},"DirectoryUser":{"type":"object","properties":{"id":{"type":"string","description":"User id."},"name":{"type":"string","description":"Display name."},"role":{"type":"string","enum":["TECHNICIAN","SUPERVISOR","ADMIN"],"description":"Role."},"avatarUrl":{"type":"string","description":"Avatar image URL.","nullable":true}}},"LoginRequest":{"type":"object","properties":{"email":{"type":"string","description":"User email."},"password":{"type":"string","description":"User password."},"tenantSlug":{"type":"string","description":"Slug of the organisation to sign in to."},"deviceId":{"type":"string","description":"Stable identifier of the device/app install."}},"required":["email","password","tenantSlug"]},"AuthTokens":{"type":"object","properties":{"accessToken":{"type":"string","description":"Bearer token for the Authorization header."},"refreshToken":{"type":"string","description":"Single-use token for POST /auth/refresh."},"expiresAt":{"type":"integer","format":"int64","description":"When the access token expires (epoch milliseconds)"},"user":{"$ref":"#/components/schemas/User"},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["accessToken","refreshToken","expiresAt","user","tenant"]},"TaskNote":{"type":"object","properties":{"id":{"type":"string","description":"Note id."},"timestamp":{"type":"integer","format":"int64","description":"When the note was written (epoch milliseconds)"},"authorId":{"type":"string","description":"User id of the author, if a user.","nullable":true},"authorName":{"type":"string","description":"Display name of the author."},"text":{"type":"string","description":"Note text."}}},"Task":{"type":"object","properties":{"id":{"type":"string","description":"Task id (unique within the tenant)."},"tenantId":{"type":"string","description":"Owning tenant."},"title":{"type":"string","description":"Short title shown on the schedule card."},"description":{"type":"string","description":"Full job description.","nullable":true},"taskType":{"type":"string","description":"Free-form job type, e.g. BOILER_SERVICE. Matched against form templates' applicableTaskTypes and documents' linkedTaskTypes.","nullable":true},"status":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETED","CANCELLED"],"description":"Current status."},"priority":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"],"description":"Priority."},"slaStatus":{"type":"string","enum":["OK","AT_RISK","BREACHED"],"description":"SLA state.","nullable":true},"scheduledStart":{"type":"integer","format":"int64","description":"Scheduled start; determines the schedule day (epoch milliseconds)","nullable":true},"scheduledEnd":{"type":"integer","format":"int64","description":"Scheduled end (epoch milliseconds)","nullable":true},"dueAt":{"type":"integer","format":"int64","description":"Due time (epoch milliseconds)","nullable":true},"slaBreachAt":{"type":"integer","format":"int64","description":"When the SLA is breached (epoch milliseconds)","nullable":true},"completedAt":{"type":"integer","format":"int64","description":"When the task was completed (epoch milliseconds)","nullable":true},"locationId":{"type":"string","description":"Your identifier for the site.","nullable":true},"locationName":{"type":"string","description":"Site name.","nullable":true},"locationAddress":{"type":"string","description":"Site address.","nullable":true},"locationLat":{"type":"number","description":"Latitude.","nullable":true},"locationLng":{"type":"number","description":"Longitude.","nullable":true},"assetId":{"type":"string","description":"Your identifier for the asset/equipment.","nullable":true},"assetName":{"type":"string","description":"Asset name.","nullable":true},"assetCode":{"type":"string","description":"Asset tag / code.","nullable":true},"assignedUserIds":{"type":"array","items":{"type":"string"},"description":"Ids of the users the task is assigned to."},"thirdPartyRefId":{"type":"string","description":"Reference in the originating system, e.g. a work-order number.","nullable":true},"externalSystemName":{"type":"string","description":"Name of the originating system.","nullable":true},"externalSystemUrl":{"type":"string","description":"Deep link to the job in the originating system.","nullable":true},"notes":{"type":"string","description":"All notes rendered as plain text (\"Author: text\" per line). Read-only; see noteList.","nullable":true},"noteList":{"type":"array","items":{"$ref":"#/components/schemas/TaskNote"},"description":"Structured notes, oldest first. Read-only; add notes via the notes endpoints."},"formTemplateIds":{"type":"array","items":{"type":"string"},"description":"Form templates to be completed for this task."},"tags":{"type":"array","items":{"type":"string"},"description":"Free-form tags."},"headerImageUrl":{"type":"string","description":"Image shown at the top of the task screen.","nullable":true},"cancellationReason":{"type":"string","description":"Why the task was cancelled.","nullable":true},"version":{"type":"integer","description":"Increments on every change. Devices echo it as clientVersion.","format":"int64"},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"},"deletedAt":{"type":"integer","format":"int64","description":"When the task was deleted (only visible with includeDeleted) (epoch milliseconds)","nullable":true}}},"TaskHistoryEvent":{"type":"object","properties":{"id":{"type":"integer","description":"Event id."},"taskId":{"type":"string","description":"Task id."},"eventType":{"type":"string","enum":["CREATED","UPDATED","STATUS_CHANGED","NOTE_ADDED","MEDIA_ADDED","MEDIA_REMOVED","FORM_SUBMITTED","CONFLICT_RESOLVED","DELETED","RESTORED"],"description":"What happened."},"actorType":{"type":"string","enum":["USER","API_KEY","ADMIN"],"description":"Kind of caller that made the change."},"actorId":{"type":"string","description":"User id, API key id or admin username.","nullable":true},"actorName":{"type":"string","description":"Display name of the actor.","nullable":true},"details":{"type":"object","additionalProperties":true,"description":"Event-specific details, e.g. { from, to } for STATUS_CHANGED or { changes } for UPDATED."},"createdAt":{"type":"integer","format":"int64","description":"When it happened (epoch milliseconds)"}}},"TaskStatusUpdateRequest":{"type":"object","properties":{"taskId":{"type":"string","description":"Must equal the id in the URL when present."},"status":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETED","CANCELLED"],"description":"New status."},"notes":{"type":"string","description":"Optional note to add alongside the status change.","nullable":true},"cancellationReason":{"type":"string","description":"Reason, when status is CANCELLED.","nullable":true},"completedAt":{"type":"integer","format":"int64","description":"Completion time, when status is COMPLETED (defaults to now) (epoch milliseconds)","nullable":true},"clientVersion":{"type":"integer","description":"The task version the device last synced. Used for conflict detection.","format":"int64"}},"required":["status"]},"FormField":{"type":"object","properties":{"id":{"type":"string","description":"Field id, unique within the template. Keys of fieldValues in submissions."},"type":{"type":"string","enum":["text","textarea","email","url","number","reading","date","datetime","select","multi_select","checkbox","pass_fail","signature","photo","video","gps"],"description":"Field type."},"label":{"type":"string","description":"Label shown to the technician."},"required":{"type":"boolean","description":"Whether a value is mandatory."},"placeholder":{"type":"string","description":"Placeholder text."},"helpText":{"type":"string","description":"Help text shown under the field."},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Stored value."},"label":{"type":"string","description":"Displayed label."}},"required":["value"]},"description":"Choices for select / multi_select."},"validationMin":{"type":"number","description":"Minimum for number / reading fields."},"validationMax":{"type":"number","description":"Maximum for number / reading fields."},"unit":{"type":"string","description":"Unit for reading fields, e.g. kWh."},"sectionId":{"type":"string","description":"Id of the section this field belongs to."},"conditionalVisibility":{"type":"object","description":"Show this field only when the condition holds.","properties":{"fieldId":{"type":"string","description":"Field whose value is tested."},"operator":{"type":"string","enum":["eq","neq"],"description":"Comparison."},"value":{"type":"string","description":"Value compared against."}}},"repeatable":{"type":"boolean","description":"Whether the field may be repeated."},"order":{"type":"integer","description":"Display order."}},"required":["id","type","label"]},"FormTemplate":{"type":"object","properties":{"id":{"type":"string","description":"Template id (unique within the tenant)."},"tenantId":{"type":"string","description":"Owning tenant."},"name":{"type":"string","description":"Form name."},"description":{"type":"string","description":"Description.","nullable":true},"version":{"type":"integer","description":"Version number. Every change publishes a new version."},"fields":{"type":"array","items":{"$ref":"#/components/schemas/FormField"},"description":"Field definitions."},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Section id."},"title":{"type":"string","description":"Heading."},"description":{"type":"string","description":"Intro text."},"order":{"type":"integer","description":"Display order."}},"required":["id","title"]},"description":"Section definitions."},"applicableTaskTypes":{"type":"array","items":{"type":"string"},"description":"Task types this form applies to."},"category":{"type":"string","description":"E.g. INSPECTION, STARTUP_CHECK, FAULT_REPORT.","nullable":true},"isStartupCheck":{"type":"boolean","description":"Whether this is a start-of-day check form."},"isActive":{"type":"boolean","description":"Inactive templates are no longer offered on devices."},"createdAt":{"type":"integer","format":"int64","description":"When this version was published (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"When this version was published (epoch milliseconds)"}}},"FormTemplateInput":{"type":"object","properties":{"id":{"type":"string","description":"Optional id to assign (create via POST only)."},"name":{"type":"string","description":"Form name. Required when creating."},"description":{"type":"string","description":"Description.","nullable":true},"fields":{"type":"array","items":{"$ref":"#/components/schemas/FormField"},"description":"Field definitions. Required when creating."},"sections":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"Section { id, title, description?, order? }."},"description":"Section definitions."},"applicableTaskTypes":{"type":"array","items":{"type":"string"},"description":"Task types this form applies to."},"category":{"type":"string","description":"Category.","nullable":true},"isStartupCheck":{"type":"boolean","description":"Start-of-day check form."},"isActive":{"type":"boolean","description":"Set false to retire the form."}}},"FormSubmissionRequest":{"type":"object","properties":{"id":{"type":"string","description":"Client-generated submission id (UUID). Makes retries idempotent."},"taskId":{"type":"string","description":"Task the form was completed for."},"templateId":{"type":"string","description":"Template id."},"templateVersion":{"type":"integer","description":"Template version the form was rendered from."},"fieldValues":{"type":"object","additionalProperties":true,"description":"Map of field id → value. Text/select: string; number/reading: number; multi_select: string[]; checkbox: boolean; pass_fail: \"pass\" | \"fail\" | \"na\"; gps: { lat, lng }; signature: JSON string of strokes [[{x,y}…]…] with coordinates normalised 0–1; photo/video: a media reference."},"submittedAt":{"type":"integer","format":"int64","description":"When the technician submitted the form (epoch milliseconds)"}},"required":["id","taskId","templateId","templateVersion","fieldValues"]},"FormSubmissionReceipt":{"type":"object","properties":{"id":{"type":"string","description":"Submission id."},"status":{"type":"string","enum":["SUBMITTED"],"description":"Always SUBMITTED."},"version":{"type":"integer","description":"Server version of the submission."},"receivedAt":{"type":"integer","format":"int64","description":"When the server first stored it (epoch milliseconds)"},"duplicate":{"type":"boolean","description":"True when this was a retry of an already stored submission."}}},"FormSubmission":{"type":"object","properties":{"id":{"type":"string","description":"Submission id."},"tenantId":{"type":"string","description":"Owning tenant."},"taskId":{"type":"string","description":"Task id."},"templateId":{"type":"string","description":"Template id."},"templateVersion":{"type":"integer","description":"Template version used."},"fieldValues":{"type":"object","additionalProperties":true,"description":"Map of field id → submitted value."},"submittedBy":{"type":"string","description":"User id of the submitter.","nullable":true},"submittedByName":{"type":"string","description":"Display name of the submitter.","nullable":true},"submittedAt":{"type":"integer","format":"int64","description":"When the technician submitted it (epoch milliseconds)"},"version":{"type":"integer","description":"Increments if the submission is changed by conflict resolution."},"createdAt":{"type":"integer","format":"int64","description":"When the server received it (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"PresignedUrlRequest":{"type":"object","properties":{"filename":{"type":"string","description":"Original file name."},"mimeType":{"type":"string","description":"MIME type, e.g. image/jpeg."},"sizeBytes":{"type":"integer","description":"File size in bytes.","format":"int64"},"tenantId":{"type":"string","description":"Must match the authenticated tenant when sent."},"context":{"type":"string","enum":["task","message","form","document","avatar","other"],"description":"What the file is for. Defaults to task."},"taskId":{"type":"string","description":"Optional: task to attach the media to on confirm."},"formSubmissionId":{"type":"string","description":"Optional: form submission the media belongs to."},"messageId":{"type":"string","description":"Optional: message the media belongs to."},"mediaType":{"type":"string","enum":["PHOTO","VIDEO","DOCUMENT"],"description":"Optional: defaults from the MIME type."},"capturedLat":{"type":"number","description":"Optional: latitude where the media was captured."},"capturedLng":{"type":"number","description":"Optional: longitude where the media was captured."},"metadata":{"type":"object","additionalProperties":true,"description":"Optional: free-form metadata stored with the media."}},"required":["filename","mimeType"]},"PresignedUrlResponse":{"type":"object","properties":{"uploadUrl":{"type":"string","description":"PUT the raw file bytes here. No Authorization header is needed; the URL is signed."},"s3Key":{"type":"string","description":"Object key identifying the file. Pass it to confirm-upload / messages."},"cdnUrl":{"type":"string","description":"URL the file will be readable at once uploaded."},"expiresAt":{"type":"integer","format":"int64","description":"When the upload URL stops working (epoch milliseconds)"}},"required":["uploadUrl","s3Key","cdnUrl","expiresAt"]},"MediaUploadConfirmRequest":{"type":"object","properties":{"mediaId":{"type":"string","description":"Client-generated id of the media attachment. Makes retries idempotent."},"s3Key":{"type":"string","description":"Key returned by presigned-url."},"cdnUrl":{"type":"string","description":"cdnUrl returned by presigned-url (informational)."},"taskId":{"type":"string","description":"Optional: task to attach to (overrides the value given at presign)."},"formSubmissionId":{"type":"string","description":"Optional: form submission to attach to."},"messageId":{"type":"string","description":"Optional: message to attach to."},"mediaType":{"type":"string","enum":["PHOTO","VIDEO","DOCUMENT"],"description":"Optional."},"capturedLat":{"type":"number","description":"Optional."},"capturedLng":{"type":"number","description":"Optional."},"metadata":{"type":"object","additionalProperties":true,"description":"Optional."}},"required":["mediaId","s3Key"]},"Media":{"type":"object","properties":{"id":{"type":"string","description":"Media id."},"tenantId":{"type":"string","description":"Owning tenant."},"taskId":{"type":"string","description":"Task it is attached to.","nullable":true},"formSubmissionId":{"type":"string","description":"Form submission it belongs to.","nullable":true},"messageId":{"type":"string","description":"Message it belongs to.","nullable":true},"mediaType":{"type":"string","enum":["PHOTO","VIDEO","DOCUMENT"],"description":"Kind of media."},"url":{"type":"string","description":"Download URL."},"s3Key":{"type":"string","description":"Object key of the stored file.","nullable":true},"filename":{"type":"string","description":"File name."},"mimeType":{"type":"string","description":"MIME type."},"sizeBytes":{"type":"integer","description":"Size in bytes.","format":"int64"},"capturedLat":{"type":"number","description":"Capture latitude.","nullable":true},"capturedLng":{"type":"number","description":"Capture longitude.","nullable":true},"metadata":{"type":"object","additionalProperties":true,"description":"Free-form metadata."},"source":{"type":"string","enum":["APP","INTEGRATION"],"description":"Who added it."},"declared":{"type":"boolean","description":"True when the attachment came from a task's `attachments` list (see TaskInput) and is managed by it."},"createdByType":{"type":"string","description":"USER or API_KEY."},"createdById":{"type":"string","description":"User id or API key id.","nullable":true},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"StoredFile":{"type":"object","properties":{"s3Key":{"type":"string","description":"Object key."},"externalId":{"type":"string","description":"The caller's own id for this content, if one was given at upload.","nullable":true},"url":{"type":"string","description":"Download URL."},"filename":{"type":"string","description":"File name."},"mimeType":{"type":"string","description":"MIME type."},"sizeBytes":{"type":"integer","description":"Size in bytes.","format":"int64"},"sha256":{"type":"string","description":"SHA-256 of the content (hex)."},"context":{"type":"string","enum":["task","message","form","document","avatar","other"],"description":"What the file is for."},"status":{"type":"string","enum":["PENDING","UPLOADED"],"description":"Upload state."},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"uploadedAt":{"type":"integer","format":"int64","description":"Upload completed (epoch milliseconds)","nullable":true}}},"FileUploadJson":{"type":"object","properties":{"filename":{"type":"string","description":"File name."},"mimeType":{"type":"string","description":"MIME type. Defaults to application/octet-stream."},"contentBase64":{"type":"string","description":"File content, base64 encoded (up to about 25 MB; use multipart or a presigned URL for larger files)."},"s3Key":{"type":"string","description":"Alternative to contentBase64: key of a file already uploaded through a presigned URL."}}},"DeclaredAttachment":{"type":"object","description":"One attachment of a task, referring to a file that is already uploaded.","properties":{"fileExternalId":{"type":"string","description":"The `externalId` the file was uploaded with (`POST /v1/integration/files`). Give this or `s3Key`."},"s3Key":{"type":"string","description":"Key of an uploaded file. Give this or `fileExternalId`."},"id":{"type":"string","description":"Optional attachment id. By default one is derived from the task id and the file, so repeats are stable."},"filename":{"type":"string","description":"Name shown in the app. Defaults to the uploaded file's name."},"mediaType":{"type":"string","enum":["PHOTO","VIDEO","DOCUMENT"],"description":"Defaults from the file's MIME type."},"metadata":{"type":"object","additionalProperties":true,"description":"Free-form metadata, e.g. { \"tags\": [\"base\"] }."}}},"FileLookupRequest":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"},"description":"Up to 2000 external ids to check."}},"required":["externalIds"]},"FileLookupResult":{"type":"object","properties":{"files":{"type":"array","items":{"$ref":"#/components/schemas/StoredFile"},"description":"The files that are stored (fully uploaded) under the given ids."},"missingExternalIds":{"type":"array","items":{"type":"string"},"description":"The ids with no stored file — upload these."}}},"Holiday":{"type":"object","properties":{"id":{"type":"string","description":"Holiday id (yours)."},"tenantId":{"type":"string","description":"Owning tenant."},"userId":{"type":"string","description":"The user who is away, when they have an account here.","nullable":true},"name":{"type":"string","description":"Name of the person who is away."},"startDate":{"type":"string","description":"First day off, yyyy-mm-dd."},"endDate":{"type":"string","description":"Last day off (inclusive), yyyy-mm-dd."},"notes":{"type":"string","description":"Optional note.","nullable":true},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"HolidayInput":{"type":"object","properties":{"id":{"type":"string","description":"Your id for the holiday."},"userId":{"type":"string","description":"User who is away. Must exist in the tenant if given.","nullable":true},"name":{"type":"string","description":"Name of the person who is away."},"startDate":{"type":"string","description":"First day off, yyyy-mm-dd."},"endDate":{"type":"string","description":"Last day off (inclusive), yyyy-mm-dd."},"notes":{"type":"string","description":"Optional note.","nullable":true}},"required":["id","name","startDate","endDate"]},"BulkHolidayRequest":{"type":"object","properties":{"holidays":{"type":"array","items":{"$ref":"#/components/schemas/HolidayInput"},"description":"Up to 5000 holidays to create or update, matched by `id`. May be empty when `replace` is given."},"replace":{"type":"object","description":"Optional. Declares that `holidays` is the complete list for a date range: any other holiday overlapping the range is deleted. Ignored if any item fails.","properties":{"from":{"type":"string","description":"First day of the range, yyyy-mm-dd."},"to":{"type":"string","description":"Last day of the range (inclusive), yyyy-mm-dd."}},"required":["from","to"]}},"required":["holidays"]},"BulkHolidayResult":{"type":"object","properties":{"summary":{"type":"object","properties":{"created":{"type":"integer","description":"Holidays created."},"updated":{"type":"integer","description":"Holidays changed."},"unchanged":{"type":"integer","description":"Already up to date."},"error":{"type":"integer","description":"Items rejected."},"deleted":{"type":"integer","description":"Removed by `replace`."}}},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position in the uploaded array."},"id":{"type":"string","description":"Holiday id.","nullable":true},"outcome":{"type":"string","enum":["created","updated","unchanged","error"],"description":"What happened to the item."},"error":{"type":"object","properties":{"code":{"type":"string","description":"Error code."},"message":{"type":"string","description":"Explanation."}}}}},"description":"One entry per uploaded holiday, in order."},"deletedHolidayIds":{"type":"array","items":{"type":"string"},"description":"Holidays removed by `replace`."},"replaceApplied":{"type":"boolean","description":"Whether the `replace` range was applied."}}},"BulkUserRequest":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/UserInput"},"description":"1–1000 users to create or update. `id` is required on each."},"deactivateMissingIdPrefix":{"type":"string","description":"Optional, at least 3 characters. Declares that `users` is the complete list of users whose id starts with this prefix: any other active user with the prefix is deactivated and signed out. Ignored if any item fails. Users without the prefix are never touched."}},"required":["users"]},"BulkUserResult":{"type":"object","properties":{"summary":{"type":"object","properties":{"created":{"type":"integer","description":"Users created."},"updated":{"type":"integer","description":"Users changed."},"unchanged":{"type":"integer","description":"Already up to date."},"error":{"type":"integer","description":"Items rejected."},"deactivated":{"type":"integer","description":"Users deactivated by `deactivateMissingIdPrefix`."}}},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position in the uploaded array."},"id":{"type":"string","description":"User id.","nullable":true},"outcome":{"type":"string","enum":["created","updated","unchanged","error"],"description":"What happened to the item."},"error":{"type":"object","properties":{"code":{"type":"string","description":"Error code."},"message":{"type":"string","description":"Explanation."}}}}},"description":"One entry per uploaded user, in order."},"deactivatedUserIds":{"type":"array","items":{"type":"string"},"description":"Users deactivated by `deactivateMissingIdPrefix`."},"deactivationApplied":{"type":"boolean","description":"Whether `deactivateMissingIdPrefix` was applied."}}},"Document":{"type":"object","properties":{"id":{"type":"string","description":"Document id."},"tenantId":{"type":"string","description":"Owning tenant."},"title":{"type":"string","description":"Title."},"description":{"type":"string","description":"Description.","nullable":true},"category":{"type":"string","description":"E.g. SOP, MANUAL, SAFETY, CHECKLIST.","nullable":true},"fileUrl":{"type":"string","description":"Where the app downloads the document from."},"mimeType":{"type":"string","description":"MIME type."},"sizeBytes":{"type":"integer","description":"Size in bytes.","format":"int64"},"version":{"type":"string","description":"Document version label, e.g. \"3.2\"."},"tags":{"type":"array","items":{"type":"string"},"description":"Search tags."},"linkedTaskTypes":{"type":"array","items":{"type":"string"},"description":"Task types the document is relevant to."},"linkedAssetTypes":{"type":"array","items":{"type":"string"},"description":"Asset types the document is relevant to."},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"},"deletedAt":{"type":"integer","format":"int64","description":"Deleted (epoch milliseconds)","nullable":true}}},"DocumentInput":{"type":"object","properties":{"id":{"type":"string","description":"Optional id to assign (create via POST only)."},"title":{"type":"string","description":"Title. Required when creating."},"description":{"type":"string","description":"Description.","nullable":true},"category":{"type":"string","description":"Category.","nullable":true},"version":{"type":"string","description":"Version label. Defaults to \"1.0\"."},"tags":{"type":"array","items":{"type":"string"},"description":"Search tags (comma-separated text in multipart requests)."},"linkedTaskTypes":{"type":"array","items":{"type":"string"},"description":"Relevant task types."},"linkedAssetTypes":{"type":"array","items":{"type":"string"},"description":"Relevant asset types."},"fileUrl":{"type":"string","description":"External http(s) URL of the document — use this OR supply the file itself."},"mimeType":{"type":"string","description":"MIME type (taken from the upload when a file is supplied)."},"sizeBytes":{"type":"integer","description":"Size (taken from the upload when a file is supplied)."},"filename":{"type":"string","description":"File name, with contentBase64."},"contentBase64":{"type":"string","description":"File content, base64 encoded."},"s3Key":{"type":"string","description":"Key of a file already uploaded through a presigned URL."}}},"Conversation":{"type":"object","properties":{"id":{"type":"string","description":"Conversation id."},"tenantId":{"type":"string","description":"Owning tenant."},"type":{"type":"string","enum":["ONE_TO_ONE","GROUP","TASK","CUSTOMER","THIRD_PARTY"],"description":"Kind of conversation."},"title":{"type":"string","description":"Title.","nullable":true},"description":{"type":"string","description":"Description.","nullable":true},"avatarUrl":{"type":"string","description":"Avatar image URL.","nullable":true},"taskId":{"type":"string","description":"Related task (type TASK).","nullable":true},"participantIds":{"type":"array","items":{"type":"string"},"description":"User ids of the participants."},"lastMessageId":{"type":"string","description":"Id of the newest message.","nullable":true},"lastMessagePreview":{"type":"string","description":"Preview text of the newest message.","nullable":true},"lastMessageAt":{"type":"integer","format":"int64","description":"Time of the newest message (epoch milliseconds)","nullable":true},"lastMessageSenderId":{"type":"string","description":"Sender of the newest message.","nullable":true},"unreadCount":{"type":"integer","description":"Messages the calling user has not read (app endpoints only)."},"createdAt":{"type":"integer","format":"int64","description":"Created (epoch milliseconds)"},"updatedAt":{"type":"integer","format":"int64","description":"Last changed (epoch milliseconds)"}}},"ConversationInput":{"type":"object","properties":{"id":{"type":"string","description":"Optional id to assign (create only)."},"type":{"type":"string","enum":["ONE_TO_ONE","GROUP","TASK","CUSTOMER","THIRD_PARTY"],"description":"Defaults to TASK when taskId is given, otherwise GROUP."},"title":{"type":"string","description":"Title.","nullable":true},"description":{"type":"string","description":"Description.","nullable":true},"avatarUrl":{"type":"string","description":"Avatar image URL.","nullable":true},"taskId":{"type":"string","description":"Related task.","nullable":true},"participantIds":{"type":"array","items":{"type":"string"},"description":"User ids of the participants. Required when creating."}}},"Message":{"type":"object","properties":{"id":{"type":"string","description":"Server message id."},"tenantId":{"type":"string","description":"Owning tenant."},"conversationId":{"type":"string","description":"Conversation id."},"senderId":{"type":"string","description":"User id, or \"integration:<apiKeyId>\" for messages posted by an integration."},"senderName":{"type":"string","description":"Display name of the sender."},"senderAvatarUrl":{"type":"string","description":"Sender avatar.","nullable":true},"type":{"type":"string","enum":["TEXT","IMAGE","VIDEO","FILE","SYSTEM"],"description":"Message type."},"content":{"type":"string","description":"Text body.","nullable":true},"mediaUrl":{"type":"string","description":"Download URL of the attachment.","nullable":true},"s3Key":{"type":"string","description":"Object key of the attachment.","nullable":true},"replyToId":{"type":"string","description":"Id of the message being replied to.","nullable":true},"localId":{"type":"string","description":"Client-generated id supplied by the sender.","nullable":true},"sentAt":{"type":"integer","format":"int64","description":"When the sender sent it (epoch milliseconds)"},"isDeleted":{"type":"boolean","description":"Whether the message was deleted."}}},"SendMessageRequest":{"type":"object","properties":{"localId":{"type":"string","description":"Client-generated id. Re-sending the same localId returns the original message."},"conversationId":{"type":"string","description":"Conversation to post to."},"type":{"type":"string","enum":["TEXT","IMAGE","VIDEO","FILE","SYSTEM"],"description":"Defaults to TEXT."},"content":{"type":"string","description":"Text body. Required unless s3Key is given.","nullable":true},"s3Key":{"type":"string","description":"Key of an uploaded attachment (see presigned-url).","nullable":true},"replyToId":{"type":"string","description":"Id of the message being replied to.","nullable":true},"sentAt":{"type":"integer","format":"int64","description":"When the user pressed send (epoch milliseconds)"}},"required":["conversationId"]},"IntegrationMessageRequest":{"type":"object","properties":{"content":{"type":"string","description":"Text body. Required unless a file is supplied."},"type":{"type":"string","enum":["TEXT","IMAGE","VIDEO","FILE","SYSTEM"],"description":"Defaults to TEXT, or IMAGE / VIDEO / FILE from the attachment."},"senderId":{"type":"string","description":"Post as this tenant user. Omit to post as the integration."},"senderName":{"type":"string","description":"Display name when posting as the integration (defaults to the API key name)."},"externalId":{"type":"string","description":"Your id for the message; makes retries idempotent."},"replyToId":{"type":"string","description":"Id of the message being replied to."},"sentAt":{"type":"integer","format":"int64","description":"Original send time (epoch milliseconds)"},"filename":{"type":"string","description":"Attachment file name, with contentBase64."},"mimeType":{"type":"string","description":"Attachment MIME type."},"contentBase64":{"type":"string","description":"Attachment content, base64 encoded."},"s3Key":{"type":"string","description":"Key of an attachment already uploaded through a presigned URL."}}},"SyncManifest":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"},"description":"Tasks visible to the user that changed since `since`."},"formTemplates":{"type":"array","items":{"$ref":"#/components/schemas/FormTemplate"},"description":"Latest version of each template that changed since `since`."},"documents":{"type":"array","items":{"$ref":"#/components/schemas/Document"},"description":"Documents that changed since `since`."},"conversations":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"},"description":"The user's conversations that changed since `since`."},"serverTime":{"type":"integer","format":"int64","description":"Server clock when the manifest was built — pass as `since` next time (epoch milliseconds)"},"removedTaskIds":{"type":"array","items":{"type":"string"},"description":"Tasks to drop locally: deleted, or no longer assigned to the user. Empty when since=0."},"removedDocumentIds":{"type":"array","items":{"type":"string"},"description":"Documents deleted since `since`. Empty when since=0."},"users":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryUser"},"description":"Active users of the tenant (for names, avatars and the schedule person filter)."},"media":{"type":"array","items":{"$ref":"#/components/schemas/Media"},"description":"Attachments of the returned tasks (includes files added by integrations)."},"holidays":{"type":"array","items":{"$ref":"#/components/schemas/Holiday"},"description":"Every staff holiday that has not ended more than a week ago (the full list each time, not only changes)."}},"required":["tasks","formTemplates","documents","conversations","serverTime"]},"ConflictResolutionRequest":{"type":"object","properties":{"entityType":{"type":"string","enum":["TASK","TASK_STATUS","NOTE","FORM_SUBMISSION"],"description":"Kind of entity in conflict."},"entityId":{"type":"string","description":"Task id or form submission id."},"resolution":{"type":"string","enum":["KEEP_LOCAL","KEEP_SERVER","MERGE"],"description":"KEEP_SERVER discards the device change; KEEP_LOCAL applies it; MERGE applies mergedPayload."},"mergedPayload":{"type":"object","additionalProperties":true,"description":"Required for MERGE. Task conflicts: task fields such as { status, cancellationReason }. Form conflicts: { fieldValues }.","nullable":true}},"required":["entityType","entityId","resolution"]},"Conflict":{"type":"object","properties":{"id":{"type":"integer","description":"Conflict id."},"tenantId":{"type":"string","description":"Owning tenant."},"entityType":{"type":"string","enum":["TASK","TASK_STATUS","NOTE","FORM_SUBMISSION"],"description":"Kind of entity."},"entityId":{"type":"string","description":"Task id or form submission id."},"reason":{"type":"string","description":"Why the change could not be merged automatically."},"clientPayload":{"type":"object","additionalProperties":true,"description":"The change the device tried to make."},"serverState":{"type":"object","additionalProperties":true,"description":"The server's state at the time."},"status":{"type":"string","enum":["OPEN","RESOLVED"],"description":"State."},"resolution":{"type":"string","enum":["KEEP_LOCAL","KEEP_SERVER","MERGE"],"description":"How it was resolved.","nullable":true},"mergedPayload":{"type":"object","additionalProperties":true,"description":"Payload applied for MERGE.","nullable":true},"raisedBy":{"type":"string","description":"User id whose device raised it.","nullable":true},"resolvedBy":{"type":"string","description":"Who resolved it (\"USER:<id>\", \"API_KEY:<id>\" or \"ADMIN:<name>\").","nullable":true},"createdAt":{"type":"integer","format":"int64","description":"Raised (epoch milliseconds)"},"resolvedAt":{"type":"integer","format":"int64","description":"Resolved (epoch milliseconds)","nullable":true}}},"BulkTaskRequest":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/TaskInput"},"description":"1–1000 tasks to create or update."},"replace":{"type":"object","description":"Optional. Declares that `tasks` is the complete schedule for a time window: any other task whose scheduledStart falls in the window is deleted. Ignored if any item fails.","properties":{"from":{"type":"integer","format":"int64","description":"Start of the window (inclusive) (epoch milliseconds)"},"to":{"type":"integer","format":"int64","description":"End of the window (exclusive) (epoch milliseconds)"},"externalSystemName":{"type":"string","description":"Only remove tasks that came from this system."}},"required":["from","to"]}},"required":["tasks"]},"BulkTaskResult":{"type":"object","properties":{"summary":{"type":"object","properties":{"created":{"type":"integer","description":"Tasks created."},"updated":{"type":"integer","description":"Tasks changed."},"unchanged":{"type":"integer","description":"Tasks already up to date."},"error":{"type":"integer","description":"Items rejected."},"deleted":{"type":"integer","description":"Tasks removed by `replace`."}}},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position in the uploaded array."},"id":{"type":"string","description":"Task id.","nullable":true},"thirdPartyRefId":{"type":"string","description":"Your reference.","nullable":true},"outcome":{"type":"string","enum":["created","updated","unchanged","error"],"description":"What happened to the item."},"version":{"type":"integer","description":"Task version after the upload."},"error":{"type":"object","properties":{"code":{"type":"string","description":"Error code."},"message":{"type":"string","description":"Explanation."}}}}},"description":"One entry per uploaded task, in order."},"deletedTaskIds":{"type":"array","items":{"type":"string"},"description":"Tasks removed by `replace`."},"replaceApplied":{"type":"boolean","description":"Whether the `replace` window was applied."}}},"TaskInput":{"type":"object","description":"Writable task fields. `title` is required when creating. Timestamps accept epoch milliseconds or ISO-8601 strings. In bulk uploads `id` is optional: without it the task is matched on thirdPartyRefId (+ externalSystemName), else created.","properties":{"id":{"type":"string","description":"Task id. Optional on create (a UUID is generated)."},"title":{"type":"string","description":"Short title shown on the schedule card."},"description":{"type":"string","description":"Full job description.","nullable":true},"taskType":{"type":"string","description":"Free-form job type, e.g. BOILER_SERVICE. Matched against form templates' applicableTaskTypes and documents' linkedTaskTypes.","nullable":true},"status":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETED","CANCELLED"],"description":"Current status."},"priority":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"],"description":"Priority."},"slaStatus":{"type":"string","enum":["OK","AT_RISK","BREACHED"],"description":"SLA state.","nullable":true},"scheduledStart":{"type":"integer","format":"int64","description":"Scheduled start; determines the schedule day (epoch milliseconds)","nullable":true},"scheduledEnd":{"type":"integer","format":"int64","description":"Scheduled end (epoch milliseconds)","nullable":true},"dueAt":{"type":"integer","format":"int64","description":"Due time (epoch milliseconds)","nullable":true},"slaBreachAt":{"type":"integer","format":"int64","description":"When the SLA is breached (epoch milliseconds)","nullable":true},"completedAt":{"type":"integer","format":"int64","description":"When the task was completed (epoch milliseconds)","nullable":true},"locationId":{"type":"string","description":"Your identifier for the site.","nullable":true},"locationName":{"type":"string","description":"Site name.","nullable":true},"locationAddress":{"type":"string","description":"Site address.","nullable":true},"locationLat":{"type":"number","description":"Latitude.","nullable":true},"locationLng":{"type":"number","description":"Longitude.","nullable":true},"assetId":{"type":"string","description":"Your identifier for the asset/equipment.","nullable":true},"assetName":{"type":"string","description":"Asset name.","nullable":true},"assetCode":{"type":"string","description":"Asset tag / code.","nullable":true},"assignedUserIds":{"type":"array","items":{"type":"string"},"description":"Ids of the users to assign. Every id must exist in the tenant."},"thirdPartyRefId":{"type":"string","description":"Reference in the originating system, e.g. a work-order number.","nullable":true},"externalSystemName":{"type":"string","description":"Name of the originating system.","nullable":true},"externalSystemUrl":{"type":"string","description":"Deep link to the job in the originating system.","nullable":true},"formTemplateIds":{"type":"array","items":{"type":"string"},"description":"Form templates to be completed for this task."},"tags":{"type":"array","items":{"type":"string"},"description":"Free-form tags."},"headerImageUrl":{"type":"string","description":"Image shown at the top of the task screen.","nullable":true},"cancellationReason":{"type":"string","description":"Why the task was cancelled.","nullable":true},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/DeclaredAttachment"},"description":"Optional. The complete list of this task's declared attachments, each referring to an already uploaded file. Attachments declared earlier and missing from the list are removed; photos taken in the app and attachments added through other endpoints are untouched. Omit the field to leave attachments alone. An unknown file rejects the whole item (422 UNKNOWN_FILE)."}}}},"securitySchemes":{"userToken":{"type":"http","scheme":"bearer","description":"Access token from POST /v1/auth/login."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Tenant API key."},"apiKeyBearer":{"type":"http","scheme":"bearer","description":"Tenant API key sent as a Bearer token."}}}}