REST API

REST API

A key-authenticated JSON API to manage conversations, tickets, knowledge base content, and webhooks. Every request is scoped to your workspace.

Conventions

Consistent base URL, authentication, and response envelope across every endpoint.

Base URL

All endpoints are relative to the versioned base URL.

text
https://awn.care/api/v1

Authentication

Authenticate with an API key created in the Developer Console, passed in the x-api-key header. An API key acts with workspace-admin scope.

bash
curl https://awn.care/api/v1/conversations \
  -H "x-api-key: YOUR_API_KEY"

Keep keys secret

Treat API keys like passwords. Use them only from server-side code — never expose a key in a browser or mobile app.

Response envelope

Successful responses wrap the payload in a consistent envelope.

json
{
  "success": true,
  "data": { /* resource or array */ }
}

List endpoints that paginate add a pagination object.

json
{
  "success": true,
  "data": [ /* … */ ],
  "pagination": {
    "page": 1,
    "perPage": 25,
    "total": 128,
    "totalPages": 6
  }
}

Errors return success: false with a human-readable message and an appropriate HTTP status.

json
{
  "success": false,
  "error": "Invalid API key"
}
Pagination is not uniform: most lists use page and per_page, but tickets use page and pageSize, and some lists (faqs, categories, departments, saved-replies) return a plain array.

Conversations

List, read, update, and delete conversations, and read or send messages within them.

GET/conversations

List conversations in the workspace, newest activity first. Paginated.

Query parameters

FieldTypeDescription
statusstringFilter by conversation status (e.g. OPEN, CLOSED).
agent_idstringFilter by assigned agent; pass "unassigned" for none.
department_idstringFilter by department.
searchstringMatch subject, visitor name/email, or message content.
pagenumberPage number (default 1).
per_pagenumberItems per page (default 25, max 100).

Request

bash
curl "https://awn.care/api/v1/conversations?status=OPEN&per_page=25" \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "cnv_8f2a…",
      "subject": "Refund for order #1043",
      "status": "OPEN",
      "channel": "CHAT",
      "priority": "NORMAL",
      "agentId": "usr_agent_1",
      "departmentId": "dep_2",
      "lastMessageAt": "2026-07-31T09:12:44.000Z",
      "visitor": { "id": "vis_1", "name": "Sara", "email": "[email protected]", "online": true },
      "agent": { "id": "usr_agent_1", "name": "Mona", "email": "[email protected]" },
      "department": { "id": "dep_2", "nameAr": "المبيعات", "nameEn": "Sales" },
      "messages": [ { "id": "msg_9", "content": "Any update?", "type": "TEXT" } ]
    }
  ],
  "pagination": { "page": 1, "perPage": 25, "total": 128, "totalPages": 6 }
}
POST/conversations

Create a conversation for a visitor. An agent is auto-assigned by the routing engine when available.

Body

FieldTypeDescription
visitorIdRequiredstringId of the visitor the conversation belongs to.
departmentIdstringOptional department to route to.
subjectstringOptional conversation subject.
channelstringOrigin channel (default CHAT).

Request

bash
curl -X POST https://awn.care/api/v1/conversations \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "visitorId": "vis_1",
    "departmentId": "dep_2",
    "subject": "Refund for order #1043",
    "channel": "CHAT"
  }'
GET/conversations/{id}

Retrieve a single conversation with its visitor, agent, department, and tags.

Request

bash
curl https://awn.care/api/v1/conversations/cnv_8f2a \
  -H "x-api-key: YOUR_API_KEY"
PATCH/conversations/{id}

Update a conversation's status, assignee, department, subject, priority, or metadata.

Body

FieldTypeDescription
statusstringNew status for the conversation.
agentIdstring | nullAssign to an agent, or null to unassign.
departmentIdstring | nullOptional department to route to.
subjectstring | nullOptional conversation subject.
prioritystringConversation priority.
metadataobjectArbitrary metadata object.

Request

