Skip to content
v1

Reference Decision requests

Decision requests

Ask named people on the team to approve something or take a job, with a deadline, and react to the outcome.

Overview

A decision request asks named people on the team for a decision with a deadline. It has two shapes:

  • Approval (preset: approval): approve or reject. The first answer decides. Use it for a quote before it reaches the customer, a discount or a booking exception. The reviewer may correct editable values and the outgoing email before approving.
  • Job offer (preset: assignment): accept or decline. A decline or silence moves the request to the next person; with escalate_to_admins the team's admins are asked last. Use it to offer an incident to the technicians of a department one at a time.

Totem alerts each person in the app, and through the team's alert plan by WhatsApp, call or email with a signed answer link. People who only receive alerts, such as outside technicians, answer from that link. Your integration never sees responder phone numbers or links.

Create an integration with the operations profile to authorize decisions:write and decisions:read; rotating an older key does not add them. Select the team with Totem-Team and use a new Idempotency-Key for each request you create.

Create a request

POST /v1/decision-requests accepts the request as an operation. One Idempotency-Key creates at most one request: retry with the same key and body after an uncertain answer. Wait for status: succeeded; the result is a decision_request_receipt with the opaque drq_ id, its state and its resolution.

  • With type_id, the type configured in Settings › Automations › Approvals and job offers decides who is asked, routing, deadline, alert plan and effects. A type that decides by policy, such as one that only asks when m2 > 100, can already be resolved in the receipt.
  • Without a type, set preset, type_name, responders (a department_id, or member_ids from GET /v1/members), routing and expires_hours. Without responders the team's admins are asked.
  • fields are the values the person sees, and may correct when editable. message is the email Totem sends to the lead from the team's automation mailbox when the request is approved.
  • metadata holds up to 20 of your own string values, such as your quote id. Totem returns them unchanged and never shows them to people.

Files travel inline in attachments, base64-encoded: PDF, PNG, JPEG, WEBP, plain text or CSV, up to five. The whole JSON body is limited to 128 KiB and base64 grows a file by a third, so in practice the files share about 90 KB before encoding. Send a larger document as a link in summary instead.

React to the outcome

When the request ends, Totem records decision_request.resolved for the integration that created it. Read it from GET /v1/events: resource_id is the drq_ id and status is the resolution, one of approved, rejected, accepted, unanswered, expired or cancelled. The n8n Events trigger reads the same feed.

Then call GET /v1/decision-requests/{id}. It returns who decided (decided_by: a member id, policy, system or integration), the deciding answer's comment and via, the final_fields and final_message when approved or accepted, what Totem did afterwards in effects, and your metadata. Only the integration that created a request can read it; any other request answers 404 resource_missing.

Cancel a request

POST /v1/decision-requests/{id}/cancel takes an empty JSON object and returns an operation. Totem withdraws the pending alerts and records decision_request.resolved with cancelled. Cancelling a request that already ended is safe; the receipt shows how it ended.

Ask the team for a decision

POST /v1/decision-requests

Accepts a decision request (an approval, or a job offered one person at a time) as a durable operation; the receipt carries its opaque drq_ id. Totem alerts the responders, moves on when they decline or stay silent, and emits decision_request.resolved to this integration when it ends. One Idempotency-Key creates at most one request; the type, responders and lead are checked again before it is created.

Scopes
decisions:write
Rate limit
write

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

  • Idempotency-Key string Required 1–255 chars Pattern ^[\x21-\x7e]+$

    One unique visible-ASCII key per logical write; reuse exactly on retries and never retry outcome_unknown automatically.

Request body

Ask named people on the selected team for a decision with a deadline. Source and actor are set by the server; member, department and lead ids must belong to the selected team.

  • type_id string Pattern ^[a-z0-9][a-z0-9_-]{0,47}$

    A request type configured in Settings › Automations › Approvals and job offers. The type decides its kind, who is asked, routing, deadline, alert plan and effects; omit it to describe all of that in this request.

  • preset string

    Only without type_id: approval (approve or reject, the first answer decides) or assignment (accept or decline, a decline or silence moves on to the next person). Defaults to approval.

    Possible values
    • approval
    • assignment
  • type_name string 1–60 chars

    Only without type_id: the label responders see, such as "Quote", up to 60 characters.

  • title string Required 1–200 chars

    What must be decided, up to 200 characters.

  • summary string ≤ 4000 chars

    Context for the responder, up to 4,000 characters.

  • reference string ≤ 80 chars

    Your short reference, such as a quote or incident number, up to 80 characters.

  • lead_id string ID prefix lead_…

    A current lead of the selected team the decision is about. Its outcome note and the approved email use it; responders never see its contact details.

  • fields Array<object> ≤ 24 items

    Up to 24 values with unique keys.

  • message object

    The email Totem sends to the lead from the team's automation mailbox when the request is approved and its email effect is on.

  • attachments Array<object> ≤ 5 items

    Up to 5 files sent inline. The whole JSON body is limited to 128 KiB and base64 grows a file by a third, so in practice the files share about 90 KB before encoding.

  • responders object

    Who is asked when the type lets each request choose, or there is no type. Without it, the team's admins are asked.

  • routing object

    Overrides of the type's routing, or the routing of a request without a type.

  • expires_hours integer Range 1–720

    The whole request ends as expired after this many hours, 1 to 720.

  • alert_plan_id string Pattern ^[A-Za-z0-9_-]{1,64}$

    A team alert plan (WhatsApp, call, email steps) used to reach responders beyond the app.

  • effects object

    Overrides of what Totem does after the request ends.

  • metadata object

    Up to 20 of your own string values, returned unchanged by decision_requests.get. Keys use letters, digits, dot, dash and underscore; values up to 500 characters. Never put secrets or contact data here.

