Create a chat
Create a new chat with segments (messages and tool invocations)
curl --request POST \
--url https://api.roark.ai/v1/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startTimestamp": "<string>",
"endTimestamp": "<string>",
"messages": [
{
"role": "<string>",
"text": "<string>",
"startTimestamp": "<string>",
"languageCode": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startTimestamp": "<string>",
"description": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"properties": {
"source": "web",
"region": "US",
"sessionId": "abc123"
},
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"externalId": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"agents": [
{
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"customers": [
{
"phoneNumberE164": "<string>",
"label": "<string>"
}
]
}
'import requests
url = "https://api.roark.ai/v1/chat"
payload = {
"startTimestamp": "<string>",
"endTimestamp": "<string>",
"messages": [
{
"role": "<string>",
"text": "<string>",
"startTimestamp": "<string>",
"languageCode": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startTimestamp": "<string>",
"description": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"properties": {
"source": "web",
"region": "US",
"sessionId": "abc123"
},
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"externalId": "<string>",
"agent": { "roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" },
"agents": [{ "roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }],
"customers": [
{
"phoneNumberE164": "<string>",
"label": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
startTimestamp: '<string>',
endTimestamp: '<string>',
messages: [
{
role: '<string>',
text: '<string>',
startTimestamp: '<string>',
languageCode: '<string>',
endTimestamp: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', customId: '<string>'}
}
],
toolInvocations: [
{
name: '<string>',
parameters: {},
result: '<string>',
startTimestamp: '<string>',
description: '<string>',
endTimestamp: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', customId: '<string>'}
}
],
properties: {source: 'web', region: 'US', sessionId: 'abc123'},
traceId: '4bf92f3577b34da6a3ce929d0e0e4736',
externalId: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
agents: [{roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}],
customers: [{phoneNumberE164: '<string>', label: '<string>'}]
})
};
fetch('https://api.roark.ai/v1/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startTimestamp' => '<string>',
'endTimestamp' => '<string>',
'messages' => [
[
'role' => '<string>',
'text' => '<string>',
'startTimestamp' => '<string>',
'languageCode' => '<string>',
'endTimestamp' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'toolInvocations' => [
[
'name' => '<string>',
'parameters' => [
],
'result' => '<string>',
'startTimestamp' => '<string>',
'description' => '<string>',
'endTimestamp' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'properties' => [
'source' => 'web',
'region' => 'US',
'sessionId' => 'abc123'
],
'traceId' => '4bf92f3577b34da6a3ce929d0e0e4736',
'externalId' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'agents' => [
[
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'customers' => [
[
'phoneNumberE164' => '<string>',
'label' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.roark.ai/v1/chat"
payload := strings.NewReader("{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.roark.ai/v1/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"projectId": "660e8400-e29b-41d4-a716-446655440001",
"organizationId": "770e8400-e29b-41d4-a716-446655440002",
"startTimestamp": "2024-01-15T10:00:00Z",
"endTimestamp": "2024-01-15T10:30:00Z",
"durationMs": 1800000,
"title": "Account assistance request",
"summary": "Customer inquired about account balance and recent transactions",
"createdAt": "2024-01-15T10:31:00Z",
"updatedAt": "2024-01-15T10:31:00Z",
"simulationJobId": "880e8400-e29b-41d4-a716-446655440003",
"simulationRunPlanJobId": "990e8400-e29b-41d4-a716-446655440004",
"agents": [
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"customers": [
{
"phoneNumberE164": null,
"label": "web-visitor-abc123"
}
],
"properties": {
"source": "web",
"region": "US"
},
"policyIds": [
"550e8400-e29b-41d4-a716-446655440000"
],
"externalId": "session-abc-123"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Chat creation payload. Supports singular (agent/customer) or plural (agents/customers) formats.
When the chat started (ISO 8601 format)
When the chat ended (ISO 8601 format)
Ordered list of messages exchanged during the chat
- Option 1
- Option 2
Show child attributes
Show child attributes
List of tool invocations made during the chat
Show child attributes
Show child attributes
Custom properties to include with the chat. These can be used for filtering and will show in the chat details page
Show child attributes
Show child attributes
{
"source": "web",
"region": "US",
"sessionId": "abc123"
}
Optional OpenTelemetry trace ID for the chat. Surfaces the chat in the tracing tab.
"4bf92f3577b34da6a3ce929d0e0e4736"
A stable identifier from your own system (e.g. session ID, conversation ID) used to correlate this chat with OpenTelemetry traces. Set the same value as a roark.external_id span or resource attribute on your traces and the matching trace will be linked automatically. Must be unique within a project.
255Single agent participating in the chat. Use this for the simpler API when you have only one agent.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Agents participating in the chat. Each agent requires identification and prompt information.
Agent participating in the chat with their identification and prompt
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Single customer participating in the chat. Use this for the simpler API when you have only one customer.
Show child attributes
Show child attributes
Customers participating in the chat.
Show child attributes
Show child attributes
Response
Chat created successfully
Response containing the chat information
Show child attributes
Show child attributes
curl --request POST \
--url https://api.roark.ai/v1/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startTimestamp": "<string>",
"endTimestamp": "<string>",
"messages": [
{
"role": "<string>",
"text": "<string>",
"startTimestamp": "<string>",
"languageCode": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startTimestamp": "<string>",
"description": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"properties": {
"source": "web",
"region": "US",
"sessionId": "abc123"
},
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"externalId": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"agents": [
{
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"customers": [
{
"phoneNumberE164": "<string>",
"label": "<string>"
}
]
}
'import requests
url = "https://api.roark.ai/v1/chat"
payload = {
"startTimestamp": "<string>",
"endTimestamp": "<string>",
"messages": [
{
"role": "<string>",
"text": "<string>",
"startTimestamp": "<string>",
"languageCode": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startTimestamp": "<string>",
"description": "<string>",
"endTimestamp": "<string>",
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"properties": {
"source": "web",
"region": "US",
"sessionId": "abc123"
},
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"externalId": "<string>",
"agent": { "roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" },
"agents": [{ "roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }],
"customers": [
{
"phoneNumberE164": "<string>",
"label": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
startTimestamp: '<string>',
endTimestamp: '<string>',
messages: [
{
role: '<string>',
text: '<string>',
startTimestamp: '<string>',
languageCode: '<string>',
endTimestamp: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', customId: '<string>'}
}
],
toolInvocations: [
{
name: '<string>',
parameters: {},
result: '<string>',
startTimestamp: '<string>',
description: '<string>',
endTimestamp: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', customId: '<string>'}
}
],
properties: {source: 'web', region: 'US', sessionId: 'abc123'},
traceId: '4bf92f3577b34da6a3ce929d0e0e4736',
externalId: '<string>',
agent: {roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
agents: [{roarkId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}],
customers: [{phoneNumberE164: '<string>', label: '<string>'}]
})
};
fetch('https://api.roark.ai/v1/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startTimestamp' => '<string>',
'endTimestamp' => '<string>',
'messages' => [
[
'role' => '<string>',
'text' => '<string>',
'startTimestamp' => '<string>',
'languageCode' => '<string>',
'endTimestamp' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'toolInvocations' => [
[
'name' => '<string>',
'parameters' => [
],
'result' => '<string>',
'startTimestamp' => '<string>',
'description' => '<string>',
'endTimestamp' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'properties' => [
'source' => 'web',
'region' => 'US',
'sessionId' => 'abc123'
],
'traceId' => '4bf92f3577b34da6a3ce929d0e0e4736',
'externalId' => '<string>',
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'agents' => [
[
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'customers' => [
[
'phoneNumberE164' => '<string>',
'label' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.roark.ai/v1/chat"
payload := strings.NewReader("{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.roark.ai/v1/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startTimestamp\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"text\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"languageCode\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startTimestamp\": \"<string>\",\n \"description\": \"<string>\",\n \"endTimestamp\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"properties\": {\n \"source\": \"web\",\n \"region\": \"US\",\n \"sessionId\": \"abc123\"\n },\n \"traceId\": \"4bf92f3577b34da6a3ce929d0e0e4736\",\n \"externalId\": \"<string>\",\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"agents\": [\n {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"customers\": [\n {\n \"phoneNumberE164\": \"<string>\",\n \"label\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"projectId": "660e8400-e29b-41d4-a716-446655440001",
"organizationId": "770e8400-e29b-41d4-a716-446655440002",
"startTimestamp": "2024-01-15T10:00:00Z",
"endTimestamp": "2024-01-15T10:30:00Z",
"durationMs": 1800000,
"title": "Account assistance request",
"summary": "Customer inquired about account balance and recent transactions",
"createdAt": "2024-01-15T10:31:00Z",
"updatedAt": "2024-01-15T10:31:00Z",
"simulationJobId": "880e8400-e29b-41d4-a716-446655440003",
"simulationRunPlanJobId": "990e8400-e29b-41d4-a716-446655440004",
"agents": [
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"customers": [
{
"phoneNumberE164": null,
"label": "web-visitor-abc123"
}
],
"properties": {
"source": "web",
"region": "US"
},
"policyIds": [
"550e8400-e29b-41d4-a716-446655440000"
],
"externalId": "session-abc-123"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}