bash
curl -X PATCH https://awn.care/api/v1/conversations/cnv_8f2a \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "CLOSED", "agentId": "usr_agent_1", "priority": "HIGH" }'
DELETE/conversations/{id}

Soft-delete a conversation (moves to Trash). Deleting one already in Trash removes it permanently.

Request

bash
curl -X DELETE https://awn.care/api/v1/conversations/cnv_8f2a \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{ "success": true, "data": { "deleted": true, "permanent": false } }
GET/conversations/{id}/messages

List messages in a conversation, oldest first. Paginated.

Query parameters

FieldTypeDescription
pagenumberPage number (default 1).
per_pagenumberItems per page (default 25, max 100).

Request

bash
curl "https://awn.care/api/v1/conversations/cnv_8f2a/messages?per_page=50" \
  -H "x-api-key: YOUR_API_KEY"
POST/conversations/{id}/messages

Send a message into a conversation. Requires content, attachments, or a RICH type.

Body

FieldTypeDescription
contentstringMessage text. Required unless attachments or a RICH type are given.
type"TEXT" | "NOTE" | "RICH" | "FILE"Message type. NOTE is an internal, agents-only note.
attachmentsarrayArray of file attachments.
replyToIdstringId of the message this replies to.
metadataobjectArbitrary metadata object.

Request

bash
curl -X POST https://awn.care/api/v1/conversations/cnv_8f2a/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "content": "تم اعتماد استرداد مبلغك.", "type": "TEXT" }'

Response

json
{
  "success": true,
  "data": {
    "id": "msg_10",
    "conversationId": "cnv_8f2a",
    "content": "تم اعتماد استرداد مبلغك.",
    "type": "TEXT",
    "userId": "api",
    "createdAt": "2026-07-31T09:20:00.000Z",
    "user": { "id": "api", "name": "API", "role": "ADMIN" }
  }
}

Tickets

A full ticketing surface: list, create, read the 360 view, update, and comment.

Ticket endpoints require an agent, supervisor, or admin. API keys always pass this check.
GET/tickets

List tickets, most recently updated first. Note: uses page and pageSize (not per_page).

Query parameters

FieldTypeDescription
statusstringFilter by status. Comma-separated list allowed (e.g. OPEN,PENDING).
prioritystringFilter by priority (LOW, NORMAL, HIGH, URGENT).
assigneeIdstringFilter by assignee; "me" for yourself, "unassigned" for none.
requesterIdstringFilter by requester id.
qstringMatch subject text or ticket number.
pagenumberPage number (default 1).
pageSizenumberItems per page (default 25, max 100).

Request

bash
curl "https://awn.care/api/v1/tickets?status=OPEN,PENDING&priority=HIGH&page=1&pageSize=25" \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": {
    "tickets": [
      {
        "id": "tkt_5",
        "number": 1043,
        "subject": "Cannot log in",
        "status": "OPEN",
        "priority": "HIGH",
        "type": "INCIDENT",
        "requester": { "id": "vis_1", "name": "Sara", "email": "[email protected]" },
        "assignee": { "id": "usr_agent_1", "name": "Mona" },
        "department": { "id": "dep_1", "nameAr": "الدعم", "nameEn": "Support" },
        "_count": { "comments": 3 }
      }
    ],
    "total": 42,
    "page": 1,
    "pageSize": 25
  }
}
POST/tickets

Create a ticket. The requester must be a contact in the workspace.

Body

FieldTypeDescription
subjectRequiredstring (1–500)Ticket subject, 1–500 characters.
descriptionRequiredstringThe ticket body.
requesterIdRequiredstringId of the requesting contact (VISITOR, LEAD, or USER).
priority"LOW" | "NORMAL" | "HIGH" | "URGENT"Ticket priority.
type"QUESTION" | "INCIDENT" | "PROBLEM" | "TASK"Ticket type.
departmentIdstring | nullOptional department to route to.
assigneeIdstring | nullOptional agent to assign.
tagsstring[] (max 50)Up to 50 free-form tags.

Request