Returns

Returns an Operation object.

Errors

+ 12 common errors

POST /v1/decision-requests
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/decision-requests' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Idempotency-Key: ${TOTEM_IDEMPOTENCY_KEY:?Set one unique key for this logical write}" \
  -H "Content-Type: application/json" \
  --data '{"preset": "approval", "type_name": "Quote", "title": "Approve the quote for 120 m²", "reference": "Q-1042", "lead_id": "lead_r72EfbRNUzuqORFJR0O8HxAwEXd93jGUTYMaMMXKSF0QbLS8CiUKJpEP34LFQG", "fields": [{"key":"total","label":"Total (EUR)","value":"2350","kind":"money","editable":true}], "expires_hours": 48, "metadata": {"quote_id":"Q-1042"}}'
Response · 202JSON
{
  "object": "operation",
  "id": "op_m3yGe1tkVy6hn3m9LH9m7e640wg0O",
  "status": "queued",
  "endpoint": "decision_requests.create",
  "created_at": "2026-10-01T09:30:00.000Z",
  "updated_at": "2026-10-01T09:30:00.000Z",
  "result": null,
  "error": null
}

Get a decision request

GET /v1/decision-requests/{id}

Returns a decision request this integration created in the selected team: its state, resolution, who decided and how, the final values and email when approved or accepted, what Totem did afterwards and your metadata. Requests created by people or by another integration answer 404 resource_missing. It never returns lead contact data, responder phone numbers or answer links.

Scopes
decisions:read
Rate limit
Read

Path parameters

  • id string Required ID prefix drq_…

    The decision request's public id.

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

Returns

Returns a DecisionRequest object.

Errors

+ 12 common errors

GET /v1/decision-requests/{id}
curl 'https://api.totemstudio.ai/v1/decision-requests/drq_m423Xy70UYKA7qToV8ptXW80qS9cm' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID"
Response · 200JSON
{
  "object": "decision_request",
  "id": "drq_m423Xy70UYKA7qToV8ptXW80qS9cm",
  "type_id": "quote",
  "type_name": "Quote",
  "preset": "approval",
  "title": "Approve the lawn quote for 120 m²",
  "reference": "Q-1042",
  "state": "resolved",
  "resolution": "approved",
  "created_at": "2026-10-01T09:30:00.000Z",
  "expires_at": "2026-10-08T09:30:00.000Z",
  "resolved_at": "2026-10-01T10:05:00.000Z",
  "assignee": null,
  "decided_by": "mem_h548E7UiYhutHhucVrQCzkM0eaea0",
  "comment": "Rounded the price down.",
  "via": "app",
  "final_fields": {
    "m2": "120",
    "total": "2350"
  },
  "final_message": {
    "subject": "Your lawn quote",
    "body": "Hello, here is your quote for 120 m²."
  },
  "effects": {
    "lead_note": "done",
    "email": "done",
    "email_review_reason": null
  },
  "metadata": {
    "quote_id": "Q-1042"
  }
}

Cancel a decision request

POST /v1/decision-requests/{id}/cancel

Accepts cancellation of an open decision request this integration created, as a durable operation. Its pending alerts are withdrawn and decision_request.resolved follows with cancelled. Cancelling a request that already ended is safe and changes nothing; the receipt shows how it ended.

Scopes
decisions:write
Rate limit
write

Path parameters

  • id string Required ID prefix drq_…

    The decision request's public id.

Headers

  • Totem-Team string Conditional ID prefix team_…

    The team to read, as a team_… id. Omit it when the key reads one team; it is required when the key reads several (400 team_required). When you send it, it must name a team the key reads: a malformed id gets 400 invalid_request, and a team outside the key gets 404 team_not_accessible, as does a request without it once the key reads no team at all.

  • Idempotency-Key string Required 1–255 chars Pattern ^[\x21-\x7e]+$

    One unique visible-ASCII key per logical write; reuse exactly on retries and never retry outcome_unknown automatically.

Returns

Returns an Operation object.

Errors

+ 12 common errors

