Connected Workers Work Requests

A work request (a note in the product's earlier vocabulary, and still in the API's alias paths) is what a person in the field raises: something here needs attention. It is the reporting half of Connected Workers. Its complement is the work order — the planned, scheduled job that answers a request.

A work request carries content (title, description, status, priority, dates, assignee, form values, attachments) and, crucially, where it is: it anchors to a location, and optionally to an asset and a department.

  • Anchored by business key — you send your codes (a functional-location code, an asset's primary-key value, a department primary-key value), not Treedis ids. Nothing to configure per work request, nothing to look up first.
  • Create or update in one endpoint — omit id to create, include it to update.
  • Presigned attachments — stage files through /uploads/presign and send their S3 keys to the individual save endpoint. JSON bulk and CSV rows do not accept attachments.

Base URL & auth

The workspace-level endpoint is the one to integrate against:

https://api.treedis.com/v2/api/workspaces/{workspaceId}/workRequests

All endpoints require authentication (OAuth2 Bearer token or API key), and the caller must have access to the workspace. workspaceId is always a numeric ID. An API key is bound to a single workspace and can only address its own.

Authentication How to obtain and send an OAuth2 access token.

Three spellings, one endpoint. Every path below answers on /workRequests, /work-requests and /notes alike (…/export and …/import included). /notes is the original name and /work-requests its first rename; both are kept so integrations do not have to switch in lockstep with a deploy. New work should use /workRequests — the camelCase form is the house convention for URL paths.

Endpoints

Method Path Purpose
POST /v2/api/workspaces/{workspaceId}/workRequests Create or update a work request
POST /v2/api/workspaces/{workspaceId}/workRequests/bulk Save 1–100 work requests
GET /v2/api/workspaces/{workspaceId}/workRequests/export Export every work request as portable JSON
POST /v2/api/workspaces/{workspaceId}/workRequests/import Import portable JSON into this workspace

There is also a project/tour-level pair under /v1/api for integrations that anchor to a Treedis tag rather than a CW location — see Tour-level work requests below.

Creating a work request

location is the only required field: the location row's primary-key value — the code your own system uses. Treedis finds that row and files the request against it.

curl -X POST "https://api.treedis.com/v2/api/workspaces/7/workRequests" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "location": "R400-20-FL-1001",
    "title": "Pump leak",
    "description": "There is a leak in the pump, needs immediate attention.",
    "status": "open",
    "priority": "high"
  }'
{
  "status": 200,
  "message": "Success",
  "data": {
    "note": {
      "id": 9001,
      "title": "Pump leak",
      "status": "open",
      "priority": "high"
    }
  }
}

Anchors

Field Required What it is
location Yes The location row's primary-key value (e.g. its functional-location code).
assetKey No The asset table slug the asset value lives in (e.g. assets). Required when asset is sent.
asset No The asset row's primary-key value — links the request to that physical asset.
department No The department row's primary-key value — files the request against that department.

All three can be combined on one request. A value that matches no row returns 404; asset without assetKey returns 400.

curl -X POST "https://api.treedis.com/v2/api/workspaces/7/workRequests" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "location": "R400-20-FL-1001",
    "assetKey": "assets",
    "asset": "R400-20-FL-1001-EQ",
    "department": "Maintenance",
    "title": "Pump leak",
    "status": "open",
    "priority": "high"
  }'

See the Locations, Assets and Departments guides for how those rows and their primary keys are defined.

Content fields

Field Type Notes
id integer Omit to create. Include to update — it must be a work request in this workspace, otherwise 404.
title string Work request title.
description string Body / details.
status string e.g. open, in_progress.
priority string e.g. high.
assignee string Identifier of the user it is assigned to.
reporter string Identifier of the user reporting it.
scheduledDate date-time ISO 8601.
dueDate date-time ISO 8601.
customFields object Form field values, keyed by field — captured through the work request's form template.

Attachments

The workspace save endpoint accepts JSON only. Multipart bodies are rejected. For each attachment, request POST /v2/api/workspaces/{workspaceId}/uploads/presign with fileName, contentType, and fileSize, then PUT the raw bytes to the returned uploadUrl. Send the returned s3Key and file name on the individual save:

{
  "location": "R400-20-FL-1001",
  "title": "Pump leak",
  "filesS3Key": ["<s3Key returned by uploads/presign>"],
  "filesS3Name": ["photo.jpg"]
}

Up to 10 attachments, 20 MB each, image/audio/video/PDF. The single-record integration route retains deprecated base64 files; use presigned uploads for new work. Bulk and CSV rows reject attachment fields.

Bulk save work requests

Use POST /v2/api/workspaces/{workspaceId}/workRequests/bulk to save 1–100 work requests in one JSON call. Send Content-Type: application/json with a workRequests array. The route is outside /cw; /work-requests/bulk and /notes/bulk are aliases.

Each object uses the same fields, form rules, assignments, and location access as an individual save. OAuth2 requires write:cw, and the caller must be a member of the workspace with at least one of Create work requests, Edit any work request or Edit own work requests. API keys remain bound to their workspace.

curl -X POST "https://api.treedis.com/v2/api/workspaces/7/workRequests/bulk" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "workRequests": [
      { "location": "FL-1001", "title": "Pump leak" },
      { "location": "FL-1001", "title": "Loose guard" },
      { "id": 9001, "location": "FL-1001", "title": "Updated pump report" }
    ]
  }'

