Create a new API key
curl --request POST \
--url https://api.example.com/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My CRM Integration",
"type": "personal"
}
'import requests
url = "https://api.example.com/api/v1/api-keys"
payload = {
"name": "My CRM Integration",
"type": "personal"
}
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: 'My CRM Integration', type: 'personal'})
};
fetch('https://api.example.com/api/v1/api-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.example.com/api/v1/api-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' => 'My CRM Integration',
'type' => 'personal'
]),
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.example.com/api/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My CRM Integration\",\n \"type\": \"personal\"\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.example.com/api/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My CRM Integration\",\n \"type\": \"personal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/api-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\": \"My CRM Integration\",\n \"type\": \"personal\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "My CRM Integration",
"type": "branch",
"keyPrefix": "sk_personal_Ab3x",
"isActive": true,
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"rawKey": "sk_personal_Ab3xYz7qR2mN9kLpW4vC8dE1fT6uS0hJ",
"note": "Store this key securely — it will not be shown again."
}{
"statusCode": 400,
"message": [
"url must be a URL address",
"events should not be empty"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden"
}API Keys
Create API Key
Creates a new partner API key. The response includes the rawKey — it is shown only once. Store it securely. Requires staff JWT authentication.
POST
/
api-keys
Create a new API key
curl --request POST \
--url https://api.example.com/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My CRM Integration",
"type": "personal"
}
'import requests
url = "https://api.example.com/api/v1/api-keys"
payload = {
"name": "My CRM Integration",
"type": "personal"
}
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: 'My CRM Integration', type: 'personal'})
};
fetch('https://api.example.com/api/v1/api-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.example.com/api/v1/api-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' => 'My CRM Integration',
'type' => 'personal'
]),
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.example.com/api/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My CRM Integration\",\n \"type\": \"personal\"\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.example.com/api/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My CRM Integration\",\n \"type\": \"personal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/api-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\": \"My CRM Integration\",\n \"type\": \"personal\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "My CRM Integration",
"type": "branch",
"keyPrefix": "sk_personal_Ab3x",
"isActive": true,
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"rawKey": "sk_personal_Ab3xYz7qR2mN9kLpW4vC8dE1fT6uS0hJ",
"note": "Store this key securely — it will not be shown again."
}{
"statusCode": 400,
"message": [
"url must be a URL address",
"events should not be empty"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 403,
"message": "Forbidden"
}Authorizations
Staff panel JWT access token
Body
application/json
Maximum string length:
100Example:
"My CRM Integration"
Available options:
branch, personal, public Required when type=branch or type=public
Example:
1
ISO 8601 expiry date. Omit for no expiry.
Example:
"2027-01-01T00:00:00Z"
Response
API key created. The rawKey field is shown only in this response.
Example:
"My CRM Integration"
Available options:
branch, personal, public First 20 chars of the key, for display
Example:
"sk_personal_Ab3x"
Example:
true
The full API key. Shown only once — store securely.
Example:
"sk_personal_Ab3xYz7qR2mN9kLpW4vC8dE1fT6uS0hJ"
Example:
"Store this key securely — it will not be shown again."