Treema HQ
Workspace settings

Hoteza API

For Hoteza's developers — the contract for creating tasks in a connected property with an API key, the request and response format, errors, limits and status callbacks.

This page is the API contract for Hoteza, connected through Task integrations. It is for Hoteza's developers: how to create tasks and how Treema HQ reports their status changes back.

Base URL and authentication

All requests go to https://external.treema.ai.

Each connected property has its own API key, and the key alone identifies the property. Send it in the X-Auth-Token header; Authorization: Bearer <api key> is accepted too. A missing or wrong key, a key that has been replaced, and the key of a deleted connection all get 401 INVALID_TOKEN.

Create a task

POST /v1/external/tasks with a JSON body of at most 64 KB.

curl -X POST "https://external.treema.ai/v1/external/tasks" \
  -H "Content-Type: application/json" \
  -H "X-Auth-Token: $API_KEY" \
  -d '{
    "id": "req-10452",
    "createdAt": "2026-11-09T08:15:00Z",
    "text": "Extra towels",
    "room": "412",
    "description": "Two bath towels, please."
  }'
FieldTypeRequiredLimitsMeaning
idstringyes1–64 charactersYour request id. A repeat for the same connection creates nothing (see DUPLICATE below).
createdAtstringyes1–32 charactersYour request time, stored as sent.
textstringyes1–512 charactersThe service requested. It selects the task template with the same name, ignoring case and surrounding spaces: the property's own template first, then one shared across the workspace. With no match, the task takes this text as its title and goes to the connection's default department.
roomstringyes0–256 characters, may be emptyThe room's name, matched exactly. A room that matches none is added to the description as Room: <value>.
descriptionstringno0–10 000 charactersShown to staff as sent, line breaks kept. Replaces the template's description.

Unknown fields are ignored, so hotelKey and assigneeEmails from older clients do no harm.

Responses

Every response is JSON. A created task:

{ "error": 0, "data": { "id": "req-10452", "taskId": "6730c1f2a4b5c6d7e8f90123" } }

An error carries a code and a message:

{ "error": 1, "code": "INVALID_BODY", "msg": "text: Too small: expected string to have >=1 characters" }
StatuscodeWhen
200—The task was created.
409DUPLICATEA task with this id already exists for the connection. data holds its id and taskId; msg is Task with this ID already exists.
400INVALID_BODYThe body is not valid JSON or a field breaks the rules above. msg names the first bad field.
401INVALID_TOKENThe API key is missing or invalid.
403INTEGRATION_PAUSEDThe property's administrator paused the connection.
403INTEGRATIONS_DISABLEDTask integrations are turned off for the workspace.
413PAYLOAD_TOO_LARGEThe body is larger than 64 KB.
429RATE_LIMITEDToo many requests (see Limits).
500INTERNAL_ERRORSomething failed on our side.

Retry a 5xx, a network error or a timeout with the same id: if the first attempt did create the task, the retry gets 409 DUPLICATE with its ids instead of a second task.

Limits

Each API key may send 120 requests a minute, and each client IP address 300. Over either limit the request gets 429 RATE_LIMITED. Treat 429 and 503 as "retry later", with a pause that grows between attempts.

Status callbacks

If the connection has a callback url, Treema HQ sends every status change of a task created through it to that address. The callback url and its authorization token come from you and are entered by the property's administrator when connecting.

POST <your callback url>
Content-Type: application/json
authorization: <your token>

{ "id": "req-10452", "newTaskStatus": 2, "newTaskStatusName": "INPROGRESS", "changedAt": "2026-11-09T08:21:37.512Z" }

id is the request id you sent when creating the task. changedAt is the time of the change in ISO 8601.

Status in Treema HQnewTaskStatusnewTaskStatusName
To do1NEW
In progress2INPROGRESS
Done3DONE
Paused4PAUSED
Cancelled5CANCELED
Accepted6ACCEPTED
  • Your answer. Any 2xx within 10 seconds counts as delivered. Redirects are not followed. The address must use https on the default port and resolve to a public address.
  • Retries. A failed delivery is retried after 30 seconds, then 1, 2, 5, 10, 15, 30 and 30 minutes, about an hour and a half in all. After that it is given up, and the connection shows as failing to the property's administrator.
  • Order. Once a newer status of the same task exists, older undelivered ones are dropped. Use changedAt to ignore a status older than one you already have.
  • Pauses. Nothing is sent while the connection is paused or deleted, or while task integrations are turned off for the workspace, and changes from that time are not sent later.

On this page