Създаване на API ключ
curl --request POST \
--url https://call.aiployees.com/api/user/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://call.aiployees.com/api/user/api-keys"
payload = { "name": "<string>" }
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: '<string>'})
};
fetch('https://call.aiployees.com/api/user/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://call.aiployees.com/api/user/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' => '<string>'
]),
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://call.aiployees.com/api/user/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\"\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://call.aiployees.com/api/user/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://call.aiployees.com/api/user/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\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "API key created successfully.",
"api_key": {
"name": "Production API Key",
"token": "1|abc123xyz789abcdef...",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "The name field is required.",
"errors": {
"name": ["The name field is required."]
}
}
API ключове
Създаване на API ключ
Генериране на нов API ключ за удостоверения потребител
POST
/
user
/
api-keys
Създаване на API ключ
curl --request POST \
--url https://call.aiployees.com/api/user/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://call.aiployees.com/api/user/api-keys"
payload = { "name": "<string>" }
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: '<string>'})
};
fetch('https://call.aiployees.com/api/user/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://call.aiployees.com/api/user/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' => '<string>'
]),
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://call.aiployees.com/api/user/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\"\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://call.aiployees.com/api/user/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://call.aiployees.com/api/user/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\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "API key created successfully.",
"api_key": {
"name": "Production API Key",
"token": "1|abc123xyz789abcdef...",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "The name field is required.",
"errors": {
"name": ["The name field is required."]
}
}
Този endpoint генерира нов API ключ за удостоверения потребител. За разлика от login endpoint-а, който създава session token, този създава постоянен API ключ, който може да се използва за дългосрочен достъп до API.
Този endpoint изисква удостоверяване. Използвайте съществуващия си API ключ или session token, за да създадете допълнителни API ключове.
Тяло на заявката
string
required
Име/етикет за API ключа (напр. “Production”, “Development”, “My App”)
Отговор
string
Съобщение за успех
object
{
"message": "API key created successfully.",
"api_key": {
"name": "Production API Key",
"token": "1|abc123xyz789abcdef...",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "The name field is required.",
"errors": {
"name": ["The name field is required."]
}
}
Примерна заявка
curl -X POST https://call.aiployees.com/api/user/api-keys \
-H "Authorization: Bearer YOUR_EXISTING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key"
}'
Token-ът на API ключа се връща само веднъж. Уверете се, че го съхранявате сигурно. Ако го загубите, ще трябва да създадете нов.
Управление на API ключове
- GET /user/api-keys - Показване на всички API ключове за удостоверения потребител
- DELETE /user/api-keys/ - Изтриване на конкретен API ключ
⌘I

