← Documentation

API how-to guide

Read conversations, send messages, manage contacts and tickets, and receive events when something happens — with an API key instead of a browser session. This is the short version; the CRM guide goes deeper, and the reference has every parameter.

Base URLhttps://cx.ikonia.co.za/api/v1

01Get a key

Open Settings → API keys, create a key, and tick only the scopes the integration needs. The key is shown once — copy it then, because only a hash is stored and it cannot be recovered afterwards.

Keys look like ikx_live_… or ikx_test_…. A key missing a scope gets 403 insufficient_scope naming the one it needs.

conversations:readList and read conversations
conversations:writeClose or reopen a conversation
messages:readRead message bodies
messages:sendSend email and WhatsApp
contacts:readList and read contacts and groups
contacts:writeCreate and update contacts and membership
tickets:readList and read tickets
tickets:writeCreate tickets and change status
broadcasts:sendSend WhatsApp template broadcasts
webhooks:manageRegister and remove webhook endpoints

A test key is a label, not a sandbox — it delivers real messages to real people. Delivery is suppressed by the channel being marked demo, never by the key. Build against a demo channel, or send only to addresses you own.

Google Business reviews are deliberately not exposed. Syncing, AI drafting and replying all work as normal inside the app — there is simply no /v1/reviews endpoint.

02Your first call

Send the key as a bearer token. If your HTTP client cannot set Authorization, X-API-Key is accepted instead.

curl https://cx.ikonia.co.za/api/v1/ping \
  -H "Authorization: Bearer ikx_live_YOUR_KEY"

/ping needs no scope and is the fastest way to prove a key works:

{
  "ok": true,
  "organisation": "Northwind Coffee",
  "environment": "live",
  "scopes": ["conversations:read", "messages:send"]
}

JSON in, JSON out. A key is bound to one organisation and every query runs under that organisation's row-level security — so there is no org parameter to pass, and no way to reach another tenant's data.

03The endpoints

Ids in paths are UUIDs.

GET/pingVerify a key
GET/conversationsList conversations
GET/conversations/{id}One conversation
PATCH/conversations/{id}Close or reopen
GET/conversations/{id}/messagesMessages in a thread
POST/conversations/{id}/messagesReply in a thread
POST/messagesStart a new thread and send
GET/contactsList contacts. ?external_ref= finds one by your own id
GET/deletionsWhat was deleted, and when
POST/contactsCreate a contact
GET/contacts/{id}One contact
PATCH/contacts/{id}Update a contact
GET/contacts/{id}/conversationsThat contact's threads
GET/contact-groupsList groups
POST/contact-groups/{id}/membersAdd or remove members
GET/ticketsList tickets
POST/ticketsCreate a ticket
PATCH/tickets/{id}Change status or assignee
GET/whatsapp/templatesApproved WhatsApp templates
POST/broadcastsSend a template broadcast
GET/broadcasts/{id}Broadcast progress
GET/webhooksList endpoints
POST/webhooksRegister an endpoint
DELETE/webhooks/{id}Remove an endpoint
GET/webhooks/{id}/deliveriesWhat we tried to send, and why it failed
POST/webhooks/{id}/replayRe-queue failed or abandoned deliveries
POST/webhooks/{id}/enableClear an automatic disable

04Paging through a list

Lists are cursor-paged, not offset-paged — conversations reorder constantly as messages arrive, so page numbers would silently skip or repeat records.

GET /v1/conversations?limit=50
GET /v1/conversations?limit=50&cursor=eyJ2IjoiMjAyNi0wOC0xMi4uLg

Every list responds with the same envelope:

{
  "data": [ … ],
  "has_more": true,
  "next_cursor": "eyJ2IjoiMjAyNi0wOC0xMi4uLg"
}

Keep passing next_cursor back unchanged until has_more is false. The cursor is opaque — do not parse or build one. limit defaults to 25 and caps at 100.

05Sending a message

Every send requires an Idempotency-Key header: any unique string you generate, 8–255 characters, reused unchanged if you retry. Without it, a network timeout you retry delivers the message twice to a real person.

curl -X POST https://cx.ikonia.co.za/api/v1/messages \
  -H "Authorization: Bearer ikx_live_YOUR_KEY" \
  -H "Idempotency-Key: order-4821-shipped" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "email",
    "to": "maya.fields@example.test",
    "subject": "Your order has shipped",
    "content": "Hi Maya — your beans are on the way."
  }'