bash
curl -X POST https://awn.care/api/v1/tickets \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Cannot log in",
    "description": "Getting a 500 error on sign-in since this morning.",
    "requesterId": "vis_1",
    "priority": "HIGH",
    "type": "INCIDENT",
    "tags": ["auth", "urgent"]
  }'
GET/tickets/{id}

Retrieve a ticket with its comments, events, and requester context (other tickets and conversations).

Request

bash
curl https://awn.care/api/v1/tickets/tkt_5 \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": {
    "ticket": {
      "id": "tkt_5",
      "number": 1043,
      "subject": "Cannot log in",
      "status": "OPEN",
      "priority": "HIGH",
      "requester": { "id": "vis_1", "name": "Sara", "email": "[email protected]" },
      "assignee": { "id": "usr_agent_1", "name": "Mona" },
      "comments": [ { "id": "cmt_1", "body": "Looking into it", "isInternal": false } ],
      "events": [ { "id": "evt_1", "type": "created" } ]
    },
    "requesterContext": {
      "otherTickets": [ { "id": "tkt_2", "number": 1001, "subject": "Billing" } ],
      "conversations": [ { "id": "cnv_1", "status": "CLOSED" } ]
    }
  }
}
PATCH/tickets/{id}

Update a ticket. Provide at least one field. Setting status to SOLVED triggers a CSAT survey.

Body

FieldTypeDescription
status"NEW" | "OPEN" | "PENDING" | "ON_HOLD" | "SOLVED" | "CLOSED"New ticket status.
prioritystringTicket priority.
typestringTicket type.
assigneeIdstring | nullOptional agent to assign.
departmentIdstring | nullOptional department to route to.
tagsstring[]Up to 50 free-form tags.
subjectstring (1–500)Ticket subject, 1–500 characters.

Request

bash
curl -X PATCH https://awn.care/api/v1/tickets/tkt_5 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "SOLVED", "assigneeId": "usr_agent_1" }'
POST/tickets/{id}/comments

Add a comment. Public replies email the other party; internal notes stay private.

Body

FieldTypeDescription
bodyRequiredstringThe comment text.
isInternalbooleanWhen true, the comment is an internal note (default false).

Request

bash
curl -X POST https://awn.care/api/v1/tickets/tkt_5/comments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "body": "We deployed a fix — please try again.", "isInternal": false }'

Response

json
{
  "success": true,
  "data": {
    "comment": { "id": "cmt_2", "body": "We deployed a fix — please try again.", "isInternal": false },
    "statusChanged": "PENDING"
  }
}

Articles

Manage knowledge base articles (bilingual title and content).

GET/articles

List articles, newest first. Paginated.

Query parameters

FieldTypeDescription
statusstringFilter by status (e.g. DRAFT, PUBLISHED).
category_idstringFilter by category.
searchstringMatch Arabic/English title or content.
pagenumberPage number (default 1).
per_pagenumberItems per page (default 25, max 100).

Request

bash
curl "https://awn.care/api/v1/articles?status=PUBLISHED&search=refund" \
  -H "x-api-key: YOUR_API_KEY"
POST/articles

Create an article. Slugs are generated automatically from the titles.

Body

FieldTypeDescription
titleArRequiredstringArabic title.
titleEnRequiredstringEnglish title.
contentArstringArabic body.
contentEnstringEnglish body.
categoryIdstringCategory to file the article under.
status"DRAFT" | "PUBLISHED"Publication status (default DRAFT).
keywordsstring[]Search keywords.

Request

bash
curl -X POST https://awn.care/api/v1/articles \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "titleAr": "سياسة الاسترداد",
    "titleEn": "Refund policy",
    "contentAr": "…",
    "contentEn": "…",
    "categoryId": "cat_1",
    "status": "PUBLISHED",
    "keywords": ["refund", "returns"]
  }'

Response

json
{
  "success": true,
  "data": {
    "id": "art_7",
    "titleAr": "سياسة الاسترداد",
    "titleEn": "Refund policy",
    "slugEn": "refund-policy",
    "status": "PUBLISHED",
    "category": { "id": "cat_1", "nameEn": "Billing" }
  }
}
PATCH/articles/{id}

