Enterprise Release

Public API V2 Endpoint Document

Mar 28 2025

Share

Public API V2 Endpoint Document

Overview:

  • Create Training data
  • Chat with bot
  • Get list customers
  • Get customer detail
  • Get list conversations by customers
  • Get conversation detail
  • Upload file

Postman Link:

https://www.postman.com/

Workspace token can be acquired in workspace general settings, as shown in the picture below:

Bot id can be acquired from parameter aid in launch bot URL

https://chat-demo.cxgenie.ai?aid=<bot_id>

or attribute data-aid in launch bot widget

<script 
    src="https://widget-demo.cxgenie.ai/widget.js" 
    data-aid="<BOT_ID>" 
    data-lang="lang"
></script>

image.png

Create training data:

Path: https://api-demo.cxgenie.ai/api/v2/public-api/bot-data

Method: POST

Payload:

{
 "bot_id": "string",
 "content": "string",
 "content_value": "string",
 "type": "TEXT" | "DOCUMENT" | "Q_AND_A" | "URL",
 "title": "string",
 "workspace_token": "string"
}

Property content_value and title is optional, since content_value is used for Q_AND_A type knowledges and title is used for Article type knowledges (which is indicated as TEXT)

Result:

{
 "success": boolean,
 "data": {
   "id": "uuid",
   "bot_id": "uuid",
   "content": "string",
   "content_value": "string",
   "type": "TEXT" | "DOCUMENT" | "Q_AND_A" | "URL",
   "title": "string" | null,
   "status_learning": "WAITING",
   "updated_at": Date,
   "created_at": Date,
   "source": "USER",
   "total_relearning": number | null,
   "filename": "string" | null,
   "size": number | null,
   "mimetype": "string" | null,
   "created_by": null,
   "updated_by": null,
   "deleted_at": null
 }
}

Chat with bot:

Path: https://api-demo.cxgenie.ai/api/v2/public-api/messages

Method: POST

Payload:

{
 "workspace_token": "string",
 "bot_id": "string",
 "media": {
   "uid": "string",
   "name": "string",
   "size": number,
   "url": "string",
   "type": "image/jpeg"
    }[],
 "content": "string",
 "metadata": {},
 "customer_info": {
   "name": "string",
   "email": "string",
   "phone_number": "string",
   "external_id": "string"
 }
}

Property customer_info is optional, if not provided, the chat session will be count as an Anonymous session. The field inside this object is simulated as customer entering their information upon entering chat session.

Property media is optional, the information of file to use on property media can be acquired via upload endpoint.

Result:

{
    "success": boolean,
    "data": "string"
}

Get list customers

Path: https://api-demo.cxgenie.ai/api/v2/public-api/customer-list

Method: GET

Query:

{
    "search": "string";
 "bot_ids": "string"[];
    "types": <"lead" | "users">[];
 "is_testing": boolean;
 "cursor": date_string;
 "workspace_token": string;
}

All the property except workspace_token is optional, types is used to differentiate customers that has both phone and email or not (users will have both phone and email, else otherwise)

Property cursor is provided as pagination method, since this data changes frequently, which traditional method (limit and offset) can cause missing records when querying. Cursor will use created_at as the property to query.

Result:

{
 "success": boolean,
 "data": {
   "total": number,
   "customers": [
     {
       "id": "string",
       "name": "string",
       "access_token": null,
       "metadata": {},
       "is_full_history_chat": boolean,
       "extract_knowledge_status": "string" | null,
       "conversation_status": "OPENED" | "CLOSED",
       "last_extract_data_conversation": Date | null,
       "last_summary": Date | null,
       "last_recap": Date | null,
       "total_summary_one_hour":  number | null,
       "avatar": "string" | null,
       "email": "string",
       "phone_number": "string",
       "country_code": "string" | null,
       "country": "string" | null,
       "country_flag": "string" | null,
       "discord_id": "string" | null,
       "note": "string" | null,
       "bot_id": "string",
       "auto_reply": boolean,
       "workspace_id": "string",
       "is_read": boolean,
       "external_id": "uuid" | null,
       "language_using": "string",
       "vocative": "",
       "source": "string",
       "source_type": "string",
       "class": "string" | null,
       "last_message_at": Date,
       "message_id": "uuid",
       "last_social_message": jsonb | null,
       "is_testing": boolean,
       "is_hidden": boolean,
       "conversation_id": null | "uuid",
       "last_session_id": "uuid",
       "conversation_state": "OPEN" | "CLOSED",
       "is_generating_tag": boolean | null,
       "social_account_id": "uuid" | null,
       "customer_category_id": "uuid" | null,
       "queued_at": Date,
       "created_at": Date,
       "updated_at": Date,
       "deleted_at": Date | null,
       "customer_category": {
            "id": "uuid",
            "name": "string",
            "workspace_id": "string",
            "created_at": Date,
            "updated_at": Date,
            "deleted_at": null | Date
       } | null,
       "bot": {
         "id": "string",
         "auto_reply": boolean,
         "auto_suggestion": boolean,
         "name": "string",
         "avatar": "string",
         "is_watermark_shown": boolean,
         "is_allow_learning_from_conversation": boolean,
         "member_import_knowledge_from_conversation": jsonb[]
       },
       "contact_tag_ids": string[]
     },
   },
 ]
}

Get customer detail

Path: https://api-demo.cxgenie.ai/api/v2/public-api/customer-detail/:customer_id

Method: GET

Query:

{
    "workshop_id": "string";
}

Result:

{
 "success": true,
 "data": {
   "id": "string",
   "name": "string",
   "access_token": null,
   "metadata": {},
   "is_full_history_chat": boolean,
   "extract_knowledge_status": "string" | null,
   "conversation_status": "OPENED" | "CLOSED",
   "last_extract_data_conversation": Date | null,
   "last_summary": Date | null,
   "last_recap": Date | null,
   "total_summary_one_hour":  number | null,
   "avatar": "string" | null,
   "email": "string",
   "phone_number": "string",
   "country_code": "string" | null,
   "country": "string" | null,
   "country_flag": "string" | null,
   "discord_id": "string" | null,
   "note": "string" | null,
   "bot_id": "string",
   "auto_reply": boolean,
   "workspace_id": "string",
   "is_read": boolean,
   "external_id": "uuid" | null,
   "language_using": "string",
   "vocative": "",
   "source": "string",
   "source_type": "string",
   "class": "string" | null,
   "last_message_at": Date,
   "message_id": "uuid",
   "last_social_message": jsonb | null,
   "is_testing": boolean,
   "is_hidden": boolean,
   "conversation_id": null | "uuid",
   "last_session_id": "uuid",
   "conversation_state": "OPEN" | "CLOSED",
   "is_generating_tag": boolean | null,
   "social_account_id": "uuid" | null,
   "customer_category_id": "uuid" | null,
   "queued_at": Date,
   "created_at": Date,
   "updated_at": Date,
   "deleted_at": Date | null,
   "replied_by": {
       "id": "uuid",
       "name": "string",
       "avatar": "string",
       "is_bot": boolean,
       "is_online": boolean,
       "is_available": boolean
   }[],
   "tag_list": [],
   "is_customer_answered": boolean,
   "agent_reply": boolean,
   "contact_tags": [],
   "customer_category": {
     "id": "uuid",
     "name": "string",
     "workspace_id": "string",
     "created_at": Date,
     "updated_at": Date,
     "deleted_at": null | Date
   } | null,
   "bot": {
     "id": "string",
     "auto_reply": boolean,
     "auto_suggestion": boolean,
     "name": "string",
     "avatar": "string",
     "is_watermark_shown": boolean,
     "is_allow_learning_from_conversation": boolean,
     "member_import_knowledge_from_conversation": jsonb[]
   },
   "social_account": null,
   "last_message": {
     "id": "uuid",
     "content": "string",
     "external_id": "uuid" | null,
     "rating": number,
     "reaction": "string" | null,
     "started_ticket_id": "uuid" | null,
     "media": {
            "uid": "string",
            "name": "string",
            "size": number,
            "url": "string",
            "type": "image/jpeg"
            }[],
     "receiver_id": "uuid",
     "bot_id": "uuid",
     "sender_id": "uuid" | null,
     "session_id": "uuid" | null,
     "block_id": "uuid" | null,
     "type": "TEXT" | 'IMAGE' | 'VIDEO' | 'FEEDBACK',
     "unsent": boolean,
     "meta_tags": json[],
     "data": json | null,
     "variables": json | null,
     "quoted_id": "uuid" | null,
     "disabled_submit_form": boolean | null,
     "notification_data": json | null,
     "count_message_notes": number | null,
     "language_using": "string",
     "total_qa_feedback": number,
     "receiver_read_at": Date | null,
     "created_at": Date,
     "updated_at": Date,
     "deleted_at": Date | null,
   },
   "last_session": {
     "id": "uuid",
     "created_at": Date | null,
     "status": "OPEN" | "CLOSED",
     "assignee_id": "uuid" | null
   },
 }
}