Unknown recipients become contacts automatically, matched on email or phone so a repeat send finds the same person rather than creating a duplicate. To reply inside an existing thread, post to /conversations/{id}/messages instead — same idempotency rule.

Replay the same idempotency key and the response comes back with "duplicate": true and the original message id. Nothing is sent a second time. More on retrying safely.

06Linking contacts to your own records

If you hold the master record for a customer — a lead in your CRM — write that id onto the contact with external_ref. It is the join between the two systems: your id for who they are, ours for everything ever said to them.

curl -X PATCH https://cx.ikonia.co.za/api/v1/contacts/{id}   -H "Authorization: Bearer ikx_live_YOUR_KEY"   -H "Content-Type: application/json"   -d '{ "external_ref": "LEAD-4821" }'

Once set, you can go in either direction without storing our ids:

GET /v1/contacts?external_ref=LEAD-4821
GET /v1/contacts/{id}/conversations

Linking a contact stops IkoniaCX replying to them automatically. AI auto-replies, the WhatsApp chatbot and out-of-hours replies all go silent for a linked contact, because your system now owns the relationship and two systems answering one lead is worse than none. Inbound is still received and recorded, and an agent can still reply by hand. Unlink to restore it.

Every message.received and message.sent event carries contact_external_ref, so you can tell whether an event concerns one of your records without calling back for the contact. It is null for contacts you have not linked — the key is always present.

07Receiving webhooks

Register an HTTPS endpoint and IkoniaCX will POST events to it. The URL must resolve to a public address — private and internal ranges are rejected at registration and re-checked on every delivery.

curl -X POST https://cx.ikonia.co.za/api/v1/webhooks \
  -H "Authorization: Bearer ikx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://crm.example.com/hooks/ikoniacx",
    "events": ["message.received", "ticket.created"]
  }'

The response contains a signing secret (whsec_…) shown once. Store it.

Events

Verifying the signature

Each delivery carries X-IkoniaCX-Event, X-IkoniaCX-Delivery and X-IkoniaCX-Signature. The signature is t=<unix>,v1=<hex>, where the HMAC-SHA256 covers "<t>.<raw body>" — the timestamp is inside the signed string, so a captured request cannot be replayed later.

// Verify against the RAW body — parse the JSON only after this passes.
const { createHmac, timingSafeEqual } = require('crypto')

function verify(secret, rawBody, header) {
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')))
  const t = Number(parts.t)

  // Reject anything older than five minutes.
  if (Math.abs(Date.now() / 1000 - t) > 300) return false

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

Reply 2xx within 10 seconds. Anything else — including a redirect, which is never followed — counts as a failure and is retried with backoff for about seven days before being abandoned. Do your real work after responding, not before.

After 20 consecutive failures we stop attempting delivery and email your admins. Events keep queueing while that is true, so nothing is lost — call POST /v1/webhooks/{id}/enable when your receiver is healthy and the backlog goes out immediately.

To see what was missed, list deliveries and re-queue them:

GET  /v1/webhooks/{id}/deliveries?status=abandoned
POST /v1/webhooks/{id}/replay   { "since": "2026-08-12T00:00:00Z" }

Replay defaults to failed and abandoned only. Payloads are kept for 14 days.

08Staying in sync

Webhooks are the fast path, not the complete one. If your receiver was down past the retry window, or was up but wrong, replay only helps with the first. Reconcile instead: ask what changed, and what went away.

GET /v1/contacts?updated_since=2026-08-12T00:00:00Z
GET /v1/conversations?updated_since=2026-08-12T00:00:00Z
GET /v1/deletions?since=2026-08-12T00:00:00Z

A reasonable pattern: run on webhooks, and reconcile on a schedule — nightly is usually enough — passing the timestamp of your last successful run.

09Errors and rate limits

Errors are RFC 7807 application/problem+json. Switch on code; show detail to whoever has to fix it.

{
  "type":   "https://cx.ikonia.co.za/docs/api/errors#insufficient_scope",
  "title":  "insufficient scope",
  "status": 403,
  "code":   "insufficient_scope",
  "detail": "This key is missing the \"tickets:write\" scope. Add it under Settings → API keys."
}

A 404 not_found means the record does not exist or belongs to another organisation — the two are deliberately indistinguishable.

Rate limits are per key, per minute, in three separate budgets: 600 reads, 120 writes and 60 sends. Sends are metered hardest because they cost money and reach real people. Every response carries X-RateLimit-Remaining; on 429 rate_limited, wait the seconds given in Retry-After rather than spinning.

10Known gaps

Worth knowing before you design around them.