API Keys
Create a scoped API key
Requires api_keys:write and an account administrator. The requested scopes must be a subset of the caller’s scopes. The full token is returned once. RPM and active-key count must fit the effective account policy.
POST
/
api
/
v2
/
accounts
/
{accountId}
/
api-keys
Create a scoped API key
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"allowed_ips": [
"203.0.113.10/32"
],
"description": "Production appointment synchronization",
"expires_at": "2027-09-01T00:00:00Z",
"name": "Clinic scheduling connector",
"rate_limit_rpm": 600,
"scopes": [
"appointments:read",
"appointments:write"
]
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/api-keys"
payload = {
"allowed_ips": ["203.0.113.10/32"],
"description": "Production appointment synchronization",
"expires_at": "2027-09-01T00:00:00Z",
"name": "Clinic scheduling connector",
"rate_limit_rpm": 600,
"scopes": ["appointments:read", "appointments:write"]
}
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({
allowed_ips: ['203.0.113.10/32'],
description: 'Production appointment synchronization',
expires_at: '2027-09-01T00:00:00Z',
name: 'Clinic scheduling connector',
rate_limit_rpm: 600,
scopes: ['appointments:read', 'appointments:write']
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/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://app.huechat.ai/api/v2/accounts/{accountId}/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([
'allowed_ips' => [
'203.0.113.10/32'
],
'description' => 'Production appointment synchronization',
'expires_at' => '2027-09-01T00:00:00Z',
'name' => 'Clinic scheduling connector',
'rate_limit_rpm' => 600,
'scopes' => [
'appointments:read',
'appointments:write'
]
]),
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://app.huechat.ai/api/v2/accounts/{accountId}/api-keys"
payload := strings.NewReader("{\n \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\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://app.huechat.ai/api/v2/accounts/{accountId}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/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 \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"api_key": {
"allowed_ips": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"id": 123,
"last_used_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"rate_limit_rpm": 123,
"scopes": [
"<string>"
],
"token": "hc_full_token_is_shown_once",
"token_prefix": "hc_123456789",
"user_id": 123
},
"message": "<string>"
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}Authorizations
Your personal access token from Settings → Profile, or a scoped API key (hc_…) created at Settings → Developer → API keys. Send it as Authorization: Bearer <token>.
Path Parameters
HueChat account ID
Body
application/json
Scoped key settings
Example:
["203.0.113.10/32"]
Example:
"Production appointment synchronization"
Example:
"2027-09-01T00:00:00Z"
Example:
"Clinic scheduling connector"
Example:
600
Example:
["appointments:read", "appointments:write"]
⌘I
Create a scoped API key
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"allowed_ips": [
"203.0.113.10/32"
],
"description": "Production appointment synchronization",
"expires_at": "2027-09-01T00:00:00Z",
"name": "Clinic scheduling connector",
"rate_limit_rpm": 600,
"scopes": [
"appointments:read",
"appointments:write"
]
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/api-keys"
payload = {
"allowed_ips": ["203.0.113.10/32"],
"description": "Production appointment synchronization",
"expires_at": "2027-09-01T00:00:00Z",
"name": "Clinic scheduling connector",
"rate_limit_rpm": 600,
"scopes": ["appointments:read", "appointments:write"]
}
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({
allowed_ips: ['203.0.113.10/32'],
description: 'Production appointment synchronization',
expires_at: '2027-09-01T00:00:00Z',
name: 'Clinic scheduling connector',
rate_limit_rpm: 600,
scopes: ['appointments:read', 'appointments:write']
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/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://app.huechat.ai/api/v2/accounts/{accountId}/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([
'allowed_ips' => [
'203.0.113.10/32'
],
'description' => 'Production appointment synchronization',
'expires_at' => '2027-09-01T00:00:00Z',
'name' => 'Clinic scheduling connector',
'rate_limit_rpm' => 600,
'scopes' => [
'appointments:read',
'appointments:write'
]
]),
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://app.huechat.ai/api/v2/accounts/{accountId}/api-keys"
payload := strings.NewReader("{\n \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\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://app.huechat.ai/api/v2/accounts/{accountId}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/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 \"allowed_ips\": [\n \"203.0.113.10/32\"\n ],\n \"description\": \"Production appointment synchronization\",\n \"expires_at\": \"2027-09-01T00:00:00Z\",\n \"name\": \"Clinic scheduling connector\",\n \"rate_limit_rpm\": 600,\n \"scopes\": [\n \"appointments:read\",\n \"appointments:write\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"api_key": {
"allowed_ips": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"id": 123,
"last_used_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"rate_limit_rpm": 123,
"scopes": [
"<string>"
],
"token": "hc_full_token_is_shown_once",
"token_prefix": "hc_123456789",
"user_id": 123
},
"message": "<string>"
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}{
"code": "<string>",
"error": "<string>",
"limit": 123,
"retry_after": 123
}
