Skip to content

Triage API and webhooks

Score a travel inquiry over HTTP, list what Triage stores, and receive each scored inquiry as a signed webhook, with keys, limits and privacy rules.

Triage scores an inbound travel inquiry as HOT, WARM, COLD, SKIP or FRAUD, with the reasons and a reply draft. The API scores one inquiry per call from your own form, CRM or automation tool, and webhooks push each inquiry Triage scores to your server. Read this page before you connect a tool to Triage or build an integration on top of it.

Base URL: https://triage.tripcreator.ai. The OpenAPI 3.1 document is at /openapi.json and needs no key. Questions go to support@tripcreator.ai.

Choose how to connect

Use a webhook when a tool needs to know about every scored inquiry, and use the API to send it inquiries Triage never sees as mail.

You want Use
Score an inquiry from a web form, a CRM or a script POST /v1/score
Read back what Triage stored, for example to reconcile a CRM GET /v1/inquiries
Be told the moment an inquiry is scored A webhook for inquiry.scored

Get an API key

  1. Sign in at https://triage.tripcreator.ai/account and find the API keys section.
  2. Name the key after the tool that will use it, for example "Zapier", and create it.
  3. Copy the key now. It starts with trk_ and is shown once.

An account holds up to 5 active keys. Triage stores only a SHA-256 hash of each key, so a lost key cannot be recovered: revoke it and create another. A revoked key stops working at once.

A brand inbox activated from the Partner Hub creates keys and webhooks on its Triage account page like any advisor; its billing and removal stay in the Hub.

Authenticate a request

Send the key as a bearer token on every /v1 request.

Authorization: Bearer trk_...

A missing, malformed, unknown or revoked key answers 401 with the same body, so the response never says which of those it was. Keep the key on your server. Never ship it in a browser page or a mobile app.

Score an inquiry

POST /v1/score runs the scorer that reads forwarded mail and returns the whole result. It never writes to the advisor or to the traveller.

curl -s https://triage.tripcreator.ai/v1/score \
  -H "Authorization: Bearer $TRIAGE_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: form-1042" \
  -d '{
    "subject": "Maldives honeymoon",
    "body": "We want 12 to 19 November, two of us, ready to book.",
    "sender": "Sarah Miller <sarah.miller@gmail.com>",
    "external_id": "form-1042"
  }'
Field Required Meaning
body yes The inquiry text, 20 to 20000 characters. Read once to score it and not stored.
subject no The subject line, up to 300 characters.
sender no Name <address> or a bare address, up to 320 characters. Only the display name is kept.
external_id no Your own id for the inquiry, up to 200 characters. A repeat with the same value answers a duplicate.

The optional Idempotency-Key header does the same job when you have no external_id.

The response is a JSON object. This one is an example.

{
  "id": "api-3f9c1d2a7b6e4c58a0d1e9f2",
  "label": "HOT",
  "score": 82,
  "priority": "reply first",
  "confidence": 0.86,
  "summary": "Couple, Maldives, 12 to 19 November, ready to book",
  "reasons": [
    "Names exact dates and a party size",
    "States intent to book",
    "Asks about one specific destination"
  ],
  "reply_draft": "Hi Sarah, thank you for writing. The Maldives in mid-November is a good choice...",
  "opening_line": "Thank you for writing about your honeymoon in the Maldives.",
  "language": "en",
  "channel": "api",
  "extraction": {
    "destination": "Maldives",
    "dates": "12 to 19 November",
    "travellers": "2",
    "budget": null,
    "trip_type": "honeymoon"
  },
  "test": false
}
Field Meaning
id The stored row id: api- followed by 24 hex characters.
label HOT, WARM, COLD, SKIP or FRAUD.
score An integer from 0 to 100.
priority reply first for HOT, reply today for WARM, reply this week for COLD, no reply needed for SKIP, do not reply for FRAUD.
confidence A number from 0 to 1.
summary One line. Triage keeps it.
reasons Why it scored this way, written in the inquiry's language. Not stored.
reply_draft, opening_line A sendable first reply and a first line. Null for SKIP and FRAUD. Not stored.
language The BCP-47 tag of the inquiry.
channel Always api for this endpoint.
extraction destination, dates, travellers, budget and trip_type, each null when the message does not say. Not stored.
test True when the sender is on a team domain or a reserved test address such as example.com. A test row is never listed or counted.

