curl --request POST \
--url https://api.protodesk.io/v1/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI deploy",
"scopes": []
}
'import requests
url = "https://api.protodesk.io/v1/keys"
payload = {
"name": "CI deploy",
"scopes": []
}
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({name: 'CI deploy', scopes: []})
};
fetch('https://api.protodesk.io/v1/keys', 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.protodesk.io/v1/keys",
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([
'name' => 'CI deploy',
'scopes' => [
]
]),
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.protodesk.io/v1/keys"
payload := strings.NewReader("{\n \"name\": \"CI deploy\",\n \"scopes\": []\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.protodesk.io/v1/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI deploy\",\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.protodesk.io/v1/keys")
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 \"name\": \"CI deploy\",\n \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "key_o5mj4q7beg32vkjcd76a37t5zy",
"name": "<string>",
"environment": "live",
"scopes": [
"customers:read"
],
"display": "pk_test_key...cret",
"secret": "pk_test_key_o5mj4q7beg32vkjcd76a37t5zy_abcdefghijklmnopqrstuvwxyz234567"
}{
"error": {
"code": "route.not_found",
"message": "Not found",
"requestId": "req_x6q5vl75f5d53m7oet2k4r5w6a"
}
}Create an API key
Mints a new API key. The raw secret is returned once in the response and is never retrievable afterward. Requires the keys:manage scope.
curl --request POST \
--url https://api.protodesk.io/v1/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI deploy",
"scopes": []
}
'import requests
url = "https://api.protodesk.io/v1/keys"
payload = {
"name": "CI deploy",
"scopes": []
}
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({name: 'CI deploy', scopes: []})
};
fetch('https://api.protodesk.io/v1/keys', 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.protodesk.io/v1/keys",
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([
'name' => 'CI deploy',
'scopes' => [
]
]),
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.protodesk.io/v1/keys"
payload := strings.NewReader("{\n \"name\": \"CI deploy\",\n \"scopes\": []\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.protodesk.io/v1/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI deploy\",\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.protodesk.io/v1/keys")
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 \"name\": \"CI deploy\",\n \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "key_o5mj4q7beg32vkjcd76a37t5zy",
"name": "<string>",
"environment": "live",
"scopes": [
"customers:read"
],
"display": "pk_test_key...cret",
"secret": "pk_test_key_o5mj4q7beg32vkjcd76a37t5zy_abcdefghijklmnopqrstuvwxyz234567"
}{
"error": {
"code": "route.not_found",
"message": "Not found",
"requestId": "req_x6q5vl75f5d53m7oet2k4r5w6a"
}
}Authorizations
Use a workspace API key in the Authorization header. Keys use pk_live_<key_id> for production and pk_test<key_id>_ for test mode.
Headers
Optional retry key for safely replaying create requests. Reusing the same key with a different request body returns 409.
8 - 255"8db8e596-7c1a-4fd5-a728-4d6c99f4e66b"
Body
Human-readable label for the key.
"CI deploy"
1Workspace API key permission scope.
customers:read, customers:write, conversations:read, conversations:write, messages:write, attachments:read, attachments:write, webhooks:manage, realtime:read, ai:use, keys:manage, help:read, help:drafts:write Defaults to the calling key's environment.
live, test Response
Created API key with its raw secret (shown once).
A newly created key. The secret is shown once and never again.
"key_o5mj4q7beg32vkjcd76a37t5zy"
live, test Workspace API key permission scope.
customers:read, customers:write, conversations:read, conversations:write, messages:write, attachments:read, attachments:write, webhooks:manage, realtime:read, ai:use, keys:manage, help:read, help:drafts:write Masked key preview safe to display.
"pk_test_key...cret"
The raw API key. Store it now; it cannot be retrieved later.
"pk_test_key_o5mj4q7beg32vkjcd76a37t5zy_abcdefghijklmnopqrstuvwxyz234567"
