Start a chat session
curl --request POST \
--url https://api.osvi.ai/chat_sessions \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"metadata": {
"person_name": "Jane Smith"
}
}
'import requests
url = "https://api.osvi.ai/chat_sessions"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"metadata": { "person_name": "Jane Smith" }
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
metadata: {person_name: 'Jane Smith'}
})
};
fetch('https://api.osvi.ai/chat_sessions', 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.osvi.ai/chat_sessions",
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([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'metadata' => [
'person_name' => 'Jane Smith'
]
]),
CURLOPT_HTTPHEADER => [
"API-Token: <api-key>",
"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.osvi.ai/chat_sessions"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<api-key>")
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.osvi.ai/chat_sessions")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/chat_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"agent_name": "Support Agent",
"started_at": "2025-12-31T11:40:25.690486",
"welcome_message": "Hi! How can I help you today?"
}
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"errors": [
"agent_uuid is required",
"phone_number is invalid"
]
}Chat
Start Chat Session
deprecated
Legacy — will be deprecated soon. Use the Chat v1 endpoints (POST /v1/chat/session) for new integrations.
Opens a new chat session with the specified agent and returns a session_id used for all subsequent messages.
POST
/
chat_sessions
Start a chat session
curl --request POST \
--url https://api.osvi.ai/chat_sessions \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"metadata": {
"person_name": "Jane Smith"
}
}
'import requests
url = "https://api.osvi.ai/chat_sessions"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"metadata": { "person_name": "Jane Smith" }
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
metadata: {person_name: 'Jane Smith'}
})
};
fetch('https://api.osvi.ai/chat_sessions', 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.osvi.ai/chat_sessions",
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([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'metadata' => [
'person_name' => 'Jane Smith'
]
]),
CURLOPT_HTTPHEADER => [
"API-Token: <api-key>",
"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.osvi.ai/chat_sessions"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<api-key>")
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.osvi.ai/chat_sessions")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/chat_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"metadata\": {\n \"person_name\": \"Jane Smith\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"agent_name": "Support Agent",
"started_at": "2025-12-31T11:40:25.690486",
"welcome_message": "Hi! How can I help you today?"
}
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"errors": [
"agent_uuid is required",
"phone_number is invalid"
]
}Authorizations
16-character API token associated with your OSVI account. Find it in your dashboard under Settings → API.
Body
application/json
⌘I