A repeat call answers 200 with {"status": "duplicate", "id": "api-..."} and does not score again. Triage keeps no copy of the first answer, so store it when you get it.

An account without an active plan answers 402 with the error plan_inactive. Subscribe from the account page.

List stored inquiries

GET /v1/inquiries?days=N returns what Triage stored for the account over the last N days, from 1 to 90 with a default of 7. It lists newest first and returns at most 200 rows.

curl -s "https://triage.tripcreator.ai/v1/inquiries?days=14" \
  -H "Authorization: Bearer $TRIAGE_KEY"
{
  "data": [
    {
      "id": "api-3f9c1d2a7b6e4c58a0d1e9f2",
      "received_at": "2026-10-09T09:14:31.000Z",
      "label": "HOT",
      "score": 82,
      "priority": "reply first",
      "summary": "Couple, Maldives, 12 to 19 November, ready to book",
      "from": "Sarah Miller",
      "channel": "api",
      "status": "new"
    }
  ]
}

from is the sender's display name, empty when the sender was a bare address. status is the advisor's own lead state: new, replied, won or lost. Reasons and drafts are not in this list, because Triage never stored them.

Handle errors and limits

Every error is a JSON object with a stable error code and a plain message.

Status error When
400 invalid_json, invalid_request The body is not JSON, or a field is missing or out of range.
401 unauthorised The key is missing, malformed, unknown or revoked.
402 plan_inactive The account has no active plan.
429 rate_limited The key is over its limit.
503 scoring_unavailable Scoring is busy or not configured. Retry later.

Each key allows 120 requests per hour, counted across all of Triage's servers in fixed windows that start on the hour. The webhook calls count against the same limit. A 429 carries a Retry-After header with the seconds until the window ends. Retry a 503 after a short wait, and reuse the same external_id or Idempotency-Key so a retry cannot double-count.

Receive webhooks

A webhook is an HTTPS endpoint of yours that Triage calls with a signed JSON event each time it scores an inquiry. Register up to 5 endpoints per account, on the account page or through the API. Each endpoint gets its own secret.

Call What it does
POST /v1/webhooks Body {"url": "https://..."}. Answers 201 with {id, url, secret, created_at}. The id starts wh_, the secret starts whsec_ and is shown once.
GET /v1/webhooks Answers {"data": [{id, url, status, created_at}]}. The secret is not listed. status is active or disabled.
DELETE /v1/webhooks/{id} Removes an endpoint and answers {"id": "wh_...", "deleted": true}. Nothing more is sent to it.

The URL must use https on port 443 with a public host name. Triage refuses an IP address, localhost, a name ending in .internal or .local, a URL with a username or password, and a URL over 2048 characters. A refused URL answers 400 invalid_url, a sixth endpoint answers 409 limit_reached, and an unknown id on delete answers 404 not_found.

Triage also resolves the host name on every delivery and refuses to send when any answer is a private, loopback, link-local or otherwise non-public address. A name that was public when you registered it cannot be repointed at an internal address later.

Triage posts one inquiry.scored event to every active endpoint for each scored inquiry, whether it came from forwarded mail, a website form or POST /v1/score:

