Docs › Security & account › REST API

REST API reference

The-Y CRM's public REST API is meant for server-to-server integrations: read or create contacts, conversations, deals, tasks and notes, reply in conversations and receive events via webhook. Requests are authenticated with an API key.

Base URL (hosted): https://crm.the-y.at/api/ext/v1 · self-host: https://<your-domain>/api/ext/v1 · available on all plans, including Free

Authentication

Every request needs your API key in the header — either as a Bearer token or as X-API-Key:

Authorization: Bearer <YOUR_API_KEY>
# or
X-API-Key: <YOUR_API_KEY>

Create a key: in the app under Settings → Integrations (under “Advanced” → Connections) → "API keys" → new key. The key starts with tyk_ and is shown only once — store it safely (The-Y only stores a hash). The key is bound to your tenant.

Permissions (scopes), expiry and renewal: each key has its own scopes – you choose them when you create it: contacts:read, contacts:write, conversations:read, conversations:write, deals:read, deals:write, tasks:write, notes:write, users:read and webhooks:manage (which route needs which scope is in the overview). Optionally it gets an expiry date (at most 5 years). “Renew” creates a new key; the old one keeps working for the time you choose (immediately, 24 hours, 7 or 30 days). Older keys without defined permissions (before 1.1.60) can still only read and write contacts – for the new areas, set the permissions in the settings or create a new key.

Treat the key like a password: use it server-side only, never in the browser/frontend. Revoke compromised keys in Integrations.

Overview: all routes (since 1.1.62)

All routes live under https://crm.the-y.at/api/ext/v1 (self-hosted: your address + /api/ext/v1). Every route needs a scope of the key.

RouteScopeWhat
GET /me– (any valid key)name, scopes and limits of the key itself (e.g. a connection test)
GET /contacts, GET /contacts/{id}contacts:readsearch / read contacts
POST /contacts, PATCH /contacts/{id}contacts:writecreate / update a contact
POST /contacts/upsertcontacts:writecreate or update by email (no duplicates)
GET /custom-fields?entity=contact|company|dealcontacts:read (deals: deals:read)custom fields (key, type, options)
GET /conversations, GET /conversations/{id}conversations:readconversations and messages
POST /conversations/{id}/messagesconversations:writereply in a conversation
PATCH /conversations/{id}conversations:writestatus, assignee
GET /pipelines, GET /deals/{id}deals:readpipelines with stages, one deal
POST /deals, PATCH /deals/{id}deals:writecreate a deal, change its stage
POST /taskstasks:writecreate a task
POST /notesnotes:writenote on a contact, company, deal or conversation
GET /usersusers:readactive team members (for assignees)
GET/POST /webhooks, GET/DELETE /webhooks/{id}webhooks:manageregister and remove webhooks

Conventions

StatusMeaning
200 / 201OK / created (possibly with warnings, see above)
400invalid_json: the body isn't a valid JSON object (or is empty) · invalid_field: a field has the wrong type (see field; allowed are text, a number or null) · contact_empty: creating a contact without first name, last name, email and phone · more codes of the new routes: see error codes
401unauthorized: key missing, unknown, revoked or expired
403insufficient_scope: the key lacks the permission (see required) · tenant_suspended: account suspended · feature_locked: integrations are switched off for this account · cloud_readonly: the account is read-only right now (e.g. after Cloud Pro ended while above the Free limits) – creating and updating blocked, reading works · terms_required: new terms of use not accepted yet – updating blocked, creating and reading work
404not_found: the item doesn't exist, was deleted, or the ID isn't a valid ID (e.g. /contacts/abc)
409a reply in a conversation is not sent (e.g. window_closed, see conversations) · webhook_limit: already 100 webhooks
429limit exceeded (rate_limited or, on the Free plan, daily_limit_reached, with Retry-After; see limits)
500server error

Error codes of the new routes (since 1.1.62): 400: invalid_events, unsafe_url, invalid_status, invalid_assignee, text_required, template_not_supported, template_not_found, invalid_reference, title_required, target_required, email_required, invalid_entity (always with message, mostly with field) · 403: limit_reached (monthly limit on the Free plan) · 409: see reply, webhook_limit · 429: rate_limited, daily_limit_reached.

Limits and plans (since 1.1.62)

In addition to the limit per IP address (300 requests per minute), each account has:

FreeCloud Pro, Paid, Founderself-hosted
per minute60300none (configurable: API_LIMIT_PER_MINUTE)
per day (UTC)1,000nonenone (configurable: API_LIMIT_PER_DAY)

Every response to an authenticated request carries the headers X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix seconds) for the current minute; on the Free plan also X-RateLimit-Limit-Day, X-RateLimit-Remaining-Day and X-RateLimit-Reset-Day for the day (UTC). This shows you how many requests are left. Self-hosted without a configured limit there is no limit and therefore none of these headers. They are not sent before authentication (missing or wrong key).

