Skip to main content
PUT
/
api
/
v1
/
agents
/
{uuid}
/
appointments
Replace agent appointment settings and schedule assignments
curl --request PUT \
  --url https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "enabled": true,
  "random_assignment": true,
  "schedule_assignments": [
    {
      "schedule_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "Service Appointment",
      "description": "When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.",
      "slot_rules": {
        "offer_slots_from": "3_hours",
        "book_slots_from": "6_hours",
        "max_appointments_per_day": 10,
        "conflict_resolution_enabled": true,
        "alternative_slots_count": 3,
        "suggestion_priority": "nearest",
        "prefer_same_day": true,
        "prefer_same_time_slot": false,
        "include_same_week": true
      },
      "rescheduling": {
        "policy": "always_ask",
        "minor_change_hours": 2,
        "minor_change_same_day": true,
        "minor_change_same_week": false,
        "minor_change_same_slot": false,
        "min_rescheduling_notice": "2_hours"
      },
      "cancellation": {
        "min_cancellation_notice": "24_hours",
        "ai_can_cancel": false,
        "require_cancellation_reason": true,
        "cancellation_fee_policy": "no_fee"
      },
      "questions": {
        "inherit_from_schedule": true,
        "custom_questions": [
          {
            "name": "License plate",
            "type": "text",
            "description": "Vehicle license plate number for the service appointment.",
            "required": true
          }
        ]
      },
      "approval": {
        "require_approval": true,
        "approval_threshold": "1_hour",
        "approval_for_create": false,
        "approval_for_reschedule": true,
        "approval_for_cancel": true,
        "approval_for_notes": false,
        "notify_calendar_owner": "always",
        "notify_admins": "always",
        "expected_response_time": "5_min"
      }
    }
  ]
}
'
import requests

url = "https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments"

payload = {
    "enabled": True,
    "random_assignment": True,
    "schedule_assignments": [
        {
            "schedule_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "name": "Service Appointment",
            "description": "When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.",
            "slot_rules": {
                "offer_slots_from": "3_hours",
                "book_slots_from": "6_hours",
                "max_appointments_per_day": 10,
                "conflict_resolution_enabled": True,
                "alternative_slots_count": 3,
                "suggestion_priority": "nearest",
                "prefer_same_day": True,
                "prefer_same_time_slot": False,
                "include_same_week": True
            },
            "rescheduling": {
                "policy": "always_ask",
                "minor_change_hours": 2,
                "minor_change_same_day": True,
                "minor_change_same_week": False,
                "minor_change_same_slot": False,
                "min_rescheduling_notice": "2_hours"
            },
            "cancellation": {
                "min_cancellation_notice": "24_hours",
                "ai_can_cancel": False,
                "require_cancellation_reason": True,
                "cancellation_fee_policy": "no_fee"
            },
            "questions": {
                "inherit_from_schedule": True,
                "custom_questions": [
                    {
                        "name": "License plate",
                        "type": "text",
                        "description": "Vehicle license plate number for the service appointment.",
                        "required": True
                    }
                ]
            },
            "approval": {
                "require_approval": True,
                "approval_threshold": "1_hour",
                "approval_for_create": False,
                "approval_for_reschedule": True,
                "approval_for_cancel": True,
                "approval_for_notes": False,
                "notify_calendar_owner": "always",
                "notify_admins": "always",
                "expected_response_time": "5_min"
            }
        }
    ]
}
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({
    enabled: true,
    random_assignment: true,
    schedule_assignments: [
      {
        schedule_uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
        name: 'Service Appointment',
        description: 'When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.',
        slot_rules: {
          offer_slots_from: '3_hours',
          book_slots_from: '6_hours',
          max_appointments_per_day: 10,
          conflict_resolution_enabled: true,
          alternative_slots_count: 3,
          suggestion_priority: 'nearest',
          prefer_same_day: true,
          prefer_same_time_slot: false,
          include_same_week: true
        },
        rescheduling: {
          policy: 'always_ask',
          minor_change_hours: 2,
          minor_change_same_day: true,
          minor_change_same_week: false,
          minor_change_same_slot: false,
          min_rescheduling_notice: '2_hours'
        },
        cancellation: {
          min_cancellation_notice: '24_hours',
          ai_can_cancel: false,
          require_cancellation_reason: true,
          cancellation_fee_policy: 'no_fee'
        },
        questions: {
          inherit_from_schedule: true,
          custom_questions: [
            {
              name: 'License plate',
              type: 'text',
              description: 'Vehicle license plate number for the service appointment.',
              required: true
            }
          ]
        },
        approval: {
          require_approval: true,
          approval_threshold: '1_hour',
          approval_for_create: false,
          approval_for_reschedule: true,
          approval_for_cancel: true,
          approval_for_notes: false,
          notify_calendar_owner: 'always',
          notify_admins: 'always',
          expected_response_time: '5_min'
        }
      }
    ]
  })
};

