Attributes
Create or update a workspace attribute
Creates the attribute, or updates the label, description, options and position of an attribute that exists.
The type of an attribute that exists cannot change. To store a different type, archive this attribute and create another one.
POST
/
attributes
Create or update a workspace attribute
curl --request POST \
--url https://kaisupport.com/api/v1/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "package",
"label": "Package",
"type": "select",
"options": [
"Tam Destek",
"Tam Paket"
]
}
'import requests
url = "https://kaisupport.com/api/v1/attributes"
payload = {
"key": "package",
"label": "Package",
"type": "select",
"options": ["Tam Destek", "Tam Paket"]
}
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({
key: 'package',
label: 'Package',
type: 'select',
options: ['Tam Destek', 'Tam Paket']
})
};
fetch('https://kaisupport.com/api/v1/attributes', 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/attributes",
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([
'key' => 'package',
'label' => 'Package',
'type' => 'select',
'options' => [
'Tam Destek',
'Tam Paket'
]
]),
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/attributes"
payload := strings.NewReader("{\n \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\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://kaisupport.com/api/v1/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kaisupport.com/api/v1/attributes")
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 \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"label": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"position": 123,
"archived": true
}
}{
"data": {
"key": "<string>",
"label": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"position": 123,
"archived": true
}
}{
"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": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}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.
Body
application/json
Response
The attribute was updated.
Show child attributes
Show child attributes
⌘I
Create or update a workspace attribute
curl --request POST \
--url https://kaisupport.com/api/v1/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "package",
"label": "Package",
"type": "select",
"options": [
"Tam Destek",
"Tam Paket"
]
}
'import requests
url = "https://kaisupport.com/api/v1/attributes"
payload = {
"key": "package",
"label": "Package",
"type": "select",
"options": ["Tam Destek", "Tam Paket"]
}
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({
key: 'package',
label: 'Package',
type: 'select',
options: ['Tam Destek', 'Tam Paket']
})
};
fetch('https://kaisupport.com/api/v1/attributes', 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/attributes",
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([
'key' => 'package',
'label' => 'Package',
'type' => 'select',
'options' => [
'Tam Destek',
'Tam Paket'
]
]),
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/attributes"
payload := strings.NewReader("{\n \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\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://kaisupport.com/api/v1/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://kaisupport.com/api/v1/attributes")
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 \"key\": \"package\",\n \"label\": \"Package\",\n \"type\": \"select\",\n \"options\": [\n \"Tam Destek\",\n \"Tam Paket\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"label": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"position": 123,
"archived": true
}
}{
"data": {
"key": "<string>",
"label": "<string>",
"description": "<string>",
"options": [
"<string>"
],
"position": 123,
"archived": true
}
}{
"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": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}