Contacts
Set the account owner
Gives the account to one teammate. New conversations from this customer go to that teammate.
The open conversations of this customer do not move. To move them as
well, send reassign_open_conversations: true.
PUT
/
contacts
/
{id}
/
owner
Set the account owner
curl --request PUT \
--url https://kaisupport.com/api/v1/contacts/{id}/owner \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "baran@example.com",
"reassign_open_conversations": true
}
'import requests
url = "https://kaisupport.com/api/v1/contacts/{id}/owner"
payload = {
"owner": "baran@example.com",
"reassign_open_conversations": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: 'baran@example.com', reassign_open_conversations: true})
};
fetch('https://kaisupport.com/api/v1/contacts/{id}/owner', 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://kaisupport.com/api/v1/contacts/{id}/owner",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => 'baran@example.com',
'reassign_open_conversations' => true
]),
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://kaisupport.com/api/v1/contacts/{id}/owner"
payload := strings.NewReader("{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://kaisupport.com/api/v1/contacts/{id}/owner")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kaisupport.com/api/v1/contacts/{id}/owner")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attributes": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"note": "<string>",
"owner": {
"member_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>"
}
},
"reassigned_conversations": 123
}{
"error": {
"type": "invalid_request",
"message": "Send at least one of \"external_id\", \"email\", \"phone\" or \"identities\" so the contact can be matched."
}
}{
"error": {
"type": "unauthorized",
"message": "That API key is not valid."
}
}{
"error": {
"type": "forbidden",
"message": "This key does not have the \"contacts:write\" permission."
}
}{
"error": {
"type": "not_found",
"message": "No such contact."
}
}Authorizations
Send your API key as Authorization: Bearer kai_live_....
Make and revoke keys in Kai, under Settings → API. Kai stores only a hash of the key, so the full key is shown one time.
Path Parameters
Body
application/json
⌘I
Set the account owner
curl --request PUT \
--url https://kaisupport.com/api/v1/contacts/{id}/owner \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "baran@example.com",
"reassign_open_conversations": true
}
'import requests
url = "https://kaisupport.com/api/v1/contacts/{id}/owner"
payload = {
"owner": "baran@example.com",
"reassign_open_conversations": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: 'baran@example.com', reassign_open_conversations: true})
};
fetch('https://kaisupport.com/api/v1/contacts/{id}/owner', 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://kaisupport.com/api/v1/contacts/{id}/owner",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => 'baran@example.com',
'reassign_open_conversations' => true
]),
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://kaisupport.com/api/v1/contacts/{id}/owner"
payload := strings.NewReader("{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://kaisupport.com/api/v1/contacts/{id}/owner")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kaisupport.com/api/v1/contacts/{id}/owner")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"baran@example.com\",\n \"reassign_open_conversations\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attributes": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"note": "<string>",
"owner": {
"member_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>"
}
},
"reassigned_conversations": 123
}{
"error": {
"type": "invalid_request",
"message": "Send at least one of \"external_id\", \"email\", \"phone\" or \"identities\" so the contact can be matched."
}
}{
"error": {
"type": "unauthorized",
"message": "That API key is not valid."
}
}{
"error": {
"type": "forbidden",
"message": "This key does not have the \"contacts:write\" permission."
}
}{
"error": {
"type": "not_found",
"message": "No such contact."
}
}