Skip to main content
PUT
Replace call time windows
Atomically replaces the call window configuration. Send any combination of inbound_enabled, outbound_enabled, closed_message, timezone and windows:
  • Omitting windows leaves the existing schedule unchanged.
  • Including windows (even as an empty array) overwrites the entire schedule for every day of the week.
  • Omitting closed_message leaves the after-hours message unchanged.
  • Omitting timezone leaves the workspace’s clock unchanged — see The workspace’s clock.
  • Sending expected_updated_at makes the write conditional: see Not overwriting someone else.
Both toggles gate phone calls. A browser session minted with POST /calls {"type": "web"} is a rehearsal and is never gated by a window. Requires call_windows:manage. Replacing the schedule takes every agent in the workspace on or off the phone, so a key minted for one agent’s management cannot do it. A key without the scope is refused with 403 INSUFFICIENT_SCOPE and nothing is written. Reading the hours (GET /call-windows) still needs no scope at all.
Keys created before this scope existed do not hold it — including keys minted with everything the dashboard offered the day they were made. You do not need a new secret: in Settings → API keys, a key that predates a scope lists it and offers Add to this key, which adds it in one press. The same key then works. (Ticking Calling hours under Edit scopes does the same thing by hand.)

Not overwriting someone else

These settings are one record for the whole workspace, and there is no per-agent copy: your integration, a colleague’s dashboard tab and a scheduled job all write the same hours and the same after-hours message. Without a version, the last write wins and the earlier one disappears without a word. GET /call-windows returns an updated_at. Send it back as expected_updated_at and the write only goes through if the record is still the one you read:
If someone changed the hours in between, the response is 409 CALL_WINDOWS_CONFLICT, nothing is written, and the message carries the version to re-read against. Read the hours again, decide what your change means against what is there now, and send the new updated_at. The field is optional. Omit it and the write is unconditional, exactly as it was before the field existed — every client that works today keeps working.

Window rules

  • day_of_week is 0–6 (0 = Sunday, 6 = Saturday).
  • start_time and end_time are HH:MM strings in 24-hour format. They are evaluated in the workspace timezone — set it with timezone on this request, or under Settings → Workspace clock in the dashboard.
  • start_time must be strictly earlier than end_time — there is no overnight wrap-around. To express a window that crosses midnight, use two entries on consecutive days (e.g. { day_of_week: 4, start_time: "22:00", end_time: "23:59" } and { day_of_week: 5, start_time: "00:00", end_time: "02:00" }).
  • Multiple windows per day are allowed but they must not overlap.

The workspace’s clock

timezone is the workspace’s clock, as an IANA name — Asia/Jerusalem, Europe/London, UTC. A name sent in another case (asia/jerusalem) is stored, and returned, as the zone database spells it (Asia/Jerusalem). It is one setting for the whole workspace, and it is more than these hours:
  • the calling hours above are read on it;
  • a relative date an agent collects (“tomorrow”, “next Sunday”) is anchored to its day;
  • GET /campaigns/defaults suggests hours in it;
  • GET /billing/consumption buckets days and months on it unless you ask for another zone;
  • the dashboard shows every call and delivery time on it.
Until anyone sets it the workspace is on UTC and GET /call-windows answers timezone_set: false. Sending timezone here — UTC included — sets it, and timezone_set turns true. A workspace with Israeli numbers left on UTC reads every one of those two to three hours off Israel time. An offset such as +03:00 or an abbreviation such as IDT is refused with 400: an offset stored as a clock would move every calling hour, and a zone name also follows daylight saving time, which an offset cannot.

The after-hours message

closed_message is what an inbound caller will hear when the window is closed, spoken before the call ends. It is workspace-wide and holds up to 500 characters. The field is stored and returned today, but calls do not speak it yet — out-of-hours calls are still ended in silence until the voice release that picks it up.
Send null (or a blank string, which is stored as null) to clear it and go back to ending out-of-hours calls in silence. The message only reaches anyone while inbound_enabled is true.