Get list conversations by customer

Path: https://api-demo.cxgenie.ai/api/v2/public-api/sessions-by-customer

Method: GET

Query:

{
    "limit": number, //Default 10
    "offset": number, //Default 0
    "workspace_token": string,
    "customer_id": uuid,
    "bot_ids": string,
    "status": <"OPEN", "CLOSED">[],
    "reply_status": <"UNREAD_ONLY", "READ_ONLY", "REPLIED_ONLY">[],
    "date_range": [start_timestamp_string, end_timestamp_string],
}

All the property except workspace_token and is optional, types is used to differentiate customers that has both phone and email or not (users will have both phone and email, else otherwise)

Result


 "success": true,
 "total": 1,
 "data": {
      id: "uuid";
      from_user_id: "uuid";
      to_user_id: string | null;
      created_at: Date;
      deleted_at: Date| null;
      updated_at: Date;
      bot_id: "uuid";
      workspace_id: "uuid";
      assignee_id: "uuid"| null;
      note: "string" | null;
      is_read: boolean;
      status: "OPEN" | "CLOSED";
      ticket_id: "uuid" | null;
      category_id: "uuid" | null;
      sub_category_id: "uuid" | null;
      team_id: "uuid" | null;
      last_message_by: "BOT" | "AGENT" | "CUSTOMER" | "SOCIAL_ACCOUNT";
      last_message_at: Date;
      social_account_id: "uuid" | null;
      last_message_id: "uuid";
      tag_ids: "uuid"[];
      reply_by_ids: ReplyBy[];
      last_social_message: "uuid" | null;
      is_last_session: boolean;
      queued_at: Date;
      source: "string";
      have_message_from_agent: boolean;
      auto_reply: boolean;
      bot: {
          auto_reply: boolean;
          auto_suggestion: boolean;
          id: "uuid";
          is_allow_learning_from_conversation: boolean;
          is_watermark_shown: boolean;
          member_import_knowledge_from_conversation: json[];
          reply_unknown: "string";
          name: "string";
          avatar: "string";
          is_max_conversation_usage: boolean;
          theme_color: "string";
        };
      customer: {
          id: "uuid";
          auto_reply: boolean;
          avatar: "uuid"| null;
          bot_id: "uuid";
          name: "string";
          country_code: "string" | null;
          country: "string" | null;
          country_flag: "string" | null;
          email: "string";
          phone_number: "string";
          external_id: "string" | null;
          is_full_history_chat: boolean;
          queued_at: Date;
          conversation_status: "OPENED" | "CLOSED";
          metadata: json;
        };
      social_account: json | null;
      last_message: {
     "id": "uuid",
     "content": "string",
     "external_id": "uuid" | null,
     "rating": number,
     "reaction": "string" | null,
     "started_ticket_id": "uuid" | null,
     "media": {
            "uid": "string",
            "name": "string",
            "size": number,
            "url": "string",
            "type": "image/jpeg"
            }[],
     "receiver_id": "uuid",
     "bot_id": "uuid",
     "sender_id": "uuid" | null,
     "session_id": "uuid" | null,
     "block_id": "uuid" | null,
     "type": "TEXT" | 'IMAGE' | 'VIDEO' | 'FEEDBACK',
     "unsent": boolean,
     "meta_tags": json[],
     "data": json | null,
     "variables": json | null,
     "quoted_id": "uuid" | null,
     "disabled_submit_form": boolean | null,
     "notification_data": json | null,
     "count_message_notes": number | null,
     "language_using": "string",
     "total_qa_feedback": number,
     "receiver_read_at": Date | null,
     "created_at": Date,
     "updated_at": Date,
     "deleted_at": Date | null,
   }
    }[]
}