POST <your url>
content-type: application/json
user-agent: Triage-Webhooks/1
triage-event-id: evt_<24 hex>
triage-signature: t=<unix seconds>,v1=<hex HMAC-SHA256>
{
  "id": "evt_5b1e0c9a47d23f68a1c4e7b0",
  "type": "inquiry.scored",
  "created": 1791537271,
  "test": false,
  "data": {
    "inquiry_id": "api-3f9c1d2a7b6e4c58a0d1e9f2",
    "received_at": "2026-10-09T09:14:31.000Z",
    "label": "HOT",
    "score": 82,
    "priority": "reply first",
    "confidence": 0.86,
    "summary": "Couple, Maldives, 12 to 19 November, ready to book",
    "reasons": ["Names exact dates and a party size", "States intent to book"],
    "reply_draft": "Hi Sarah, thank you for writing...",
    "opening_line": "Thank you for writing about your honeymoon in the Maldives.",
    "language": "en",
    "channel": "website_form",
    "from": "Sarah Miller"
  }
}

channel is api for an inquiry scored through the API. For forwarded mail Triage infers it from the message: website_form, referral, instagram, whatsapp, direct or other.

Delivery rules:

  • Answer with any 2xx status within 5 seconds.
  • Triage makes up to 3 attempts within about 12 seconds: at once, after 1 second and after 3 seconds. It retries on a network error, a 5xx and a 429. Any other status is final.
  • It follows no redirects, so a redirect counts as a final answer. Register the final URL.
  • There are no later retries. Triage does not store the payload, so an event your endpoint missed is gone. GET /v1/inquiries lists the stored row, without the reasons and the draft.
  • After 100 consecutive failures Triage disables the endpoint. Re-enable it on the account page.
  • An inquiry saved without scoring, such as an empty message or an inactive plan, sends nothing.
  • Test rows never fire: our team's mail, test addresses and the samples Triage mails to an inbox. The account page can send a sample event with test set to true and invented data.
  • Every attempt for one event, and every endpoint that receives it, carries the same triage-event-id. Use it to drop duplicates. Each attempt is signed again, so t differs between attempts.
  • The account page lists the last 20 deliveries per endpoint: time, event id, HTTP status (or network) and attempts.

Verify the signature

Check every delivery before you trust it. The triage-signature header holds a Unix timestamp t and a hex HMAC-SHA256 v1. The signed text is the timestamp, a dot, and the raw request body, keyed with the endpoint secret. Compute it over the bytes you received, before any JSON parsing, and reject a timestamp older than 5 minutes.

import { createHmac, timingSafeEqual } from 'node:crypto';

const TOLERANCE_SECONDS = 5 * 60;

export function verifyTriageSignature(rawBody, header, secret, nowMs = Date.now()) {
  const parts = Object.fromEntries(
    String(header ?? '')
      .split(',')
      .map((part) => part.trim().split('=', 2)),
  );
  const t = Number(parts.t);
  if (!Number.isInteger(t) || !parts.v1) return false;
  if (Math.abs(nowMs / 1000 - t) > TOLERANCE_SECONDS) return false;

  const expected = createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest();
  const received = Buffer.from(parts.v1, 'hex');
  return received.length === expected.length && timingSafeEqual(received, expected);
}

A request handler reads the body as text, verifies it, then parses it:

export async function POST(request) {
  const raw = await request.text();
  const ok = verifyTriageSignature(raw, request.headers.get('triage-signature'), process.env.TRIAGE_WEBHOOK_SECRET);
  if (!ok) return new Response('invalid signature', { status: 400 });

  const event = JSON.parse(raw);
  // event.data.label, event.data.reply_draft, ...
  return new Response(null, { status: 204 });
}

See what Triage keeps

Triage stores five facts per inquiry and nothing else. You hold the rest.

Triage keeps Triage never keeps
Label, score, priority and confidence The message body
The one-line summary The client's email address
The sender's display name The reasons and the reply draft
The status, the channel and your feedback on the score The facts read from the message

The API caller holds the reasons, the draft and the extracted facts from the response, and a webhook receiver holds them from the event. Triage cannot show them again, so store them where your own privacy rules allow. For each webhook endpoint Triage keeps the URL, the signing secret, the status and the delivery log, which holds metadata and no payload. The privacy page at https://triage.tripcreator.ai/privacy covers the same ground for advisors.