Update a routing automation
const url = 'https://api.caller9.app/v1/numbers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/automations/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"action":"route_studio","dest_studio_guid":"example","dest_trunk_guid":"example","forward_dest_type":"sip","forward_sip_address":"example","forward_phone_number":"example","label":"example","days_mask":1,"trigger_minute":1,"timezone":"America/Chicago","enabled":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.caller9.app/v1/numbers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/automations/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "action": "route_studio", "dest_studio_guid": "example", "dest_trunk_guid": "example", "forward_dest_type": "sip", "forward_sip_address": "example", "forward_phone_number": "example", "label": "example", "days_mask": 1, "trigger_minute": 1, "timezone": "America/Chicago", "enabled": true }'Updates an automation. Omitted fields keep their current values. When changing action, supply the destination for the new action (dest_studio_guid, dest_trunk_guid, or the forward_* fields); the previous action’s destination is cleared. The plan gate for the resulting action applies (409 plan_limit). Requires a full-access key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Phone number ID (UUID), not the phone number itself.
Automation ID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Required for route_studio. A studio in the same organization.
Required for route_trunk. A SIP trunk in the same organization.
Required for route_forward.
Required when forward_dest_type is sip. Normalized like a number forward’s sip_address.
Required when forward_dest_type is phone. Valid US/Canadian number; stored as E.164.
Free-text label. Defaults to empty.
Days of week the automation fires, as a bitmask in timezone (bit 0 = Sunday … bit 6 = Saturday).
Minute of the day (local to timezone) the automation fires, e.g. 540 = 09:00.
IANA timezone name.
Example
America/ChicagoResponses
Section titled “Responses”The updated automation.
object
A recurring routing automation for a number. Exactly one destination is set, matching action: dest_studio_guid (route_studio), dest_trunk_guid (route_trunk), or the forward_* fields (route_forward).
object
Bitmask of days (bit 0 = Sunday … bit 6 = Saturday).
When the automation last fired. Included on create/update responses only.
Always null for number automations. Included on create/update responses only.
Always null for number automations. Included on create/update responses only.
Example
{ "automation": { "action": "route_studio", "forward_dest_type": "sip", "enabled": 0 }}The request was invalid.
object
Human-readable error message.
Machine-readable code (authentication failures only, e.g. KEY_EXPIRED, RATE_LIMITED).
Example generated
{ "error": "example", "code": "example"}Missing, invalid, expired or revoked API key.
object
Human-readable error message.
Machine-readable code (authentication failures only, e.g. KEY_EXPIRED, RATE_LIMITED).
Example generated
{ "error": "example", "code": "example"}The key isn’t allowed to do this (e.g. a read-only key making a change).
object
Human-readable error message.
Machine-readable code (authentication failures only, e.g. KEY_EXPIRED, RATE_LIMITED).
Example generated
{ "error": "example", "code": "example"}Not found, or belongs to another organization.
object
Human-readable error message.
Machine-readable code (authentication failures only, e.g. KEY_EXPIRED, RATE_LIMITED).
Example generated
{ "error": "example", "code": "example"}Blocked by the organization’s plan.
object
Which cap was hit, e.g. studios, numbers, ai_screening, trunk_channels.
Example
{ "error": "plan_limit"}Too many requests for this API key. Retry after Retry-After seconds.
object
Human-readable error message.
Machine-readable code (authentication failures only, e.g. KEY_EXPIRED, RATE_LIMITED).
Example generated
{ "error": "example", "code": "example"}Headers
Section titled “Headers”Seconds until the rate-limit window resets.