Above a limit the API answers 429 and additionally Retry-After (seconds): { "error": { "code": "rate_limited", "message": "…", "limit": 60, "window": "minute", "retry_after": 12, "reset_at": "…" } }, or for the daily limit { "error": { "code": "daily_limit_reached", "message": "…", "upgrade": { "href": "…" } } }. Webhooks the CRM sends to you don't count. Tip: on 429 wait the seconds from Retry-After before you try again.

Contacts

Contact IDs are UUIDs (e.g. 3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90). When creating and updating, the API understands these fields:

FieldTypeMeaning
first_nametextfirst name
last_nametextlast name
emailtextone email address
phonetextone phone number
customobjectcustom fields as { "key": value }. Only keys of custom fields that exist for contacts in the CRM are taken over (Settings → Custom fields, keys via GET /custom-fields). Unknown keys are not saved and are listed in the response under warnings

Each field takes text, a number (stored as text, e.g. a phone number from a spreadsheet) or null (empty). An object, a list or true/false returns 400 invalid_field. Other fields (e.g. name, company, emails) are ignored. A company can't be set via the API at the moment.

GET/contacts

List contacts, newest first (paginated, see Conventions). ?q= searches first and last name, email, phone, company name and WhatsApp username.

# Request
curl "https://crm.the-y.at/api/ext/v1/contacts?limit=20&offset=0" \
  -H "Authorization: Bearer $API_KEY"

# Response 200
{
  "data": [
    {
      "id": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90",
      "first_name": "Maria",
      "last_name": "Muster",
      "emails": [{ "type": "work", "value": "maria@example.com" }],
      "phones": [{ "type": "mobile", "value": "+4366012345678" }],
      "company": "ACME",
      "created_at": "2026-11-09T10:15:00.000Z",
      "wa": null
    }
  ],
  "limit": 20,
  "offset": 0,
  "count": 1,
  "hasMore": false
}

company is the name of the linked company (or null), wa the WhatsApp ID { "bsuid", "username" } (or null). Custom fields are only included when you read a single contact.

POST/contacts

Create a contact. Fields: see the table above.

curl -X POST "https://crm.the-y.at/api/ext/v1/contacts" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "first_name": "Maria", "last_name": "Muster", "email": "maria@example.com", "phone": "+4366012345678" }'

# Response 201 Created
{
  "id": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90",
  "contact": {
    "id": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90",
    "first_name": "Maria",
    "last_name": "Muster",
    "emails": [{ "type": "work", "value": "maria@example.com" }],
    "phones": [{ "type": "mobile", "value": "+4366012345678" }],
    "company": null,
    …
  }
}

contact has the same fields as reading a single contact, just without custom. Send custom fields along, e.g. "custom": { "customer_no": "K-1001" } (only if the field “customer_no” exists in the CRM).

Required (since 1.1.62): at least one of first_name, last_name, email or phone with content. Otherwise you get 400 contact_empty and no contact is created – nor with broken JSON (400 invalid_json). POST /contacts doesn't detect duplicate email addresses: every call creates a new contact. To avoid duplicates, use POST /contacts/upsert.
# Response 400 (empty body, or unknown fields only such as "name")
{ "error": "contact_empty", "message": "A contact needs at least one of these fields: first_name, last_name, email or phone." }

# Response 201 with a warning (the custom field "colour" doesn't exist in the CRM – the contact is created anyway)
{
  "id": "3f6c1e2a-…",
  "contact": { … },
  "warnings": [
    { "code": "unknown_custom_fields", "fields": ["colour"], "message": "…" }
  ]
}

GET/contacts/{id}

Read a single contact. The response is the contact itself (no data wrapper), with custom fields in custom.

curl "https://crm.the-y.at/api/ext/v1/contacts/3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90" \
  -H "Authorization: Bearer $API_KEY"

# Response 200
{
  "id": "3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90",
  "first_name": "Maria",
  "last_name": "Muster",
  "emails": [{ "type": "work", "value": "maria@example.com" }],
  "phones": [{ "type": "mobile", "value": "+4366012345678" }],
  "company_id": null,
  "company": null,
  "owner_user_id": null,
  "owner_name": null,
  "birthday": null,
  "consent_state": {},
  "consent_meta": {},
  "created_at": "2026-11-09T10:15:00.000Z",
  "wa": null,
  "custom": { "customer_no": "K-1001" }
}

owner_user_id/owner_name = the person in charge, consent_state/consent_meta = consent per channel with proof. Unknown or invalid ID (e.g. abc): 404 { "error": "not_found" }.

PATCH/contacts/{id}

