Create agent closure
Adds a closure of whole days: during it the business counts as closed, the agent knows it, and in outside_hours_only mode it answers those days. Returns the closure. Both dates are included and are days of the agent timezone. The end date cannot be in the past, a closure lasts at most 366 days and must start within 730 days. An agent has at most 50 upcoming closures. For a longer stop, suspend the agent. Required scope: agents:operate. With a test key (vx_test_) it is simulated: nothing real happens and nothing is billed. Requires an Idempotency-Key header. Retriable: when the operation itself fails with a 429, a 5xx or a temporary 409, the key is released and a retry with the same key runs the operation again; with no response at all, a retry with the same key returns the first outcome or runs the operation again. A 429 rate_limited from the request limit and 409 request_in_progress come before the operation and leave the key as it is: retry with the same key.
Authentication
Path parameters
Id of an agent of the organization, as returned by GET /agents.
Headers
API version for this request; defaults to the version the key is pinned to.
A unique value you generate for each new operation (16 to 64 letters, digits, hyphen or underscore; a UUID works). Repeating the same request with the same key within 24 hours returns the first response and does nothing again, when that response was a success or a 4xx error the same request would always get again (not 429, and not the temporary 409 codes request_in_progress, caller_has_active_call and caller_request_in_progress: for those, and for a 5xx, see the note on retrying in the operation); the same key with a different request is refused with idempotency_key_reused.
Request
Whole days, both ends included, at most 366 days and starting within 730 days. The same dates again change the label of the existing closure (when given).
First day of the closure, YYYY-MM-DD, in the agent timezone. At most 730 days from today.
Last day of the closure, YYYY-MM-DD, included. It cannot be before start_date or in the past, and the closure lasts at most 366 days.
What the closure is for, for your team (at most 100 characters). Do not put personal data in it.
Response
A closure with the same dates already existed: nothing was created, created is false, and its label is updated when you sent one.
Always agent_closure.
First closed day, YYYY-MM-DD, in the agent timezone.
Last closed day, YYYY-MM-DD, included.
What the closure is for; null when no label was given.
Whether the closure was created (201) or already existed with the same dates (200).
true when the request was made with a test key: every check ran but nothing was changed. false with a live key.