Update an article. Content changes snapshot a prior version.

Request

bash
curl -X PATCH https://awn.care/api/v1/articles/art_7 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "PUBLISHED" }'
DELETE/articles/{id}

Delete an article permanently.

Request

bash
curl -X DELETE https://awn.care/api/v1/articles/art_7 \
  -H "x-api-key: YOUR_API_KEY"

FAQs

Manage bilingual frequently asked questions. The list endpoint returns a plain array (no pagination).

GET/faqs

List FAQs, ordered by sort order.

Query parameters

FieldTypeDescription
categoryIdstringFilter by (or file under) a category.
qstringMatch the question or answer text.

Request

bash
curl "https://awn.care/api/v1/faqs?categoryId=cat_1" \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "faq_3",
      "questionEn": "How do I request a refund?",
      "answerEn": "…",
      "published": true,
      "sortOrder": 0,
      "category": { "id": "cat_1", "nameAr": "الفوترة", "nameEn": "Billing" }
    }
  ]
}
POST/faqs

Create an FAQ. All four bilingual fields are required.

Body

FieldTypeDescription
questionArRequiredstringArabic question.
questionEnRequiredstringEnglish question.
answerArRequiredstringArabic answer.
answerEnRequiredstringEnglish answer.
categoryIdstringFilter by (or file under) a category.
publishedbooleanWhether the FAQ is visible (default true).
sortOrdernumberOrdering weight (default 0).

Request

bash
curl -X POST https://awn.care/api/v1/faqs \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "questionAr": "كيف أطلب استردادًا؟",
    "questionEn": "How do I request a refund?",
    "answerAr": "…",
    "answerEn": "…",
    "categoryId": "cat_1",
    "published": true,
    "sortOrder": 0
  }'
PATCH/faqs/{id}

Update an FAQ.

Request

bash
curl -X PATCH https://awn.care/api/v1/faqs/faq_3 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "published": false }'
DELETE/faqs/{id}

Delete an FAQ.

Request

bash
curl -X DELETE https://awn.care/api/v1/faqs/faq_3 \
  -H "x-api-key: YOUR_API_KEY"

Categories

Manage knowledge base categories. The list endpoint returns a plain array with article counts and children.

GET/categories

List all categories, ordered by sort order.

Request

bash
curl https://awn.care/api/v1/categories \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "cat_1",
      "nameAr": "الفوترة",
      "nameEn": "Billing",
      "slugEn": "billing",
      "icon": "CreditCard",
      "sortOrder": 0,
      "_count": { "articles": 12 },
      "children": []
    }
  ]
}
POST/categories

Create a category. Slugs and sort order are assigned automatically.

Body

FieldTypeDescription
nameArRequiredstringArabic name.
nameEnRequiredstringEnglish name.
descriptionArstringArabic description.
descriptionEnstringEnglish description.
iconstringIcon name (default Folder).
parentIdstring | nullParent category id for nesting.
visibilitystringVisibility (default public).

Request

bash
curl -X POST https://awn.care/api/v1/categories \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nameAr": "الفوترة",
    "nameEn": "Billing",
    "icon": "CreditCard",
    "visibility": "public"
  }'
PATCH/categories/{id}

Update a category.

Request

bash
curl -X PATCH https://awn.care/api/v1/categories/cat_1 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "nameEn": "Payments", "sortOrder": 1 }'
DELETE/categories/{id}

Delete a category. Its articles are unlinked, not deleted.

Request

bash
curl -X DELETE https://awn.care/api/v1/categories/cat_1 \
  -H "x-api-key: YOUR_API_KEY"

Departments

Manage routing departments. The list endpoint returns a plain array.

GET/departments

List all departments, oldest first.

Request

bash
curl https://awn.care/api/v1/departments \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "dep_2",
      "nameAr": "المبيعات",
      "nameEn": "Sales",
      "isDefault": false,
      "isOnline": true,
      "priority": 0,
      "skills": []
    }
  ]
}
POST/departments