POST /v1/decision-requests/{id}/cancel
# Fictional fixtures: replace references and dates with current API values.
# Send consent or confirmation attestations only after the person confirms.
curl -X POST 'https://api.totemstudio.ai/v1/decision-requests/drq_m423Xy70UYKA7qToV8ptXW80qS9cm/cancel' \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Idempotency-Key: ${TOTEM_IDEMPOTENCY_KEY:?Set one unique key for this logical write}" \
  -H "Content-Type: application/json" \
  --data '{}'
Response · 202JSON
{
  "object": "operation",
  "id": "op_m3yGe1tkVy6hn3m9LH9m7e640wg0O",
  "status": "queued",
  "endpoint": "decision_requests.cancel",
  "created_at": "2026-10-01T09:30:00.000Z",
  "updated_at": "2026-10-01T09:30:00.000Z",
  "result": null,
  "error": null
}

The DecisionRequest object

A decision request this integration created, without lead contact data, responder phone numbers or answer links.

Attributes

  • object string

    Always decision_request.

  • id string ID prefix drq_…

    Opaque decision request id bound to its team and incarnation; never parse it.

  • type_id string Nullable

    The request type, or null without one.

  • type_name string

    The label responders saw.

  • preset string

    approval or assignment.

    Possible values
    • approval
    • assignment
  • title string

    What had to be decided.

  • reference string Nullable

    Your reference, or null.

  • state string

    open while people are being asked; resolved once it ended.

    Possible values
    • open
    • resolved
  • resolution string Nullable

    How it ended: approved, rejected, accepted, unanswered (everyone declined or stayed silent), expired or cancelled; null while open.

    Possible values
    • approved
    • rejected
    • accepted
    • unanswered
    • expired
    • cancelled
  • created_at string Format date-time

    When the request was created, in UTC.

  • expires_at string Format date-time

    When the request ends as expired if nobody decided, in UTC.

  • resolved_at string Nullable Format date-time

    When it ended, in UTC; null while open.

  • assignee string Nullable ID prefix mem_…

    Assignment only: the member who accepted the job (or whom the type's policy picked); otherwise null.

  • decided_by string Nullable ID prefix mem_…

    Who ended it: the deciding member, policy (the type decided alone), system (deadlines, nobody left to ask) or integration (cancelled through the API); null while open.

    Possible values
    • policy
    • system
    • integration
  • comment string Nullable

    The deciding answer's comment, or null.

  • via string Nullable

    Where the deciding answer came from: the app, the signed response link, an admin answering for the team, or the alert call; null when no person decided.

    Possible values
    • app
    • link
    • admin
    • call
  • final_fields object Nullable

    Approved or accepted only: every field key with its final value, including the responder's corrections; otherwise null.

  • final_message object Nullable

    Approved or accepted only, with a message: the email as approved; otherwise null.

  • effects object

    What Totem did after the request ended.

  • metadata object

    The metadata this integration sent, unchanged.

DecisionRequest · exampleJSON
{
  "object": "decision_request",
  "id": "drq_m423Xy70UYKA7qToV8ptXW80qS9cm",
  "type_id": "quote",
  "type_name": "Quote",
  "preset": "approval",
  "title": "Approve the lawn quote for 120 m²",
  "reference": "Q-1042",
  "state": "resolved",
  "resolution": "approved",
  "created_at": "2026-10-01T09:30:00.000Z",
  "expires_at": "2026-10-08T09:30:00.000Z",
  "resolved_at": "2026-10-01T10:05:00.000Z",
  "assignee": null,
  "decided_by": "mem_h548E7UiYhutHhucVrQCzkM0eaea0",
  "comment": "Rounded the price down.",
  "via": "app",
  "final_fields": {
    "m2": "120",
    "total": "2350"
  },
  "final_message": {
    "subject": "Your lawn quote",
    "body": "Hello, here is your quote for 120 m²."
  },
  "effects": {
    "lead_note": "done",
    "email": "done",
    "email_review_reason": null
  },
  "metadata": {
    "quote_id": "Q-1042"
  }
}

The DecisionRequestReceipt object

Minimal decision request receipt, as the operation recorded it. A type that decides by policy is already resolved here.

Attributes

  • object string

    Always decision_request_receipt.

  • id string ID prefix drq_…

    Opaque decision request id bound to its team and incarnation; never parse it.

  • state string

    open while people are being asked; resolved once it ended.

    Possible values
    • open
    • resolved
  • resolution string Nullable

    How it ended: approved, rejected, accepted, unanswered (everyone declined or stayed silent), expired or cancelled; null while open.

    Possible values
    • approved
    • rejected
    • accepted
    • unanswered
    • expired
    • cancelled
DecisionRequestReceipt · exampleJSON
{
  "object": "decision_request_receipt",
  "id": "drq_m423Xy70UYKA7qToV8ptXW80qS9cm",
  "state": "open",
  "resolution": null
}

API version 1.0.0