Partially update a contact — only the fields you send change, everything else stays:

curl -X PATCH "https://crm.the-y.at/api/ext/v1/contacts/3f6c1e2a-8b4d-4c1e-9a7f-2d5b6c7e8f90" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "phone": "+4366099999999" }'

# Response 200: { "id": "…", "contact": { … } } (same as when creating, possibly with warnings)

POST/contacts/upsert

Create or update by email address (since 1.1.62): { "email": "maria@example.com", "first_name": "Maria", "custom": { … } } → new: 201 { "created": true, … }, existing: 200 { "created": false, … } (only the fields you send change). If several contacts have the address, the oldest is updated and warnings contains multiple_matches. Without email: 400 email_required.

GET/custom-fields

GET /custom-fields?entity=contact (also company, deal) → { "entity", "data": [{ "key", "label", "type", "options", "required" }] }. key is the key in custom.

Conversations (since 1.1.62)

GET /conversations?status=open&channel=whatsapp&since=2026-11-01T00:00:00Z&limit=50&offset=0 — newest activity first. Optional filters: status (open, snoozed, closed), channel (email, whatsapp, sms, webchat, messenger, instagram, call, …), since (last message at or after), contact_id. Response { "data": [ … ], "limit", "offset", "count", "hasMore" }.

A conversation: { "id", "number", "channel", "status", "priority", "subject", "contact_id", "customer": { "name", "address" }, "assignee": { "id", "name" } | null, "created_at", "last_message_at", "first_response_at", "resolved_at", "snooze_until", … }. GET /conversations/{id}?messages=200 adds messages (latest ones, oldest first): { "id", "direction": "in" | "out", "internal", "text", "author_name", "created_at", "delivery", "attachments": [{ "id", "filename", "content_type", "size" }] }. in = from the customer, internal: true = internal note (never sent to the customer).

Reply: POST /conversations/{id}/messages with { "text": "…" } — on the same channel and account as in the inbox (email with signature, subject “Re:” and quote; WhatsApp; SMS; Messenger; Instagram; web chat). On WhatsApp outside the 24-hour window only an approved template works: { "template": { "name": "appointment_reminder", "language": "en", "params": ["Maria"] } }. Response 201 { "id", "conversation_id", "delivery", "message" } — delivery as in the inbox (sent, simulated without a configured channel, failed with delivery_info). The message shows the author “API: <key name>” and counts like a reply from the inbox (monthly limit on the Free plan, first response).

The same rules as for a reply in the inbox apply: a normal reply (text or service template) is sent even if the contact opted out of the channel or unsubscribed from emails – as in the inbox, you (or your workflow) decide. A marketing template (category “Marketing”) is only sent with explicit consent. The reply is not sent (409) on: window_closed (24-hour window closed and free text on WhatsApp, Messenger or Instagram – on WhatsApp a template works then), no_optin or consent_off (marketing template only: no explicit consent or channel opted out), wa_thread_owned_by_other (another responder handles the WhatsApp conversation), no_mailbox, recipient_suppressed, channel_not_supported. 403 limit_reached = monthly limit on the Free plan reached.

Status / assignee: PATCH /conversations/{id} with { "status": "closed" }, { "status": "snoozed", "snooze_until": "…" } or { "assignee_user_id": "<ID from GET /users>" | null }. The conversation history shows “API (<name>) closed the conversation”.

Deals (since 1.1.62)

GET /pipelines → pipelines with stages (id, name, sort_order, probability, is_won, is_lost). GET /deals/{id} reads one deal. POST /deals with { "title": "Website relaunch", "value": 4800, "currency": "EUR", "stage_id": "…", "contact_id": "…", "custom": { … } } (without a stage: first stage of the default pipeline). PATCH /deals/{id} with { "stage_id": "…" } — the pipeline follows the stage, won / lost follow from the stage. IDs from another account → 400 invalid_reference with field.

Tasks, notes, team (since 1.1.62)

Need more resources (e.g. companies)? Write to us at office@the-y.at — for live events there are the webhooks below.

Outbound webhooks (events)

Instead of polling, have events pushed to your URL. Under Settings → Integrations → "Send data (webhook)" you set a target URL and the events. The CRM creates the signing secret.