Each element of workRequests is one flat work request. Do not wrap the rows in another object such as { "name": "workRequests", "items": [ … ] }. That wrapper is read as a single row with no location, and the call fails with location is required to route the work request and failed: 1.

location is the existing location row's primary-key value. Omit id to create; include a Treedis work request id to edit an accessible request in this workspace. assetKey plus asset can link equipment, and department resolves by the department's primary-key value. Send customFields as a JSON object.

Response and row failures

HTTP 201 means every row saved. HTTP 207 means at least one row was rejected, including when all rows were rejected. Inspect data.failed and data.results; a 2xx status alone does not mean every row saved. index is zero-based and matches the input array. Every row has a result: a saved row has id, a rejected row has status and message.

{
  "status": 200,
  "message": "Success",
  "timestamp": 1793544000000,
  "data": {
    "created": 1,
    "updated": 0,
    "failed": 2,
    "results": [
      { "index": 0, "success": true, "id": 9002 },
      {
        "index": 1,
        "success": false,
        "status": 404,
        "message": "Location \"FL-9999\" is missing in this workspace"
      },
      {
        "index": 2,
        "success": false,
        "status": 400,
        "message": "location is required to route the work request"
      }
    ]
  }
}

The HTTP status and the envelope status differ. The envelope is the same wrapper every route uses, and for this route its status is always 200, even when the HTTP status is 207 and every row failed. Read the HTTP status, data.failed and each row's success; do not use the envelope status. A row status is the HTTP-style code of that row alone (400 invalid row, 404 location, asset or department not found).

A request body that is not valid returns 422 before any row is read: workRequests missing, empty, longer than 100, or holding something that is not an object. Missing credentials, insufficient OAuth scope, and workspace refusal also reject the request before saving rows.

Batches are not atomic. Valid rows save even when another row is rejected. An infrastructure failure can also happen after earlier rows have saved. Do not retry a whole create batch blindly: that can create duplicates. Retry rejected rows, or use returned work request ids for updates.

Bulk rows do not accept files, filesS3Key, or filesS3Name. Use the individual record endpoint to attach files.

For large files, follow work request CSV imports. That guide covers CSV fields, presigned uploads, polling, and error reports.

Export & import

Both endpoints move work requests between workspaces as portable JSON. Anchors travel as business keys, not ids — a location by its name, an asset by table key + primary-key value — so the same payload re-resolves in the destination workspace.

curl "https://api.treedis.com/v2/api/workspaces/7/workRequests/export" \
  -H "Authorization: Bearer your-access-token"
{
  "status": 200,
  "message": "Success",
  "data": {
    "kind": "cw-notes",
    "version": 1,
    "notes": [
      {
        "title": "Pump leak",
        "status": "open",
        "priority": "high",
        "assignee": null,
        "reporter": null,
        "location": "R400-20-FL-1001",
        "assetKey": "assets",
        "asset": "R400-20-FL-1001-EQ",
        "dueDate": "2026-06-25T17:00:00.000Z",
        "scheduledDate": null,
        "customFieldValues": null
      }
    ]
  }
}

Save the export response's data object as export.json and post that object to import it (do not post the response envelope):

curl -X POST "https://api.treedis.com/v2/api/workspaces/9/workRequests/import" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d @export.json
{
  "status": 200,
  "message": "Success",
  "data": { "imported": 1, "skipped": 0 }
}

Runtime state is deliberately dropped on export — ids, tour and tag, 3D position, form template id, messages and timestamps. What travels is the request itself, not where it happened to be pinned. A request whose location or asset cannot be resolved in the destination is skipped, not guessed at, and counted in skipped.

Import the target tables before the work requests: push Locations, Assets and Departments first, or every anchor will fail to resolve.

Tour-level work requests

For integrations anchored to a Treedis tag rather than a CW location, /v1/api carries the original pair:

Operation Endpoint
Create / update a work request POST /v1/api/workRequests
Add a message to a work request POST /v1/api/workRequests/messages
curl -X POST "https://api.treedis.com/v1/api/workRequests" \
  -H "Authorization: Bearer your-access-token" \
  -F 'title=Pump leak' \
  -F 'tagId=456' \
  -F 'status=in_progress' \
  -F 'files=@photo.jpg'
curl -X POST "https://api.treedis.com/v1/api/workRequests/messages" \
  -H "Authorization: Bearer your-access-token" \
  -F 'threadId=789' \
  -F 'description=Replaced the seal; monitoring.' \
  -F 'files=@after.jpg'

Attach to a project (projectId) and/or a tag (tagId) — tourId is not used and should be dropped from your payload; the tour is resolved from the tag when needed. Both endpoints accept multipart/form-data and application/json with base64 files, exactly like the workspace endpoint above.

If you are still calling the unauthenticated POST /v1/public/saveThread or POST /v1/public/saveThreadMessage, move to these: the request body is unchanged — add an Authorization header and change the path.

Errors

Status When
400 location missing, or asset sent without assetKey
401 Missing or invalid credentials
403 The caller has no access to the workspace, or an API key addressing another workspace
404 No location (or asset row) matches the given value, or id is not a work request in this workspace

See the Work Requests tag in the API Reference for the full request and response schemas.