Skip to main content
Read and replace a number’s call flow as one JSON document, check a change before it goes live, and undo it from the flow’s versions:
A saved flow answers the next call. Validate a change first, or save it as a draft for a person to publish. Keep the versionId of your read: restoring it undoes your save. If you did not keep it, or your read had versionId: null, find the version from before your save in List call flow versions (for a first save, the source: baseline version).
The API key acts as a company admin. Number ids come from the Numbers API.

Read a number’s call flow

Get a number’s call flow returns the flow and an ETag header that identifies this state of the flow’s steps. Every live write needs it; a draft save may omit it. A shortened answer:
  • include=names adds a name next to each id, such as groupName.
  • To poll, send the ETag as If-None-Match: an unchanged flow answers 304. The ETag covers the steps only, so businessHours, versionId, editable and problems can change while it stays the same.
  • HTTP Request header values are never returned: a header reads value: null with valueSet: true.

When a flow is not editable

A flow that reads editable: false cannot be sent back as it is. problems says why: When contact fields cannot be read, a custom field variable in an HTTP Request step may read in its stored id form, {{contact.custom_fields.<id>}}. It is accepted back as it is. editable: true does not promise that an unchanged save succeeds: a flow saved in the Dashboard may break a limit (422 VALIDATION.INVALID_FIELD) or lack ringSeconds on a ring or redirect step with steps under “no answer” (422 CALL_FLOWS.RING_SECONDS_REQUIRED).

Change a number’s call flow

Replace a number’s call flow replaces every step. Send the document you read with your change, and the ETag of your read as If-Match. This flow plays a greeting, rings the Support group, then takes a voicemail:
The response is the saved flow with its new ETag, versionId and warnings.
  • Ids. Keep a step by sending its id; a step without one is new, and steps you leave out are deleted. Give a new step a ref when another step points at it, such as a Jump to target.
  • Round trip. A document you read is accepted back, except for a flow that is not editable. Read-only fields are ignored; any other unknown field is 400 VALIDATION.INVALID_BODY.
  • Secrets. Send an HTTP Request header without value to keep its stored value. Put credentials in headers, not in the URL or body.
  • Other numbers. Deleting a step also deletes the Jump to steps in other numbers that point at it.
Two writers. The ETag is a hash of the stored steps. A change to them moves it, such as a Dashboard save or deleting a group the flow uses; a change that returns them to your read, such as a restore, brings it back. On a 412, read the flow again, apply your change and retry. After a 500 on a call flow write, read the flow before you retry. Do not retry with the same If-Match: if a later edit returned the steps to the content of your read, the retry would overwrite that edit. A retried draft save may store a second draft.

Step types

List call flow step types gives the 18 step types the API writes, each with its fields as JSON Schema and whether your plan allows it.
  • Fax must be the only step of the flow.
  • After Voicemail, only HTTP Request, Mark Call as Resolved, Condition Splitter, Day/Time Splitter and Jump to may follow.
  • Jump to may loop back when the loop has a step that waits for the caller, such as an IVR menu or a ring step.
  • Day/Time Splitter times are in the account time zone. With no match and no otherwise, the call is hung up.

Limits

  • Size limits. A call flow has at most 200 steps and a body of at most 1 MiB (413 VALIDATION.INVALID_BODY). A step name takes up to 100 characters, a Collect Input pattern up to 255. An HTTP Request step takes a url up to 2,048 characters, up to 50 headers (name up to 256 characters, value up to 8,192) and up to 50 body fields (key up to 255 characters, value up to 8,192). A Condition Splitter takes up to 50 branches of up to 50 conditions, a Day/Time Splitter up to 50 branches. A step over 64 KB, or a field over its limit, is 422 VALIDATION.INVALID_FIELD at that step or field. The Dashboard does not enforce these limits.

Check a change before you save it

Validate a call flow runs every check of a save without saving, and answers 200 even when the document has errors:
  • errors lists what a save would refuse, including a stale If-Match as CALL_FLOWS.ETAG_MISMATCH.
  • warnings never stop a save. BUSINESS_HOURS_APPLY means business hours run before the flow.
  • changes previews the steps a save adds, updates and removes.
  • With VOICE_AGENT_CHECK_SKIPPED in warnings, voice agents were not checked, so a save may still answer 502.

Save a draft and publish it

Save with ?draft=true to keep a change for a person to approve. Calls keep using the live flow. The draft passes every check of a save, and the response is 201 with live: false and the draft’s versionId.
If-Match is optional for a draft. Send the ETag of your read and keep it for the publish: the draft’s own etag is the live flow’s, which may be newer. Publish a call flow draft by the draft’s versionId, with the ETag of your read. Avoid latest-draft: it names the newest draft when the request arrives, which may not be the approved one.
A draft never overwrites a later save. When the live flow’s steps differ from the steps the draft was saved on, publishing is 412 whatever ETag you send: read the live flow, save the draft again on it, and publish the new draft. A number keeps up to 10 drafts, oldest dropped first. A draft over 15 MiB is refused with 422. Publishing a version that is not a draft is 409 CALL_FLOWS.NOT_A_DRAFT.

