cURL
curl --request POST \
--url https://api.useanima.sh/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [],
"name": "<string>",
"mode": "LIVE",
"agentId": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.useanima.sh/v1/api-keys"
payload = {
"scopes": [],
"name": "<string>",
"mode": "LIVE",
"agentId": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
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({
scopes: [],
name: '<string>',
mode: 'LIVE',
agentId: '<string>',
expiresAt: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.useanima.sh/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.useanima.sh/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([
'scopes' => [
],
'name' => '<string>',
'mode' => 'LIVE',
'agentId' => '<string>',
'expiresAt' => '2023-11-07T05:31:56Z'
]),
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.useanima.sh/v1/api-keys"
payload := strings.NewReader("{\n \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\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.useanima.sh/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/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 \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"orgId": "<string>",
"agentId": "<string>",
"name": "<string>",
"prefix": "<string>",
"mode": "LIVE",
"scopes": [
"<string>"
],
"revoked": true,
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"key": "<string>",
"extension": {
"authPolicy": "session",
"tokenTtl": "15m"
}
}API Reference
Post api keys
POST
/
api-keys
cURL
curl --request POST \
--url https://api.useanima.sh/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [],
"name": "<string>",
"mode": "LIVE",
"agentId": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.useanima.sh/v1/api-keys"
payload = {
"scopes": [],
"name": "<string>",
"mode": "LIVE",
"agentId": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
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({
scopes: [],
name: '<string>',
mode: 'LIVE',
agentId: '<string>',
expiresAt: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.useanima.sh/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.useanima.sh/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([
'scopes' => [
],
'name' => '<string>',
'mode' => 'LIVE',
'agentId' => '<string>',
'expiresAt' => '2023-11-07T05:31:56Z'
]),
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.useanima.sh/v1/api-keys"
payload := strings.NewReader("{\n \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\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.useanima.sh/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useanima.sh/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 \"scopes\": [],\n \"name\": \"<string>\",\n \"mode\": \"LIVE\",\n \"agentId\": \"<string>\",\n \"expiresAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"orgId": "<string>",
"agentId": "<string>",
"name": "<string>",
"prefix": "<string>",
"mode": "LIVE",
"scopes": [
"<string>"
],
"revoked": true,
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"key": "<string>",
"extension": {
"authPolicy": "session",
"tokenTtl": "15m"
}
}Authorizations
BearerAuthApiKeyAuth
Body
application/json
Request body for creating a new API key
Permission scopes granted to this key. Use ['*'] for full access, or list specific scopes from the catalogue (e.g. ['email:read', 'email:send']). An empty array is rejected — empty no longer means 'full access'.
Minimum array length:
1A single permission scope, or the wildcard '*' for full access
Available options:
*, email:read, email:send, phone:read, phone:sms, phone:voice, phone:provision, messages:read, messages:send, messages:search, voice:read, vault:read, vault:use, vault:write, vault:share, vault:oauth, vault:inject, identity:read, identity:write, agents:read, agents:write, inbox:read, inbox:write, domains:read, domains:write, addresses:read, addresses:write, webhooks:read, webhooks:write, billing:read, audit:read, extension:connect Response
200 - application/json
OK
API key resource including the secret value, returned only on creation