Create a department.

Body

FieldTypeDescription
nameArRequiredstringArabic name.
nameEnRequiredstringEnglish name.
descriptionstringOptional description.
isDefaultbooleanMake this the default department (un-defaults the others).
isOnlinebooleanWhether the department accepts chats (default true).
prioritynumberRouting priority weight (default 0).
skillsstring[]Skill tags used by skills-based routing.

Request

bash
curl -X POST https://awn.care/api/v1/departments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nameAr": "المبيعات",
    "nameEn": "Sales",
    "isOnline": true,
    "priority": 0
  }'
PATCH/departments/{id}

Update a department.

Request

bash
curl -X PATCH https://awn.care/api/v1/departments/dep_2 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isOnline": false }'
DELETE/departments/{id}

Delete a department. The default department cannot be deleted.

Request

bash
curl -X DELETE https://awn.care/api/v1/departments/dep_2 \
  -H "x-api-key: YOUR_API_KEY"

Saved replies

Manage canned responses (macros) keyed by a shortcut. The list endpoint returns a plain array.

GET/saved-replies

List saved replies, newest first.

Query parameters

FieldTypeDescription
searchstringMatch shortcut or title.

Request

bash
curl "https://awn.care/api/v1/saved-replies?search=refund" \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "sr_4",
      "shortcut": "/refund",
      "titleEn": "Refund approved",
      "contentAr": "تمت الموافقة على الاسترداد.",
      "contentEn": "Your refund has been approved."
    }
  ]
}
POST/saved-replies

Create a saved reply. The shortcut must be unique in the workspace.

Body

FieldTypeDescription
shortcutRequiredstringThe trigger shortcut, e.g. /refund. Must be unique.
titleArstringArabic title (defaults to the shortcut).
titleEnstringEnglish title (defaults to the shortcut).
contentArRequiredstringArabic reply body.
contentEnRequiredstringEnglish reply body.

Request

bash
curl -X POST https://awn.care/api/v1/saved-replies \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shortcut": "/refund",
    "titleEn": "Refund approved",
    "contentAr": "تمت الموافقة على الاسترداد.",
    "contentEn": "Your refund has been approved."
  }'
PATCH/saved-replies/{id}

Update a saved reply.

Request

bash
curl -X PATCH https://awn.care/api/v1/saved-replies/sr_4 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "contentEn": "Your refund is on its way." }'
DELETE/saved-replies/{id}

Delete a saved reply.

Request

bash
curl -X DELETE https://awn.care/api/v1/saved-replies/sr_4 \
  -H "x-api-key: YOUR_API_KEY"

Webhooks management

Programmatically create and manage webhook endpoints. See the Webhooks guide for delivery, signing, and retries.

For the event catalog, envelope shape, and signature verification, see the Webhooks guide.
GET/webhooks

List webhook endpoints. Secrets are masked. Paginated.

Request

bash
curl https://awn.care/api/v1/webhooks \
  -H "x-api-key: YOUR_API_KEY"
POST/webhooks

Create an endpoint. The full signing secret is returned exactly once — store it now.

Body

FieldTypeDescription
urlRequiredstring (https)HTTPS endpoint URL (http allowed only for localhost).
eventsRequiredstring[]Non-empty array of event names to subscribe to.
descriptionstringOptional label for the endpoint.

Request

bash
curl -X POST https://awn.care/api/v1/webhooks \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/awncare",
    "events": ["ticket.created", "message.created"],
    "description": "Prod ticket sync"
  }'

Response

json
{
  "success": true,
  "data": {
    "id": "whk_1",
    "url": "https://example.com/hooks/awncare",
    "events": ["ticket.created", "message.created"],
    "description": "Prod ticket sync",
    "active": true,
    "failCount": 0,
    "secret": "whsec_9c1f…full-secret-shown-once…",
    "createdAt": "2026-07-31T09:00:00.000Z"
  }
}
GET/webhooks/{id}