Get conversations detail

Path: https://api-demo.cxgenie.ai/api/v2/public-api/detail-sessions/:session_id

Method: GET

Query

{
    "limit": number, //Default 10
    "offset": number, //Default 0
    "workspace_token": string,
    "customer_id": uuid,
    "order": "asc" | "desc" //Default asc
    "remove_system_message": boolean //Default false
}

Beside default property, workspace_token and customer_id is required

Result:

{
    "success": boolean,
    "data": {
      "id": "uuid",
   "content": "string",
   "external_id": "uuid" | null,
   "rating": number,
   "reaction": "string" | null,
   "started_ticket_id": "uuid" | null,
   "media": {
        "uid": "string",
        "name": "string",
        "size": number,
        "url": "string",
        "type": "image/jpeg"
        }[],
      "receiver_id": "uuid",
   "bot_id": "uuid",
   "sender_id": "uuid" | null,
   "session_id": "uuid" | null,
   "block_id": "uuid" | null,
   "type": "TEXT" | 'IMAGE' | 'VIDEO' | 'FEEDBACK' | 'ICON',
   "unsent": boolean,
   "meta_tags": json[],
   "data": json | null,
   "variables": json | null,
   "quoted_id": "uuid" | null,
   "disabled_submit_form": boolean | null,
   "notification_data": json | null,
   "count_message_notes": number | null,
   "language_using": "string",
   "total_qa_feedback": number,
   "receiver_read_at": Date | null,
   "created_at": Date,
   "updated_at": Date,
   "deleted_at": Date | null,
   "bot": {
       "id": "string",
       "name": "string",
       "avatar": "string",
       "auto_reply": boolean,
       "reply_language": "string" | null,
       "reply_unknown": "string",
       "workspace_id": "uuid"
     },
      "reactions": json{},
   "quoted_from": MessageResult,
 }[]
}

Upload File

Path: https://api-demo.cxgenie.ai/api/v2/public-api/upload/multiple

Method: POST (multipart/form-data)

Query

{
    "files": binary[]
    "workspace_token": "string"
}

Result

{
 "success": true,
 "data": [
   {
     "name": "string",
     "url": "https://...",
     "type": "image/png",
     "size": 0
   }
 ]
}

Share

email

Join our newsletter!

Sign up for our weekly newsletter and stay ahead of the curve with the latest AI innovations, CX Genie updates, and much more.

Related articles

Empty

No data

email

Join our newsletter!

Sign up for our weekly newsletter and stay ahead of the curve with the latest AI innovations, CX Genie updates, and much more.

Welcome to CX Genie,
where falling behind on AI is not an option!

Experience personalized AI chat support that's as effortless as flipping a switch – simple in both pricing and setup. Join us and stay ahead with AI-powered solutions!

No credit card required

Now available on

Google PlayGoogle Play
experience-mobile
Follow us
Contact
[email protected]
Meydan Grandstand, 6th floor, Meydan Road, Nad Al Sheba, Dubai, U.A.E.
18 Sin Ming Lane, #07-13 Midview City, Singapore (573960)
Level 2 - 11 York St, Sydney NSW 2000, Australia
@2024 CX Genie. All rights reserved