Register via the API (since 1.1.62): POST /webhooks with { "url": "https://…", "events": ["message.received", "deal.won"], "name": "My system" } — "events": ["*"] = all. Response 201 { "id", "secret": "whsec_…", "webhook" }. The secret is only in this response, never again (list and single read don't show it). DELETE /webhooks/{id} removes it. At most 100 webhooks per account.

EventWhendata
contact.createdcontact created — by hand, via the API, from WhatsApp, email, SMS, calls, web chat, bookings, appointments; CSV imports only with the box “Run automations, … campaigns and webhooks …” tickedcontact + source (whatsapp, email, import, api, …)
contact.updatedchanged in the form, the inbox or via the APIcontact + changed
message.receiveda customer writesmessage: text, conversation_id, channel, contact_id, from { name, address }, first
conversation.createda customer or the team starts a conversationconversation + started_by (customer / team)
conversation.closed / conversation.assignedclosed / new assigneeconversation (+ previous_status / previous_assignee_id)
deal.created, deal.stage_changed, deal.won, deal.lostdealsdeal (+ from_stage, to_stage on stage changes)
task.createdtask createdtask
Data protection (please read): with message.received, conversation.* and contact.*, message texts, names, phone numbers and email addresses of your customers go to the address you enter (for example your automation tool). The CRM only sends what you subscribe to, and only to targets an admin has entered. Check that the target system may process this data (data processing agreement, server location) and subscribe only to the events you need. The same applies to API keys with conversations:read and users:read (email addresses of your team). Only send webhooks over https://.

Verify the webhook signature (since 1.1.60)

Every delivery is signed, so your system can check that the data really comes from The-Y CRM and wasn't changed on the way.

Secret: it is shown once when you create the webhook (whsec_…). Afterwards it is only stored encrypted and not visible anywhere. Lost it? “Renew secret” – the old one stops working immediately.

HeaderContent
X-TheY-Timestamptime of the delivery in seconds since 1970 (Unix time)
X-TheY-Signaturev1=<hex> – HMAC-SHA256 with the secret over <X-TheY-Timestamp>.<body> (timestamp, a dot, the unchanged body)
X-TheY-Evente.g. contact.created
X-TheY-Event-Idevent ID (evt_…, since 1.1.62). The same on every retry and for all webhooks of the same event; also in the signed body as id. Use it to detect duplicate deliveries
X-TheY-DeliveryID of this delivery to this webhook (stays the same on retries)
X-KSCRM-Signature, X-KSCRM-Eventold: HMAC-SHA256 over the body only, without a timestamp. Still sent so existing receivers don't break
Please switch: the old X-KSCRM-Signature header will be removed with version 1.2.0. Until then, verify X-TheY-Signature as shown below.

How to verify: compute the signature yourself and compare in constant time, and reject deliveries whose timestamp is more than 5 minutes off your clock (protects against replaying intercepted deliveries). Important: sign the raw body as received – don't parse it as JSON and serialise it again first.

# Node.js (Express)
import crypto from "node:crypto";
import express from "express";

const SECRET = process.env.THEY_WEBHOOK_SECRET; // whsec_…
const app = express();
const alreadyProcessed = new Set(); // in real life rather a table/Redis entry that expires after e.g. 24 h

app.post("/the-y/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const ts = Number(req.get("X-TheY-Timestamp"));
  const sig = (req.get("X-TheY-Signature") || "").split(",").map((s) => s.trim()).find((s) => s.startsWith("v1="))?.slice(3) || "";
  if (!Number.isInteger(ts) || Math.abs(Date.now() / 1000 - ts) > 300) return res.status(400).send("too old");
  const want = crypto.createHmac("sha256", SECRET).update(`${ts}.${req.body.toString("utf8")}`).digest("hex");
  const a = Buffer.from(sig, "utf8"), b = Buffer.from(want, "utf8");
  if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) return res.status(401).send("bad signature");
  const event = JSON.parse(req.body.toString("utf8"));
  if (alreadyProcessed.has(event.id)) return res.sendStatus(204); // retry – process only once
  alreadyProcessed.add(event.id);
  // … process event.event, event.data
  res.sendStatus(204);
});
# PHP
<?php
$secret = getenv('THEY_WEBHOOK_SECRET'); // whsec_…
$body   = file_get_contents('php://input');
$ts     = (int)($_SERVER['HTTP_X_THEY_TIMESTAMP'] ?? 0);
$sigHdr = $_SERVER['HTTP_X_THEY_SIGNATURE'] ?? '';
$sig    = '';
foreach (explode(',', $sigHdr) as $part) { $part = trim($part); if (str_starts_with($part, 'v1=')) $sig = substr($part, 3); }
if (abs(time() - $ts) > 300) { http_response_code(400); exit('too old'); }
$want = hash_hmac('sha256', $ts . '.' . $body, $secret);
if (!hash_equals($want, $sig)) { http_response_code(401); exit('bad signature'); }
$event = json_decode($body, true);
// … process $event['event'], $event['data']
http_response_code(204);

Inbound webhooks

External systems can create/update data in The-Y via a token URL: POST /api/hooks/<token> (token created in Integrations). Per webhook you choose the access level: upsert (create/update only, deletions ignored — anti-lock-in) or full (incl. delete).

What's next