Save Sales working hours
Requires a workspace administrator with account:write. Supply all seven unique days (Sunday=0), an IANA timezone, enabled state and the latest version from GET. Atomically saves the selected inbox’s canonical schedule with history/outbox; stale versions return 409. Overnight intervals are allowed, equal times require open_all_day, and disabled schedules do not require an open day. This affects other inbox business-hours consumers such as SLA, but never edits AI-agent hours, assignment policy or automatic messages. Configure fallback ownership/default inbox separately in Sales settings.
curl --request PUT \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": true,
"day_of_week": 123,
"open_all_day": true,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": true,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}"
payload = {
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": True,
"day_of_week": 123,
"open_all_day": True,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": True,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
days: [
{
close_hour: 123,
close_minutes: 123,
closed_all_day: true,
day_of_week: 123,
open_all_day: true,
open_hour: 123,
open_minutes: 123
}
],
enabled: true,
inbox_id: 123,
name: '<string>',
timezone: '<string>',
version: '<string>'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}', 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}/sales/working-hours/{inboxId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'days' => [
[
'close_hour' => 123,
'close_minutes' => 123,
'closed_all_day' => true,
'day_of_week' => 123,
'open_all_day' => true,
'open_hour' => 123,
'open_minutes' => 123
]
],
'enabled' => true,
'inbox_id' => 123,
'name' => '<string>',
'timezone' => '<string>',
'version' => '<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://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}"
payload := strings.NewReader("{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"schedule": {
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": true,
"day_of_week": 123,
"open_all_day": true,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": true,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}Authorizations
Your personal access token where supported, or a scoped API key (hc_…) created inside HueChat at Account → Developer API. Send it as Authorization: Bearer <token>.
Body
Complete versioned inbox schedule; name is read-only
Response
OK
Show child attributes
Show child attributes
curl --request PUT \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": true,
"day_of_week": 123,
"open_all_day": true,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": true,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}"
payload = {
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": True,
"day_of_week": 123,
"open_all_day": True,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": True,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
days: [
{
close_hour: 123,
close_minutes: 123,
closed_all_day: true,
day_of_week: 123,
open_all_day: true,
open_hour: 123,
open_minutes: 123
}
],
enabled: true,
inbox_id: 123,
name: '<string>',
timezone: '<string>',
version: '<string>'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}', 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}/sales/working-hours/{inboxId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'days' => [
[
'close_hour' => 123,
'close_minutes' => 123,
'closed_all_day' => true,
'day_of_week' => 123,
'open_all_day' => true,
'open_hour' => 123,
'open_minutes' => 123
]
],
'enabled' => true,
'inbox_id' => 123,
'name' => '<string>',
'timezone' => '<string>',
'version' => '<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://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}"
payload := strings.NewReader("{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/sales/working-hours/{inboxId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"days\": [\n {\n \"close_hour\": 123,\n \"close_minutes\": 123,\n \"closed_all_day\": true,\n \"day_of_week\": 123,\n \"open_all_day\": true,\n \"open_hour\": 123,\n \"open_minutes\": 123\n }\n ],\n \"enabled\": true,\n \"inbox_id\": 123,\n \"name\": \"<string>\",\n \"timezone\": \"<string>\",\n \"version\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"schedule": {
"days": [
{
"close_hour": 123,
"close_minutes": 123,
"closed_all_day": true,
"day_of_week": 123,
"open_all_day": true,
"open_hour": 123,
"open_minutes": 123
}
],
"enabled": true,
"inbox_id": 123,
"name": "<string>",
"timezone": "<string>",
"version": "<string>"
}
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}{
"code": "plan_disabled",
"error": "Sales record is unavailable",
"feature": "crm_leads"
}