Retrieve an endpoint (secret masked).

Request

bash
curl https://awn.care/api/v1/webhooks/whk_1 \
  -H "x-api-key: YOUR_API_KEY"
PATCH/webhooks/{id}

Update an endpoint's url, events, active flag, or description.

Body

FieldTypeDescription
urlstring (https)HTTPS endpoint URL (http allowed only for localhost).
eventsstring[]Non-empty array of event names to subscribe to.
activebooleanEnable or disable the endpoint. Re-enabling resets the failure count.
descriptionstring | nullOptional label for the endpoint.

Request

bash
curl -X PATCH https://awn.care/api/v1/webhooks/whk_1 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "active": false }'
DELETE/webhooks/{id}

Delete an endpoint.

Request

bash
curl -X DELETE https://awn.care/api/v1/webhooks/whk_1 \
  -H "x-api-key: YOUR_API_KEY"
POST/webhooks/{id}/test

Send a live ping to the endpoint. Does not affect its failure count.

Request

bash
curl -X POST https://awn.care/api/v1/webhooks/whk_1/test \
  -H "x-api-key: YOUR_API_KEY"
GET/webhooks/{id}/deliveries

List the latest 50 delivery attempts for an endpoint.

Request

bash
curl https://awn.care/api/v1/webhooks/whk_1/deliveries \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": [
    {
      "id": "dlv_20",
      "event": "ticket.created",
      "status": "success",
      "attempts": 1,
      "responseCode": 200,
      "error": null,
      "nextRetryAt": null,
      "createdAt": "2026-07-31T09:01:00.000Z",
      "deliveredAt": "2026-07-31T09:01:00.420Z"
    }
  ]
}

Reports

A read-only analytics summary for a date range.

GET/reports

Return aggregate metrics — volumes, response and resolution times, breakdowns, top agents, and time series.

Query parameters

FieldTypeDescription
rangenumber (days)Number of days back to include (default 7).
fromISO dateStart date (ISO). Use with 'to' instead of range.
toISO dateEnd date (ISO), inclusive of the whole day.

Request

bash
curl "https://awn.care/api/v1/reports?range=7" \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": {
    "totalConversations": 1280,
    "conversationsInRange": 214,
    "messagesInRange": 3120,
    "avgFirstResponseMs": 48000,
    "avgResolutionMs": 5400000,
    "resolutionRate": 0.86,
    "statusBreakdown": { "OPEN": 42, "CLOSED": 172 },
    "channelBreakdown": [ { "channel": "CHAT", "count": 180 } ],
    "topAgents": [ { "id": "usr_agent_1", "name": "Mona", "conversations": 64 } ],
    "conversationsByDay": [ { "date": "2026-07-25", "count": 31 } ]
  }
}

Visitors

Read and update visitor (contact) profiles.

There is no list or create endpoint for visitors, and no delete — only get and update by id.
GET/visitors/{id}

Retrieve a visitor profile with tags and conversation/message counts.

Request

bash
curl https://awn.care/api/v1/visitors/vis_1 \
  -H "x-api-key: YOUR_API_KEY"

Response

json
{
  "success": true,
  "data": {
    "id": "vis_1",
    "name": "Sara Al-Otaibi",
    "email": "[email protected]",
    "role": "LEAD",
    "online": false,
    "metadata": { "company": "Acme", "visitCount": 4 }
  }
}
PATCH/visitors/{id}

Update a visitor. Role changes are promotion-only (VISITOR → LEAD → USER). Contact fields are merged into metadata.

Body

FieldTypeDescription
namestring | nullDisplay name, or null to clear.
emailstring | nullEmail address, or null to clear.
phonestringPhone number (stored in metadata).
companystringCompany name (stored in metadata).
role"LEAD" | "USER"Promote the contact (VISITOR → LEAD → USER).
scorenumberLead score (integer).

Request

bash
curl -X PATCH https://awn.care/api/v1/visitors/vis_1 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Sara Al-Otaibi", "company": "Acme", "score": 80 }'