Create a conversation (optionally with initial timeline items)

Create a conversation; optionally pass a conversationId and a set of default timeline items.

POST
/v1/conversations

Header Parameters

Authorization?string

Private API key in Bearer token format. Use this for server-to-server authentication. Format: Bearer sk_[live|test]_...

Match^Bearer sk_(live|test)_[a-f0-9]{64}$
X-Public-Key?string

Public API key for browser-based authentication. Can only be used from whitelisted domains. Format: pk_[live|test]_...

Match^pk_(live|test)_[a-f0-9]{64}$
X-Visitor-Id?string

Visitor ID from localStorage.

Match^[0-9A-HJKMNP-TV-Z]{26}$
visitorId?string

Visitor ID, if not provided you must provide a visitorId in the headers.

conversationId?string

Default conversation ID, if not provided the ID will be automatically generated.

defaultTimelineItems

Default timeline items to initiate the conversation with

channel?string

Which channel the conversation is from

Default"widget"

Response Body

application/json

application/json

curl -X POST "https://api.cossistant.com/v1/v1/conversations" \  -H "Content-Type: application/json" \  -d '{    "defaultTimelineItems": [      {        "conversationId": "string",        "organizationId": "string",        "visibility": "public",        "type": "message",        "text": "string",        "parts": [          {            "type": "text",            "text": "string"          }        ],        "userId": "string",        "aiAgentId": "string",        "visitorId": "string",        "createdAt": "string"      }    ]  }'
{
  "initialTimelineItems": [
    {
      "id": "string",
      "conversationId": "string",
      "organizationId": "string",
      "visibility": "public",
      "type": "message",
      "text": "string",
      "tool": "string",
      "parts": [
        {
          "type": "text",
          "text": "string"
        }
      ],
      "userId": "string",
      "aiAgentId": "string",
      "visitorId": "string",
      "createdAt": "string",
      "deletedAt": "string"
    }
  ],
  "conversation": {
    "id": "string",
    "title": "string",
    "createdAt": "string",
    "updatedAt": "string",
    "visitorId": "string",
    "websiteId": "string",
    "status": "open",
    "deletedAt": null,
    "lastTimelineItem": {
      "id": "string",
      "conversationId": "string",
      "organizationId": "string",
      "visibility": "public",
      "type": "message",
      "text": "string",
      "tool": "string",
      "parts": [
        {
          "type": "text",
          "text": "string"
        }
      ],
      "userId": "string",
      "aiAgentId": "string",
      "visitorId": "string",
      "createdAt": "string",
      "deletedAt": "string"
    }
  }
}
{
  "error": "string"
}