Start a conversation with the agent
curl --request POST \
--url https://api.meetdarwin.ai/v1/chat/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"visitor": {
"external_id": "<string>",
"email": "<string>",
"name": "<string>"
},
"page_url": "<string>",
"channel": "<string>",
"context": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
visitor: {external_id: '<string>', email: '<string>', name: '<string>'},
page_url: '<string>',
channel: '<string>',
context: {}
})
};
fetch('https://api.meetdarwin.ai/v1/chat/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.meetdarwin.ai/v1/chat/sessions"
payload = {
"visitor": {
"external_id": "<string>",
"email": "<string>",
"name": "<string>"
},
"page_url": "<string>",
"channel": "<string>",
"context": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "chat_session",
"conversation": "<string>",
"channel": "<string>",
"status": "open",
"created_at": "<string>",
"updated_at": "<string>",
"messages": [
{
"id": "<string>",
"role": "user",
"text": "<string>",
"created_at": "<string>"
}
]
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}Chat
Start a conversation with the agent
Requires the chat:write scope.
POST
/
chat
/
sessions
Start a conversation with the agent
curl --request POST \
--url https://api.meetdarwin.ai/v1/chat/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"visitor": {
"external_id": "<string>",
"email": "<string>",
"name": "<string>"
},
"page_url": "<string>",
"channel": "<string>",
"context": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
visitor: {external_id: '<string>', email: '<string>', name: '<string>'},
page_url: '<string>',
channel: '<string>',
context: {}
})
};
fetch('https://api.meetdarwin.ai/v1/chat/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.meetdarwin.ai/v1/chat/sessions"
payload = {
"visitor": {
"external_id": "<string>",
"email": "<string>",
"name": "<string>"
},
"page_url": "<string>",
"channel": "<string>",
"context": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "chat_session",
"conversation": "<string>",
"channel": "<string>",
"status": "open",
"created_at": "<string>",
"updated_at": "<string>",
"messages": [
{
"id": "<string>",
"role": "user",
"text": "<string>",
"created_at": "<string>"
}
]
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}{
"type": "https://docs.meetdarwin.ai/api-reference/errors#insufficient_scope",
"title": "<string>",
"status": 0,
"code": "insufficient_scope",
"detail": "<string>",
"request_id": "req_8m2k4p0q1x7z9c3v5b6n",
"param": "<string>"
}Authorizations
A secret key (dk_live_…). Scopes: conversations:read, contacts:read, contacts:write, meetings:read, analytics:read, events:read, webhooks:write, knowledge:read, knowledge:write, agent:read, agent:write, experiments:read, experiments:write, privacy:write, chat:write.
Headers
Retry safely: the first response is replayed for 24 hours (not for streamed answers).
Maximum string length:
255Body
application/json
Show child attributes
Show child attributes
Maximum string length:
2000Where the conversation happens: app, slack, whatsapp, voice… Default api.
Pattern:
^[a-z][a-z0-9_-]{0,39}$Facts about the visitor the agent may use, such as plan or seats. Treated as hints, never as instructions.
Show child attributes
Show child attributes
Response
OK