Developers
ChatInCart API
A REST API and signed webhooks for syncing contacts, reading conversations and replying as your team — so ChatInCart fits into your CRM, help desk and data stack.
Overview
- Base URL:
https://api.chatincart.com/api/v1 - JSON in, JSON out. Send
Content-Type: application/jsonon writes. - Timestamps are ISO 8601 in UTC. IDs are integers.
- Available on Growth and Scale plans. Replies sent through the API are human replies, so they never use AI credits.
Authentication
Create a key in Dashboard → Settings → Developers. Owners and admins can create keys. The full key is shown once; we store only a hash. Send it as a bearer token:
curl https://api.chatincart.com/api/v1/me \
-H "Authorization: Bearer cic_live_••••••••"{
"data": {
"workspace": { "id": 12, "name": "Acme", "slug": "acme", "plan": "Growth" },
"api_key": { "name": "HubSpot sync", "prefix": "cic_live_Ab3d", "scopes": ["contacts:read"], "expires_at": null }
}
}Keys belong to a workspace, not a person, and keep working if the creator leaves. Revoke a key at any time; it stops working immediately.
Scopes
Grant each key only what it needs. A request without the right scope returns 403 insufficient_scope.
| Scope | Allows |
|---|---|
| contacts:read | List and fetch contacts |
| contacts:write | Create (upsert by email) and update contacts |
| conversations:read | List conversations and read messages |
| conversations:write | Reply to a conversation as a teammate |
| tickets:read | List and fetch tickets and their messages |
| tickets:write | Create tickets, change status/priority/assignee/tags, reply and add notes |
Rate limits
Limits apply per API key, per minute: 240 on Growth and 600 on Scale. Every response includes:
X-RateLimit-Limit: 240
X-RateLimit-Remaining: 239Over the limit you get 429 rate_limited with a Retry-After header (seconds). Back off and retry after that time.
Errors
Errors use one shape. Branch on type, not on the message text.
{
"error": {
"type": "validation_failed",
"message": "The request has invalid fields.",
"fields": { "email": ["The email field must be a valid email address."] }
}
}| Status | type | Meaning |
|---|---|---|
| 401 | authentication_failed | Missing, invalid, expired or revoked key |
| 403 | plan_upgrade_required | The workspace plan does not include API access |
| 403 | insufficient_scope | The key lacks the scope for this endpoint |
| 404 | not_found | No such resource in this workspace |
| 409 | conflict | Another message is being sent to this conversation; retry shortly |
| 422 | validation_failed / invalid_author | Invalid input; see fields |
| 429 | rate_limited | Too many requests; see Retry-After |
| 500 | server_error | Our fault. Safe to retry with backoff |
Pagination
List endpoints are cursor-paginated, newest first (messages oldest first). Pass limit (1–100, default 25) and the next_cursor from the previous page as cursor.
{
"data": [ ... ],
"meta": { "limit": 25, "has_more": true, "next_cursor": "eyJpZCI6MTIzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9" }
}Contacts
A contact is a person who chatted with one of your AI agents (a “portal”). Use GET /portals to list portal IDs.
/contactscontacts:readportal_id, email, external_id, updated_since (ISO date), limit, cursor./contacts/{id}contacts:read{
"object": "contact",
"id": 981,
"portal_id": 4,
"email": "jane@example.com",
"name": "Jane Doe",
"phone": "+15550100",
"external_id": "crm_123",
"avatar_url": null,
"location": { "country_code": "US", "city": "Austin", "timezone": "America/Chicago" },
"attribution": {
"referrer": "https://www.google.com/",
"utm_source": "newsletter",
"first_page_url": "https://acme.com/pricing",
"current_page_url": "https://acme.com/checkout"
},
"blocked": false,
"last_seen_at": "2026-11-15T10:02:11+00:00",
"created_at": "2026-11-01T08:00:00+00:00",
"updated_at": "2026-11-15T10:02:11+00:00"
}/contactscontacts:writeemail within a portal: returns 201 when created, 200 when an existing contact was updated. Body: portal_id (required), email (required), name, phone, external_id.curl -X POST https://api.chatincart.com/api/v1/contacts \
-H "Authorization: Bearer $CHATINCART_KEY" \
-H "Content-Type: application/json" \
-d '{"portal_id": 4, "email": "jane@example.com", "name": "Jane Doe", "external_id": "crm_123"}'/contacts/{id}contacts:writename, phone, external_id, blocked. Blocked contacts cannot send messages.Conversations
/conversationsconversations:readportal_id, contact_id, handled_by (ai | human), updated_since./conversations/{id}conversations:read{
"object": "conversation",
"id": 5521,
"portal_id": 4,
"contact_id": 981,
"title": "Order status",
"handled_by": "human",
"handoff_reason": "customer_request",
"assignee_id": 7,
"country_code": "US",
"started_at": "2026-11-15T09:58:00+00:00",
"last_message_at": "2026-11-15T10:02:11+00:00",
"created_at": "2026-11-15T09:58:00+00:00"
}handoff_reason is one of customer_request, agent_takeover, ai_credits_exhausted, or null.
/conversations/{id}/messagesconversations:readauthor_type is contact, ai or teammate./conversations/{id}/replyconversations:writebody (required, up to 10,000 characters) and optional author_email — a workspace owner, admin or agent (defaults to the key's creator). The conversation switches to your team, the AI stops replying in it, and the customer sees the message live. Uses no AI credits.curl -X POST https://api.chatincart.com/api/v1/conversations/5521/reply \
-H "Authorization: Bearer $CHATINCART_KEY" \
-H "Content-Type: application/json" \
-d '{"body": "Your order ships today. Tracking: 1Z999...", "author_email": "sam@acme.com"}'Tickets
Tickets are addressed by their workspace ticket number — the #1042 your customers see. Statuses: new, open, pending (waiting on the customer), on_hold, solved, closed. Priorities: low, normal, high, urgent.
/ticketstickets:readstatus, priority, assignee_id, contact_id, requester_email, updated_since./tickets/{number}tickets:read/ticketstickets:writesubject, body, requester_email (required); requester_name, portal_id (links the contact), priority, type, tags, custom_fields./tickets/{number}tickets:writestatus, priority, type, subject, assignee_id, tags or custom_fields. Every change is recorded in the ticket's audit trail and fires ticket.updated./tickets/{number}/messagestickets:readinclude_notes=1 for internal notes too./tickets/{number}/messagestickets:writekind: reply (emailed to the requester, status becomes pending unless you pass status), note (internal) or customer (add a message from the customer, e.g. from your own form). Replies and notes are authored by author_email (an owner, admin or agent; defaults to the key's creator).{
"object": "ticket", "id": 311, "number": 1042,
"subject": "Order has not arrived", "status": "open", "priority": "high", "type": "question", "channel": "email",
"requester": { "email": "jane@example.com", "name": "Jane Doe" }, "assignee_id": 7, "tags": ["shipping"],
"sla": { "first_response_due_at": "2026-11-16T10:00:00+00:00", "resolution_due_at": "2026-11-18T17:00:00+00:00", "breached_at": null, "breach_type": null },
"ai": { "summary": "Order #5531 missing after 10 days.", "triage": { "category": "Shipping", "sentiment": "negative", "language": "en" } },
"csat": null, "created_at": "2026-11-15T09:58:00+00:00"
}Webhooks
Add HTTPS endpoints in Settings → Developers and choose events. We send a POST with a JSON body; respond with any 2xx within 10 seconds. Redirects are not followed.
| Event | When |
|---|---|
| contact.created | A new contact (visitor or customer) was created |
| contact.updated | Email, name, phone, external ID, avatar or blocked status changed |
| conversation.created | A customer started a conversation |
| conversation.message.created | A message was added by the customer, the AI or a teammate |
| conversation.handed_off | A conversation moved from the AI to your team |
| ticket.created | A ticket was created |
| ticket.updated | A ticket changed status, priority, assignee or fields |
| ticket.reply.created | A public reply or internal note was added to a ticket |
POST /your/endpoint
ChatInCart-Signature: t=1763201000,v1=5f2c...e91a
ChatInCart-Event: conversation.message.created
ChatInCart-Event-Id: 2f6c1d0e-7a2b-4c1e-9a55-0b8f3c9d1e22
ChatInCart-Delivery-Attempt: 1
{
"id": "2f6c1d0e-7a2b-4c1e-9a55-0b8f3c9d1e22",
"type": "conversation.message.created",
"created_at": "2026-11-15T10:02:11+00:00",
"workspace_id": 12,
"data": {
"message": {
"object": "message", "id": 77120, "conversation_id": 5521,
"author_type": "contact", "author_user_id": null,
"body": "Where is my order?", "created_at": "2026-11-15T10:02:11+00:00"
}
}
}- Retries: failed deliveries (non-2xx, timeout, connection error) are retried after 30s, 2m, 10m, 30m, 2h and 6h — 7 attempts over about 9 hours. Retries reuse the same
id, so de-duplicate on it. - Ordering is not guaranteed. Use
created_atand fetch the latest state from the API when order matters. - Auto-disable: an endpoint is switched off after 15 events in a row fail all retries. Re-enable it in the dashboard once fixed. You can send a test event and retry any failed delivery from the delivery log.
Verifying signatures
Each endpoint has a signing secret (whsec_…). The signature is HMAC-SHA256 of {t}.{raw body} with your secret, hex-encoded. Compute it over the raw request body, compare in constant time, and reject timestamps older than 5 minutes.
import crypto from "node:crypto";
import express from "express";
const app = express();
app.post("/webhooks/chatincart", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("ChatInCart-Signature") ?? "";
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", process.env.CHATINCART_WEBHOOK_SECRET)
.update(`${parts.t}.${req.body}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
const valid = parts.v1 && parts.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
if (!fresh || !valid) return res.sendStatus(400);
const event = JSON.parse(req.body);
// handle event.type, de-duplicate on event.id
res.sendStatus(204);
});$body = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_CHATINCART_SIGNATURE'] ?? ''), $sig);
$expected = hash_hmac('sha256', ($sig['t'] ?? '') . '.' . $body, getenv('CHATINCART_WEBHOOK_SECRET'));
if (abs(time() - (int) ($sig['t'] ?? 0)) > 300 || ! hash_equals($expected, $sig['v1'] ?? '')) {
http_response_code(400);
exit;
}
$event = json_decode($body, true);import hmac, hashlib, os, time
from flask import request, abort
@app.post("/webhooks/chatincart")
def chatincart_webhook():
raw = request.get_data()
parts = dict(p.split("=", 1) for p in request.headers.get("ChatInCart-Signature", "").split(","))
expected = hmac.new(os.environ["CHATINCART_WEBHOOK_SECRET"].encode(),
f"{parts.get('t')}.".encode() + raw, hashlib.sha256).hexdigest()
if abs(time.time() - int(parts.get("t", 0))) > 300 or not hmac.compare_digest(expected, parts.get("v1", "")):
abort(400)
event = request.get_json()
return "", 204Security checklist
- Keep keys on your server. Never put an API key in a browser, mobile app or public repository.
- Use one key per integration with the fewest scopes, and set an expiry for temporary access.
- Rotate a webhook secret from the dashboard if it may have leaked; the old secret stops working immediately.
- Always verify webhook signatures and timestamps before trusting a payload.
- Webhook URLs must be public HTTPS. Private, loopback and cloud-metadata addresses are rejected.
Versioning
The API is versioned in the path (/v1). Within v1 we only make additive changes: new endpoints, new optional parameters, new fields and new event types. Build clients that ignore unknown fields. Breaking changes ship as a new version with advance notice.