Example request

Example response

The response mirrors GET /call-windows so clients can update state without a follow-up read:

Disabling windows entirely

To stop gating outbound calls without losing your schedule, set the toggle off and omit windows:
To make a day fully closed, simply omit any windows for that day_of_week. To close every day, pass "windows": [].

Errors

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Body

application/json
inbound_enabled
boolean

When true, inbound phone calls outside the window are ended before an agent answers.

outbound_enabled
boolean

When true, outbound phone calls outside the window are scheduled for the next opening.

closed_message
string | null

What an inbound caller will hear when the window is closed, spoken before the call ends. Stored and returned today; not spoken yet, so out-of-hours calls are still ended in silence for now. Send null or a blank string to clear it. Omit the field to leave it unchanged.

Maximum string length: 500
timezone
string

The workspace's clock, as an IANA timezone name. The calling hours are read on it, and so are relative dates agents collect, GET /campaigns/defaults and the days of GET /billing/consumption. An offset (+03:00) or an abbreviation (IDT) is refused with 400. A name in another case (asia/jerusalem) is stored as the zone database spells it (Asia/Jerusalem). Omit it to leave the clock unchanged.

Example:

"Asia/Jerusalem"

windows
object[]

Full replacement set of windows. Empty array = no allowed windows on any day.

expected_updated_at
string<date-time>

Optional. The updated_at you read from GET /call-windows. When it no longer matches, the request is refused with 409 CALL_WINDOWS_CONFLICT and nothing is written, so you never replace a change you have not seen. Omit it to write unconditionally, which is what every client did before this field existed.

Example:

"2026-09-22T11:30:00.000Z"

Response

Updated configuration

Company-level configuration that gates phone calls by time-of-day. When outbound_enabled is true, outbound API requests placed outside any allowed window are deferred — the response is 202 Accepted with status: "scheduled" and a scheduled_for timestamp marking the next window opening. When inbound_enabled is true, inbound calls received outside any allowed window are ended before being answered (no call_logs row is created).

Browser sessions minted with POST /calls {"type":"web"} are rehearsals, not customer traffic: they are never gated by either toggle and always mint immediately, whatever the schedule says.

A day with no windows is a closed day for whichever directions are enforced. The default schedule (seeded for every company) is Sunday through Thursday 09:00–19:00 plus Friday 09:00–11:30; Saturday is closed.

timezone
string

The workspace's clock, as an IANA timezone name. UTC until someone sets it (timezone_set says which). Set it with timezone on PUT /call-windows, or under Settings → Workspace clock.

Example:

"Asia/Jerusalem"

timezone_set
boolean
read-only

Whether the workspace chose its clock. false means timezone is the UTC default nobody picked: the calling hours, relative dates and consumption days are still read on UTC, and the dashboard shows times on each reader's own browser clock (labelled as such) until the clock is set. true once any write names timezone, including UTC on purpose.

Example:

true

inbound_enabled
boolean

When true, inbound phone calls outside the window are ended before an agent answers. Default false.

outbound_enabled
boolean

When true, outbound phone calls outside the window are scheduled for the next opening. Default true.

closed_message
string | null

Optional message an inbound caller will hear when inbound_enabled is true and the window is closed, spoken before the call ends. null (the default) ends the call without saying anything. Blank strings are stored as null. The field is stored and returned today; calls do not speak it yet, so an out-of-hours call is still ended in silence until the voice release that picks it up.

Maximum string length: 500
Example:

"You've reached us outside our hours. We're here Sunday to Thursday, nine to seven."

updated_at
string<date-time>

The version of this whole record — the hours, the toggles and the message together. Send it back as expected_updated_at on a PUT and the write is refused with 409 CALL_WINDOWS_CONFLICT if anyone changed the hours in between, instead of silently replacing what they wrote. These settings are workspace-wide, so the other writer may be a colleague's dashboard tab.

Example:

"2026-09-22T11:30:00.000Z"

windows
object[]