Undo a change

Restore a call flow version makes a version live again, with the checks of a save:
List call flow versions shows who changed the flow (actor), from where (source) and why (note). Besides an id, restore takes live, latest and latest-draft.
  • Every save keeps a version, from the Dashboard or the API. A number keeps its latest 50 versions and up to 10 drafts. The baseline is always kept: the flow as it was before versions were introduced.
  • When a number is released, its versions are deleted with it. A number whose flow you delete keeps its versions.
  • A save whose version would be over 15 MiB keeps no version. Deleting a user or group in the Dashboard, a plan downgrade and a new number’s default step write none either.
Steps the live flow still has, with the same type, keep their id; the others come back as new steps. Jump to steps that a change deleted in other numbers do not come back (warning JUMP_TO_NOT_RESTORED). Header values. Versions keep HTTP Request header values only for a while. Drafts always keep them. Any other version keeps them while it is one of the number’s 5 newest versions (drafts not counted) or less than 7 days old; after that, the next save of the flow removes them. A restore fills a missing value from the live step with the same id and header name. When the live flow has none, the restore is 422 CALL_FLOWS.HEADER_VALUE_REQUIRED and changes nothing: read the version, set those header values in its steps, and save it with Replace a number’s call flow. A step the live flow no longer has goes without its id, as a new step.

Delete a number’s call flow

Delete a number’s call flow removes every step (send If-Match). From the next call, calls to the number are hung up straight away; business hours still apply. Jump to steps in other numbers that pointed into the flow are deleted. The number keeps its versions, so a restore undoes the deletion.

Set business hours

Outside business hours, a call gets the closed action instead of the call flow. A flow’s businessHours shows whether hours apply and whose.
  • Times are HH:mm in the account time zone. A special date overrides the weekday and holidays: closed all day, or open from from to to. holidaysClosed closes on the public holidays of the number’s country (List public holidays).
  • closedAction is redirect, voicemail, sound or soundThenVoicemail. A replace that sets hours, such as one with useOwnHours: true, needs one.
  • A replace takes up to 100 opening intervals and 1,000 special dates, and applies to the next call. Business hours keep no versions.
  • Hours never saved read with empty lists and closedAction: null, and are accepted back as they are.
  • A closed action whose soundId, voicemailBoxId or phoneNumber reads null is accepted back only with the hours off (enabled: false or useOwnHours: false) and with openingHours, specialDates, holidaysClosed and closedAction as a read returns them now. The hours then switch off and the stored closed action is kept. Otherwise the null is 422 VALIDATION.INVALID_FIELD.

Redirect all calls in an emergency

  1. Read the number’s hours with Get a number’s business hours and keep the object: it is your way back.
  2. Replace them as in the example above: today as a special date with closedAllDay: true, and a redirect closed action.
  3. When it is over, send the object you kept, as it is, even for hours never saved (useOwnHours: false, closedAction: null). If the kept closedAction has soundId, voicemailBoxId or phoneNumber null, set a value in it first: your emergency change replaced the stored hours, and with useOwnHours: true a save always needs a value.

Add a sound

Steps and closed actions play sounds. Create a sound from text, with a voice from List text-to-speech voices, or from an MP3 file up to 8 MB:
A new sound has status: processing, then turns ready, or failed when it cannot be converted: check status with Get a sound. A flow may use it at once (validate warns SOUND_PROCESSING). Its audioUrl expires after about 5 minutes. A retry with the same Idempotency-Key and body returns the first answer for 24 hours. List voicemail boxes gives the voicemailBoxId values.

Errors

  • An unknown number id is 404 CALL_FLOWS.NUMBER_NOT_FOUND (BUSINESS_HOURS.NUMBER_NOT_FOUND on business hours).
  • 403 means your plan lacks a feature: BUSINESS_HOURS.NOT_IN_PLAN, BUSINESS_HOURS.VOICEMAIL_NOT_IN_PLAN (a voicemail closed action on a plan without human agents), SOUNDS.NOT_IN_PLAN, CALL_FLOWS.STEP_TYPE_NOT_IN_PLAN.
  • The call flow operations answer 403 FORBIDDEN when your account is not active, and 409 CALL_FLOWS.NUMBER_NOT_READY when the number has no routing record: contact support.
  • List voicemail boxes answers 504 TIMEOUT after 30 seconds. Retry.
  • When you contact support, quote requestId, which is the request’s X-Request-ID.
Error codes covers the error shape, 401, 429 and 500.