fetch('https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments",
  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([
    'enabled' => true,
    'random_assignment' => true,
    'schedule_assignments' => [
        [
                'schedule_uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
                'name' => 'Service Appointment',
                'description' => 'When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.',
                'slot_rules' => [
                                'offer_slots_from' => '3_hours',
                                'book_slots_from' => '6_hours',
                                'max_appointments_per_day' => 10,
                                'conflict_resolution_enabled' => true,
                                'alternative_slots_count' => 3,
                                'suggestion_priority' => 'nearest',
                                'prefer_same_day' => true,
                                'prefer_same_time_slot' => false,
                                'include_same_week' => true
                ],
                'rescheduling' => [
                                'policy' => 'always_ask',
                                'minor_change_hours' => 2,
                                'minor_change_same_day' => true,
                                'minor_change_same_week' => false,
                                'minor_change_same_slot' => false,
                                'min_rescheduling_notice' => '2_hours'
                ],
                'cancellation' => [
                                'min_cancellation_notice' => '24_hours',
                                'ai_can_cancel' => false,
                                'require_cancellation_reason' => true,
                                'cancellation_fee_policy' => 'no_fee'
                ],
                'questions' => [
                                'inherit_from_schedule' => true,
                                'custom_questions' => [
                                                                [
                                                                                                                                'name' => 'License plate',
                                                                                                                                'type' => 'text',
                                                                                                                                'description' => 'Vehicle license plate number for the service appointment.',
                                                                                                                                'required' => true
                                                                ]
                                ]
                ],
                'approval' => [
                                'require_approval' => true,
                                'approval_threshold' => '1_hour',
                                'approval_for_create' => false,
                                'approval_for_reschedule' => true,
                                'approval_for_cancel' => true,
                                'approval_for_notes' => false,
                                'notify_calendar_owner' => 'always',
                                'notify_admins' => 'always',
                                'expected_response_time' => '5_min'
                ]
        ]
    ]
  ]),
  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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments"

	payload := strings.NewReader("{\n  \"enabled\": true,\n  \"random_assignment\": true,\n  \"schedule_assignments\": [\n    {\n      \"schedule_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n      \"name\": \"Service Appointment\",\n      \"description\": \"When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.\",\n      \"slot_rules\": {\n        \"offer_slots_from\": \"3_hours\",\n        \"book_slots_from\": \"6_hours\",\n        \"max_appointments_per_day\": 10,\n        \"conflict_resolution_enabled\": true,\n        \"alternative_slots_count\": 3,\n        \"suggestion_priority\": \"nearest\",\n        \"prefer_same_day\": true,\n        \"prefer_same_time_slot\": false,\n        \"include_same_week\": true\n      },\n      \"rescheduling\": {\n        \"policy\": \"always_ask\",\n        \"minor_change_hours\": 2,\n        \"minor_change_same_day\": true,\n        \"minor_change_same_week\": false,\n        \"minor_change_same_slot\": false,\n        \"min_rescheduling_notice\": \"2_hours\"\n      },\n      \"cancellation\": {\n        \"min_cancellation_notice\": \"24_hours\",\n        \"ai_can_cancel\": false,\n        \"require_cancellation_reason\": true,\n        \"cancellation_fee_policy\": \"no_fee\"\n      },\n      \"questions\": {\n        \"inherit_from_schedule\": true,\n        \"custom_questions\": [\n          {\n            \"name\": \"License plate\",\n            \"type\": \"text\",\n            \"description\": \"Vehicle license plate number for the service appointment.\",\n            \"required\": true\n          }\n        ]\n      },\n      \"approval\": {\n        \"require_approval\": true,\n        \"approval_threshold\": \"1_hour\",\n        \"approval_for_create\": false,\n        \"approval_for_reschedule\": true,\n        \"approval_for_cancel\": true,\n        \"approval_for_notes\": false,\n        \"notify_calendar_owner\": \"always\",\n        \"notify_admins\": \"always\",\n        \"expected_response_time\": \"5_min\"\n      }\n    }\n  ]\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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"enabled\": true,\n  \"random_assignment\": true,\n  \"schedule_assignments\": [\n    {\n      \"schedule_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n      \"name\": \"Service Appointment\",\n      \"description\": \"When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.\",\n      \"slot_rules\": {\n        \"offer_slots_from\": \"3_hours\",\n        \"book_slots_from\": \"6_hours\",\n        \"max_appointments_per_day\": 10,\n        \"conflict_resolution_enabled\": true,\n        \"alternative_slots_count\": 3,\n        \"suggestion_priority\": \"nearest\",\n        \"prefer_same_day\": true,\n        \"prefer_same_time_slot\": false,\n        \"include_same_week\": true\n      },\n      \"rescheduling\": {\n        \"policy\": \"always_ask\",\n        \"minor_change_hours\": 2,\n        \"minor_change_same_day\": true,\n        \"minor_change_same_week\": false,\n        \"minor_change_same_slot\": false,\n        \"min_rescheduling_notice\": \"2_hours\"\n      },\n      \"cancellation\": {\n        \"min_cancellation_notice\": \"24_hours\",\n        \"ai_can_cancel\": false,\n        \"require_cancellation_reason\": true,\n        \"cancellation_fee_policy\": \"no_fee\"\n      },\n      \"questions\": {\n        \"inherit_from_schedule\": true,\n        \"custom_questions\": [\n          {\n            \"name\": \"License plate\",\n            \"type\": \"text\",\n            \"description\": \"Vehicle license plate number for the service appointment.\",\n            \"required\": true\n          }\n        ]\n      },\n      \"approval\": {\n        \"require_approval\": true,\n        \"approval_threshold\": \"1_hour\",\n        \"approval_for_create\": false,\n        \"approval_for_reschedule\": true,\n        \"approval_for_cancel\": true,\n        \"approval_for_notes\": false,\n        \"notify_calendar_owner\": \"always\",\n        \"notify_admins\": \"always\",\n        \"expected_response_time\": \"5_min\"\n      }\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/appointments")

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  \"enabled\": true,\n  \"random_assignment\": true,\n  \"schedule_assignments\": [\n    {\n      \"schedule_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n      \"name\": \"Service Appointment\",\n      \"description\": \"When the customer requires routine maintenance, oil change, or scheduled service for their vehicle.\",\n      \"slot_rules\": {\n        \"offer_slots_from\": \"3_hours\",\n        \"book_slots_from\": \"6_hours\",\n        \"max_appointments_per_day\": 10,\n        \"conflict_resolution_enabled\": true,\n        \"alternative_slots_count\": 3,\n        \"suggestion_priority\": \"nearest\",\n        \"prefer_same_day\": true,\n        \"prefer_same_time_slot\": false,\n        \"include_same_week\": true\n      },\n      \"rescheduling\": {\n        \"policy\": \"always_ask\",\n        \"minor_change_hours\": 2,\n        \"minor_change_same_day\": true,\n        \"minor_change_same_week\": false,\n        \"minor_change_same_slot\": false,\n        \"min_rescheduling_notice\": \"2_hours\"\n      },\n      \"cancellation\": {\n        \"min_cancellation_notice\": \"24_hours\",\n        \"ai_can_cancel\": false,\n        \"require_cancellation_reason\": true,\n        \"cancellation_fee_policy\": \"no_fee\"\n      },\n      \"questions\": {\n        \"inherit_from_schedule\": true,\n        \"custom_questions\": [\n          {\n            \"name\": \"License plate\",\n            \"type\": \"text\",\n            \"description\": \"Vehicle license plate number for the service appointment.\",\n            \"required\": true\n          }\n        ]\n      },\n      \"approval\": {\n        \"require_approval\": true,\n        \"approval_threshold\": \"1_hour\",\n        \"approval_for_create\": false,\n        \"approval_for_reschedule\": true,\n        \"approval_for_cancel\": true,\n        \"approval_for_notes\": false,\n        \"notify_calendar_owner\": \"always\",\n        \"notify_admins\": \"always\",\n        \"expected_response_time\": \"5_min\"\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "description": "<string>",
    "company_name": "<string>",
    "role": "<string>",
    "objective": "<string>",
    "tone": "<string>",
    "behavior_guidelines": "<string>",
    "company_service": "<string>",
    "topic": "<string>",
    "length_detail": "<string>",
    "interest_of_product": "<string>",
    "negative_response": "<string>",
    "custom_prompt": "<string>",
    "language": "<string>",
    "speed": "<string>",
    "timezone": "<string>",
    "appointment_scheduling_enabled": true,
    "appointment_scheduling_randomly": true,
    "custom_llm_url": "<string>",
    "recommendations": "<string>",
    "settings": {
      "voice": {},
      "text": {},
      "memorize": {},
      "evaluation": {}
    },
    "guidelines": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "content": "Always confirm vehicle VIN or license plate before creating a service appointment.",
        "order": 0
      }
    ],
    "notes": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "content": "Service appointments take 60-90 minutes for standard maintenance, 2-4 hours for warranty work. Same-day pickup is available before 4 PM.",
        "order": 0
      }
    ],
    "procedures": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "Book service appointment",
        "description": "Used when the customer wants to schedule a service appointment for their vehicle.",
        "steps": [
          {
            "order": 1,
            "description": "Ask the customer for their vehicle license plate or VIN.",
            "intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          }
        ]
      }
    ],
    "training": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "content": "What does Volvo's standard warranty cover?",
        "intent": "warranty_inquiry",
        "response": "Volvo's standard warranty covers 4 years or 100,000 km, whichever comes first, including parts and labor at any authorized service center. Would you like the details for your specific model?"
      }
    ],
    "intents": [
      {
        "intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "key": "<string>",
        "name": "<string>",
        "description": "<string>",
        "recommendation_actions": "<string>",
        "confidence_threshold": 123,
        "is_system": true,
        "intent_llm_handle_by_response": true,
        "webhook": {
          "url": "<string>",
          "auth_token": "<string>"
        },
        "parameters": [
          {
            "key": "email",
            "default": "<string>",
            "type": "string",
            "required": true
          }
        ],
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z"
      }
    ],
    "webhooks": [
      {
        "webhook_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "url": "<string>",
        "events": [],
        "is_active": true,
        "has_secret": true,
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z"
      }
    ],
    "appointments": {},
    "routing_rules": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "detection_mode": "intent",
        "trigger_keyword": "sales",
        "department_name": "Sales Department",
        "phrases": [
          "I want to talk to sales"
        ],
        "ai_prompt": "Detect when the customer wants to speak with the sales team — they may ask about pricing, new products, quotes, or directly mention sales.",
        "voice_response": "Sure, I'll transfer you to our sales team now. One moment please.",
        "voice_on_error": "I'm sorry, I couldn't reach sales right now. Please call back later or leave a message.",
        "voice_on_success": "You've been successfully connected. Have a great day.",
        "destination_type": "extension",
        "destination": "101",
        "destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "transfer_type": "transfer_call",
        "transfer_config": {},
        "priority": 1,
        "is_active": true
      }
    ],
    "guard_rules": [
      {
        "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "Legal complaint escalation",
        "when_condition": "Customer mentions a legal complaint, lawyer, lawsuit, or threatens to take legal action.",
        "example_phrases": [
          "I'm calling my lawyer about this"
        ],
        "then_action": "forward",
        "selected_channels": [],
        "say_before_forwarding": "I understand this is important — let me connect you with someone who can help.",
        "say_before_end": "I'm sorry I couldn't help further. Please contact our team directly. Goodbye.",
        "destination": "<string>",
        "destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "is_active": true,
        "is_default": false
      }
    ],
    "phone_numbers": [
      {
        "phone_number_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "number": "<string>",
        "country_code": "<string>",
        "type": "<string>",
        "capabilities": {
          "call": true,
          "sms": true,
          "whatsapp": true,
          "whatsapp_call": true
        }
      }
    ],
    "channels": [
      {}
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"

Path Parameters

uuid
string<uuid>
required

Body

application/json
enabled
boolean
random_assignment
boolean
schedule_assignments
object[]

Each entry connects the agent to a schedule and tells the runtime AI when and how to use it. Always provide name and description for every assignment — without them the runtime AI cannot distinguish between schedule types when a contact asks for an appointment.

Response

Appointments updated

data
object