Create or safely replay an appointment
Requires appointments:write. Select the appointment type by service_id or exact service_name; select a resource by resource_id/resource_name or omit it to use an eligible available resource. Supply starts_at in RFC3339 or local date plus time. The configured service duration determines ends_at, so ends_at is optional. Supplying contact_id also requires contacts:read; supplying deal_id also requires deals:write and UUID selectors. API-key callers must provide external_id; retrying the identical request returns the existing appointment without creating a duplicate.
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/appointments \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": 42,
"customer_email": "customer@example.com",
"customer_name": "Example Customer",
"customer_phone": "+966500000000",
"date": "2026-09-15",
"deal_id": "00000000-0000-4000-8000-000000000003",
"ends_at": "2026-09-15T09:30:00Z",
"external_id": "erp-appointment-10492",
"notes": "Created from ERP",
"resource_id": "00000000-0000-4000-8000-000000000001",
"resource_name": "Dr. Sara",
"service_id": "00000000-0000-4000-8000-000000000002",
"service_name": "Initial consultation",
"starts_at": "2026-09-15T09:00:00Z",
"status": "booked",
"time": "12:00"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/appointments"
payload = {
"contact_id": 42,
"customer_email": "customer@example.com",
"customer_name": "Example Customer",
"customer_phone": "+966500000000",
"date": "2026-09-15",
"deal_id": "00000000-0000-4000-8000-000000000003",
"ends_at": "2026-09-15T09:30:00Z",
"external_id": "erp-appointment-10492",
"notes": "Created from ERP",
"resource_id": "00000000-0000-4000-8000-000000000001",
"resource_name": "Dr. Sara",
"service_id": "00000000-0000-4000-8000-000000000002",
"service_name": "Initial consultation",
"starts_at": "2026-09-15T09:00:00Z",
"status": "booked",
"time": "12:00"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
contact_id: 42,
customer_email: 'customer@example.com',
customer_name: 'Example Customer',
customer_phone: '+966500000000',
date: '2026-09-15',
deal_id: '00000000-0000-4000-8000-000000000003',
ends_at: '2026-09-15T09:30:00Z',
external_id: 'erp-appointment-10492',
notes: 'Created from ERP',
resource_id: '00000000-0000-4000-8000-000000000001',
resource_name: 'Dr. Sara',
service_id: '00000000-0000-4000-8000-000000000002',
service_name: 'Initial consultation',
starts_at: '2026-09-15T09:00:00Z',
status: 'booked',
time: '12:00'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/appointments', 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}/appointments",
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([
'contact_id' => 42,
'customer_email' => 'customer@example.com',
'customer_name' => 'Example Customer',
'customer_phone' => '+966500000000',
'date' => '2026-09-15',
'deal_id' => '00000000-0000-4000-8000-000000000003',
'ends_at' => '2026-09-15T09:30:00Z',
'external_id' => 'erp-appointment-10492',
'notes' => 'Created from ERP',
'resource_id' => '00000000-0000-4000-8000-000000000001',
'resource_name' => 'Dr. Sara',
'service_id' => '00000000-0000-4000-8000-000000000002',
'service_name' => 'Initial consultation',
'starts_at' => '2026-09-15T09:00:00Z',
'status' => 'booked',
'time' => '12:00'
]),
CURLOPT_HTTPHEADER => [
"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}/appointments"
payload := strings.NewReader("{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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}/appointments")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/appointments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}"
response = http.request(request)
puts response.read_body{
"account_id": 123,
"buffer_after_minutes": 123,
"buffer_before_minutes": 123,
"busy_ends_at": "2023-11-07T05:31:56Z",
"busy_starts_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"cancelled_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"contact_id": 123,
"conversation_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"created_by_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_user_id": 123,
"customer_email": "<string>",
"customer_name": "<string>",
"customer_phone": "<string>",
"duration_minutes": 123,
"ends_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>",
"public_id": "<string>",
"resource_color": "<string>",
"resource_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"resource_name": "<string>",
"resource_type": "<string>",
"service_color": "<string>",
"service_currency": "<string>",
"service_description": "<string>",
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_name": "<string>",
"service_price": 123,
"source": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}Path Parameters
HueChat account ID
Body
Appointment
42
"customer@example.com"
"Example Customer"
"+966500000000"
"2026-09-15"
"00000000-0000-4000-8000-000000000003"
"2026-09-15T09:30:00Z"
1 - 128"erp-appointment-10492"
"Created from ERP"
"00000000-0000-4000-8000-000000000001"
"Dr. Sara"
"00000000-0000-4000-8000-000000000002"
"Initial consultation"
"2026-09-15T09:00:00Z"
tentative, booked, confirmed "booked"
"12:00"
Response
OK
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/appointments \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": 42,
"customer_email": "customer@example.com",
"customer_name": "Example Customer",
"customer_phone": "+966500000000",
"date": "2026-09-15",
"deal_id": "00000000-0000-4000-8000-000000000003",
"ends_at": "2026-09-15T09:30:00Z",
"external_id": "erp-appointment-10492",
"notes": "Created from ERP",
"resource_id": "00000000-0000-4000-8000-000000000001",
"resource_name": "Dr. Sara",
"service_id": "00000000-0000-4000-8000-000000000002",
"service_name": "Initial consultation",
"starts_at": "2026-09-15T09:00:00Z",
"status": "booked",
"time": "12:00"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/appointments"
payload = {
"contact_id": 42,
"customer_email": "customer@example.com",
"customer_name": "Example Customer",
"customer_phone": "+966500000000",
"date": "2026-09-15",
"deal_id": "00000000-0000-4000-8000-000000000003",
"ends_at": "2026-09-15T09:30:00Z",
"external_id": "erp-appointment-10492",
"notes": "Created from ERP",
"resource_id": "00000000-0000-4000-8000-000000000001",
"resource_name": "Dr. Sara",
"service_id": "00000000-0000-4000-8000-000000000002",
"service_name": "Initial consultation",
"starts_at": "2026-09-15T09:00:00Z",
"status": "booked",
"time": "12:00"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
contact_id: 42,
customer_email: 'customer@example.com',
customer_name: 'Example Customer',
customer_phone: '+966500000000',
date: '2026-09-15',
deal_id: '00000000-0000-4000-8000-000000000003',
ends_at: '2026-09-15T09:30:00Z',
external_id: 'erp-appointment-10492',
notes: 'Created from ERP',
resource_id: '00000000-0000-4000-8000-000000000001',
resource_name: 'Dr. Sara',
service_id: '00000000-0000-4000-8000-000000000002',
service_name: 'Initial consultation',
starts_at: '2026-09-15T09:00:00Z',
status: 'booked',
time: '12:00'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/appointments', 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}/appointments",
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([
'contact_id' => 42,
'customer_email' => 'customer@example.com',
'customer_name' => 'Example Customer',
'customer_phone' => '+966500000000',
'date' => '2026-09-15',
'deal_id' => '00000000-0000-4000-8000-000000000003',
'ends_at' => '2026-09-15T09:30:00Z',
'external_id' => 'erp-appointment-10492',
'notes' => 'Created from ERP',
'resource_id' => '00000000-0000-4000-8000-000000000001',
'resource_name' => 'Dr. Sara',
'service_id' => '00000000-0000-4000-8000-000000000002',
'service_name' => 'Initial consultation',
'starts_at' => '2026-09-15T09:00:00Z',
'status' => 'booked',
'time' => '12:00'
]),
CURLOPT_HTTPHEADER => [
"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}/appointments"
payload := strings.NewReader("{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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}/appointments")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/appointments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": 42,\n \"customer_email\": \"customer@example.com\",\n \"customer_name\": \"Example Customer\",\n \"customer_phone\": \"+966500000000\",\n \"date\": \"2026-09-15\",\n \"deal_id\": \"00000000-0000-4000-8000-000000000003\",\n \"ends_at\": \"2026-09-15T09:30:00Z\",\n \"external_id\": \"erp-appointment-10492\",\n \"notes\": \"Created from ERP\",\n \"resource_id\": \"00000000-0000-4000-8000-000000000001\",\n \"resource_name\": \"Dr. Sara\",\n \"service_id\": \"00000000-0000-4000-8000-000000000002\",\n \"service_name\": \"Initial consultation\",\n \"starts_at\": \"2026-09-15T09:00:00Z\",\n \"status\": \"booked\",\n \"time\": \"12:00\"\n}"
response = http.request(request)
puts response.read_body{
"account_id": 123,
"buffer_after_minutes": 123,
"buffer_before_minutes": 123,
"busy_ends_at": "2023-11-07T05:31:56Z",
"busy_starts_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"cancelled_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"contact_id": 123,
"conversation_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"created_by_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_user_id": 123,
"customer_email": "<string>",
"customer_name": "<string>",
"customer_phone": "<string>",
"duration_minutes": 123,
"ends_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>",
"public_id": "<string>",
"resource_color": "<string>",
"resource_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"resource_name": "<string>",
"resource_type": "<string>",
"service_color": "<string>",
"service_currency": "<string>",
"service_description": "<string>",
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_name": "<string>",
"service_price": 123,
"source": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}{
"error": "<string>",
"limit": "<string>"
}
