Skip to content
Voxbi Cockpit APIs
API Guides

Configuration import for developers and AI agents

A configuration import moves a customer from another telephone system to Cockpit with one file. You convert the other system's data into a PBX configuration file, check the file through the API, and send it. Cockpit stores it as a new configuration version of the PBX. The PBX does not change at that point: the customer's administrator reviews the version in Cockpit and applies it there, as described in Move a PBX from another provider.

This page is for whoever writes the converter: a developer, an integrator, or an AI agent. Everything Cockpit expects is published in one machine-readable document, the rules. This page explains how to read it and how to work with the API around it.

What you need

  • An API key with the scope Configuration import. The customer's administrator creates it in Cockpit and gives it to you; only a person allowed to write configuration versions can add this scope to a key. The key belongs to one PBX, and every request you make with it is about that PBX. It gives no access to any other data.
  • The address of the API, for example https://cockpit.voxbi.com/api/v1.
  • The other system's data, in whatever form you can read it.

Send the key on every request in the header Authorization: Bearer <key>, together with Accept: application/json. A user's own login token is refused.

The steps

The examples use curl, with the key in the variable KEY and the address in API:

export API=https://cockpit.voxbi.com/api/v1
export KEY=paste-the-api-key-here

1. Read the rules

GET /configuration-import/rules

curl -sS "$API/configuration-import/rules" \
  -H "Authorization: Bearer $KEY" -H "Accept: application/json" -o rules.json

The answer is a JSON Schema that describes every kind of record a file may hold, every column of each kind and the values it accepts. It also lists the rules a schema cannot express, and every error code with its meaning. Its description explains how to read it. Reading the rules below explains each part.

2. Download the example

GET /configuration-import/example

curl -sS "$API/configuration-import/example" \
  -H "Authorization: Bearer $KEY" -o example.zip

The example is a complete file with at least one record of every kind, and it always passes the current rules. Use it as a model for your own file, and send it to the check in step 4 to test your requests.

3. Build your file

Convert the other system's data as described in The file and Records. Write what you could not bring over into notes, so the administrator knows.

4. Check the file

POST /configuration-import/validate

curl -sS -X POST "$API/configuration-import/validate" \
  -H "Authorization: Bearer $KEY" -H "Accept: application/json" \
  -F "file=@configuration.zip"

The check stores nothing. It answers 200 with "valid": true when the file passes, or 422 with every error at once, so you can fix them all before you check again. See Fixing errors.

5. Send the file

POST /configuration-imports

curl -sS -X POST "$API/configuration-imports" \
  -H "Authorization: Bearer $KEY" -H "Accept: application/json" \
  -F "file=@configuration.zip"

Cockpit checks the file again and, when it is valid, answers 202 with the id of the import.

6. Follow the import

GET /configuration-imports/{id}

curl -sS "$API/configuration-imports/<id>" \
  -H "Authorization: Bearer $KEY" -H "Accept: application/json"

Ask every few seconds. The status moves from queued to processing, then to ready, or to failed, in which case errors holds the reasons. When the status is ready, links.version holds the link to the new version in Cockpit.

7. Hand over

Give the link from links.version to the customer's administrator. Your part ends here: the API cannot apply a version. The administrator reviews it, settles conflicts with other PBXs and applies it. The import then shows the status restored.

Sending the file from Postman

Both the check and the import expect the file as a multipart form upload in the field file. In Postman, open Body, choose form-data, add the key file, switch its type from Text to File, and pick your .zip or .json. Add the headers Authorization: Bearer <key> and Accept: application/json.

Send a .json file of up to 5 MB when the configuration has no sound files. Send a .zip file when it has sound files or is larger.

The file

A PBX configuration file is one JSON document with these keys, and no others:

Key What it holds
format Always cockpit-pbx-config.
version Always 2.
schema_version 1.
kind Always external.
rules The version of the rules you followed: a whole number from 1 up to the version the rules state under x-cockpit-rules-version.
pbx_id A new UUID you choose for the PBX in the file. Every record that has a pbx_id column repeats it there. The PBX's own settings are one record of kind pbx, keyed by this pbx_id: that record has no pbx_id column, and leave its id out too (a repeated id must equal the key). The file holds no time zone of the PBX. It must not be the identifier of any PBX in Cockpit: the check refuses the identifier of the PBX your key belongs to, and the administrator cannot apply a file whose identifier another PBX has.
source The other system (system), the time of its export (exported_at), and your converter with its version (converter).
snapshot The name the version gets in Cockpit, from 1 to 255 characters, and an optional description.
files The sound files of the zip. An empty object when there are none.
notes What you could not bring over. Each note has a code of your choice, a level (info or warning), a sentence (text), and the identifier of the record it is about (subject), or null.
data The records, grouped by kind.

A file never has a signature.

Records

The records in data are grouped by kind, under names such as user, extension or call_flow_step. The rules list every allowed name, and any other name is an error. Within a group, each record is keyed by its identifier.

"data": {
  "group": {
    "6e9d0000-0000-4000-8000-000000000130": {
      "pbx_id": "6e9d0000-0000-4000-8000-000000000001",
      "name": "Sales",
      "description": "Sales team"
    }
  },
  "group_user": {
    "6e9d0000-0000-4000-8000-000000000130|6e9d0000-0000-4000-8000-000000000100": {
      "group_id": "6e9d0000-0000-4000-8000-000000000130",
      "user_id": "6e9d0000-0000-4000-8000-000000000100"
    }
  }
}

The group Sales has the identifier ending in 0130, and the user ending in 0100 (defined under user, not shown here) is one of its members. The link's key joins both identifiers.

  • Identifiers. Every identifier is a new lowercase UUID that appears nowhere else in the file. Use it wherever another record refers to this one. Leave the id column out of the record itself (except for the links described below): the key already is the identifier, and a repeated id must equal it. The identifiers only connect the records of your file; Cockpit gives the records its own identifiers in the PBX.
  • References. A reference always points at a record in the same file. There are two exceptions. Music on hold may point at one of the installation's own music files: send null to use the default music. A column that points at a table of the installation, such as the country of a location, takes that table's identifier: leave it null when the column allows it. Ask Mixvoip support for any such identifier you need.
  • Links between records. A link, such as a user's membership of a group, has no identifier of its own, unless the rules list id under required for its kind (route_outgoing_call_target does): then id is a UUID of its own. Either way its key is the identifiers of the linked records, joined by a vertical bar in the order the rules give under x-cockpit-key for that kind, for example <group id>|<user id>.
  • Records of several kinds. When a column can point at records of different kinds, a type column next to it names the kind, such as user or group.
  • Values. Write values the way Cockpit stores them. Booleans are true or false, dates are YYYY-MM-DD, times are HH:MM:SS, and points in time are YYYY-MM-DD HH:MM:SS. A column that holds structured data takes a JSON object or list, never JSON written as text. Two exceptions are accepted as text: the days_of_the_week below, and reserved_extensions of the pbx record, which is a JSON list written as text, for example "[\"112\",\"113\"]" (each number a text of 1 to 16 digits only). Inside a structured column, follow the rules for that column exactly: they describe its form. The days_of_the_week in the data of a schedule step is an object of the seven weekdays; Cockpit also accepts the same object written as JSON text and stores it the way the app does. The example shows each of them. Times of a schedule step are HH:MM:SS with the seconds 00, the start before the end (both 00:00:00 means the whole day). Texts. A text must not contain ${, $[ or a control character such as a line break, in any column and inside any structured column: the telephony platform reads names, labels, prefixes and messages as commands, so the check refuses them (column.unsafe_text). Only the columns description, comment, notes, reason, custom_provisioning and message may hold line breaks and tabs; ${ and $[ are refused there too.
  • Names. Write names as the other system holds them. Cockpit puts last names in capitals itself when the PBX is set to do so.
  • Users without an email address. Send null. Cockpit gives the user a placeholder address, and the administrator replaces it in Finish setup.
  • Columns. A column the rules do not list for a kind is refused. A file never carries passwords, PINs, tokens or SIP user names. Cockpit creates passwords, PINs and tokens itself, and the SIP user names of the phones it provisions; for manually provisioned phones, Gigaset phones and trunks, the administrator sets the SIP user name in Cockpit after applying. Every column the rules list under required must be present. A column you leave out takes Cockpit's default when the rules mark it with x-cockpit-has-default, and is empty otherwise.

How calls move through flows

Know this before you map the source's routing to call flows:

  • A flow that runs out of steps ends the call. There is no automatic voicemail and no default flow after it. End a flow on purpose: a send_to_email step for a message box, or another call_flow step.
  • A jump returns. A call_flow step runs the target flow; when the target ends without an answer, the next step of the calling flow runs. With a schedule on the step that matched, the calling flow ends after the target instead. A jump to an extension runs that extension's flow for the call type (internal or external) and never rings its user by itself. A disabled flow still runs from an extension, number, IVR key, queue exit or prefix route; only a jump checks it.
  • The default chain runs only when an extension has no call flow for the call type: the default flow of the user's first group, then the number's default (external calls only), then the PBX's default, then ringing the user for the PBX's default_call_ring_duration. A null call flow id on an extension, group or PBX means the chain goes on.
  • Numbers. A phone number with the default strategy runs the dialed extension's own call flow; default_callflow_id is only a fallback. The user and sip_device strategies ring for the PBX ring duration and then hang up.
  • Queues. enter_queue duration is the total wait; afterwards the next step runs. The queue's call_flow_id is used only for the exit key. A queue with a higher weight gets its callers served first, and with ring_empty off callers do not wait when nobody can take calls.
  • IVR menus. The caller has about 6 seconds to press one key. A wrong key runs the default step when there is one. With no key, default_action repeat plays the menu up to 5 times and then runs the default step or ends; default_step runs the default step; hangup ends. When the IVR ends, the call ends. A step's language switches the call's language from that key on.
  • Forwards and do-not-disturb. Forwards are checked before do-not-disturb, and at most 5 forwards chain. A forward's caller_identity_id is a filter (calls that arrived on that number), not the number shown. Calls are filtered by type and number only for users with 2 or more caller identities, or when the PBX splits internal and external calls; otherwise every forward applies to every call, and an internal do-not-disturb blocks all calls while an external one does nothing. Only an internal do-not-disturb triggers on_dnd forwards.

Sound files and the zip

Sound files travel inside a zip:

  1. Store each audio file in the zip as files/<hash>.<extension>, where the hash is the SHA-256 hash of the file's bytes, in lowercase hexadecimal.
  2. List it in files as "<hash>": {"size": <bytes>, "ext": "<extension>"}.
  3. Write file:sha256:<hash> in the audio_data column of the sound file record.

Cockpit accepts mp3, wav, flac, aac and ogg files of up to 20 MB each, and converts every format other than mp3.

Every sound file needs audio, also one that the source holds as text to be spoken (source ai_generated): the import generates no audio from the message. When the source has no audio for a prompt, ask the customer for it. When there is none, leave out the sound file and everything that needs it, such as the IVR menu that plays it, and write a warning note that describes what is missing, for example the keys of the menu and where each one went, so that someone can rebuild it by hand.

The zip holds configuration.json and the files folder and nothing else, not even entries for the folders themselves. Build it like this:

zip -D -X configuration.zip configuration.json files/*

The option -D leaves out the folder entries. A zip made with the Compress command of the macOS Finder adds them, so it is refused.

What the records mean

The rules say what a file may hold, not what each record does on a PBX. For that, read the handbook pages of the telephony module, such as Call flows, Schedules, Users and Phones. The example shows typical values for every kind.

  • Step options. The options of a call flow step hold exactly the keys of its step type. The rules list them under $defs.call_flow_step.x-cockpit-options, for each step type a file may hold, with the kind of value of every key, whether it must be present, whether it needs a value and what it points at. The check names every key that is missing or not allowed.
  • Step types. Only the step types in the enum of $defs.call_flow_step.properties.type are allowed. The AI assistant step and the retired types are not. The only working voicemail is the step send_to_email (called Voicemail in the app). Put it after the ring step. It answers, plays its sound file and a beep, records up to 20 minutes (it ends after 10 seconds of silence) and emails the recording to the address in email, the selected users and, with email_to_called_user, the user of the dialed extension. An address ending in .voxbi.com is a placeholder and gets nothing. Then the next step runs. The user's voicemail_type, voicemail_destination and voicemail_pin, and a forward with the target voicemail, have no effect on the telephony platform yet.
  • Schedules in call flows. A call flow step of type call_flow with a schedule runs only while the schedule matches. Outside the schedule's hours the step is skipped and the next step runs. A schedule matches while one of its enabled steps matches, and a step with the status disabled is ignored.
  • Schedules and time. The times of a schedule step have no time zone. The telephony platform evaluates them in the local time of its server (Europe/Luxembourg by default), and a PBX has no time zone of its own. Convert the source's times to that time, and add a note when the source uses another time zone. The end minute is included, 00:00 to 00:00 is the whole day, and a window that runs past midnight needs two steps.
  • Settings with no effect yet. Some settings are stored and shown in Cockpit but the telephony platform does nothing with them yet: the user's voicemail_type, voicemail_destination, voicemail_pin and vip; the forward target voicemail and the forward event timeout (use after_ten_seconds for no answer); the extension's record_internal_calls and record_external_calls (the user's recording setting applies); the group's allow_call_pickups; the PBX's emergency, allow_roaming, max_incoming_channels and its sound file; phone number assignations (only caller identities decide which numbers can be presented); and the phone's allow_default_pbxes_outgoing_phone_numbers and extension_id_shown_for_internal_calls. Fill them from the source if you like, but do not promise the customer that they work. A VIP contact, not a VIP user, is what skips forwards and do-not-disturb.
  • Features of the PBX. A few rules depend on what the customer's PBX has, such as voicemail or the language variants of sound files. The rules you read with your key carry the on or off flags under x-cockpit-pbx-features, and nothing else about the PBX. The check applies the same rules. When a feature is off, leave the columns it governs at their defaults, or ask the administrator.

Reading the rules

The rules document is a JSON Schema (draft 2020-12) with extensions whose names start with x-cockpit-. A JSON Schema validator checks the shape of your file against it; the extensions carry what a schema cannot express. Read it in this order:

Part What it tells you
x-cockpit-rules-version The current version of the rules. Write it in your file's rules.
properties, required The keys of the file itself, as in The file.
x-cockpit-entities Every kind of record a file may hold, with a readable name.
properties.data.properties.<kind> How the records of one kind are keyed: by a UUID, or, for a link, by the columns under x-cockpit-key, joined by its separator.
$defs.<kind> The columns of one kind. properties gives each column's type, pattern, allowed values (enum), length or range, and, for a column whose meaning is not obvious, a description that says what it means and what each value does. required lists the columns a record must have. x-cockpit-table names the table in Cockpit.
x-cockpit-options (on call_flow_step) For each step type a file may hold: ends_call (no step may follow it) and the keys of options. Each key has its type; key (required, optional, or required_when another option has a value, named in required_when); value_required (false means null is allowed); references (the kind of record it points at); values (the allowed values); value_needs (which other key needs a value for each value); max_length; format; must_be_empty; and sometimes a description.
x-cockpit-options (on user_forward) The keys of target_options for each forward target.
x-cockpit-pbx-features Only in the rules you read with an API key. On or off flags for the PBX behind the key: voicemail, language_variants and call_recording. The rules that depend on them are in x-cockpit-rules. The published copy in the repository leaves it out.
x-cockpit-has-default (on a column) You may leave the column out, and Cockpit uses its default.
x-cockpit-max-bytes (on a column) The longest value in bytes, for text that has a limit in bytes rather than characters.
x-cockpit-unique (on a kind) Groups of columns whose values must be unique together within the file, ignoring case. A record where one of them is empty is not checked.
x-cockpit-references For each kind, the columns that point at other records. kind says how: fk points at one kind; morph points at the kind named in the type_column; json points from a path inside a JSON column; global points at a table of the installation; model_or_global_music and json_or_global_music point at a sound file of the file or at one of the installation's music files.
x-cockpit-match How a record of the file is matched with one the PBX already has: through names another kind and the column of it that points at this kind, so the record is matched through that record (a user through its extension); then the columns that must be equal; fallbacks, other groups of columns to try when those find nothing; fallbacks_only_when_empty, a column that stops the fallbacks when the file row has a value in it; and singleton for a kind the PBX has only once, such as its settings. A matched record is updated, an unmatched one is created.
x-cockpit-rules The rules a schema cannot express, each with its code, the kinds it applies to (models) and a sentence (description). Read them for every kind you send.
x-cockpit-error-codes Every error code the check can answer, with its meaning.

Fixing errors

A file that breaks a rule is answered with 422 and a list of up to 1,000 errors:

{
  "valid": false,
  "errors": [
    {
      "code": "row.pbx_id",
      "message": "The PBX id must be \"00000000-0000-4000-8000-000000000001\".",
      "model": "extension",
      "model_label": "Extension",
      "row": "00000000-0000-4000-8000-000000000010",
      "column": "pbx_id"
    }
  ],
  "notes": []
}

Each error names the code, a sentence that explains it, the kind of record (model), the identifier of the record in your file (row) and the column. Look the code up under x-cockpit-error-codes when the sentence is not enough. Fix every error, check again, and repeat until the answer is valid.

A 422 without valid means the request itself is wrong, for example a missing file field or a file that is not a .json or .zip. Its message says what to change.

What a restore does

The file decides the result for each kind of record it holds:

  • For every kind the file holds, the PBX ends up as the file describes. Records that match an existing one are updated, new records are created, and the records of the PBX that the file does not contain are deleted. Records that Cockpit normally keeps in a trash are moved to the trash.
  • A kind the file does not hold is not touched. To add to a PBX that is already in use, send only the kinds you mean to replace. To rebuild a PBX from a full export, send every kind you have.
  • Users, locations, phone numbers, multicast groups and parent devices such as base stations (kind parent_sip_device) are never deleted, even when the file leaves them out.
  • Records that belong to another record follow it. When the file holds a call flow, its steps become exactly the steps in the file. The same applies to the steps of schedules and IVR menus, the members of queues and groups, phone keys, forwards, do-not-disturb rules and twinnings. A record that is not in the file keeps everything that belongs to it.
  • A user is matched through an extension of the file that matches one of the PBX's extensions, otherwise by email address, and by first and last name only when the file gives no email address. A user synced from a directory keeps the name, email address and status the directory gives it, and an extension held by an AI assistant cannot be in the file. A matched user keeps their email address, and a matched group keeps its link to a directory. They take everything else from the file.
  • A kind with no entry under x-cockpit-match is never matched: the file's records of that kind are created, and the PBX's records of that kind are deleted. A phone (sip_device) is matched by its mac: a phone of the file whose MAC address the PBX already has is that phone and keeps its SIP user name and password. Phones without a MAC address, such as manually provisioned ones, are created.

Conflicts with other PBXs

The API never looks at other PBXs and never tells you anything about them. When an email address, a phone number or an alternative SIP user name in your file is already used by another PBX, the administrator sees it in Cockpit and chooses a replacement value or leaves the record out. When a file has more than 25 such conflicts, the administrator is asked to contact Mixvoip support. When the file's pbx_id is the identifier of another PBX, the administrator cannot fix it and asks you for a new file with a new pbx_id.

Limits

  • An upload may be at most 50 MB. A .json file may be at most 5 MB. Inside a zip, configuration.json may be at most 16 MB and each sound file at most 20 MB. A file may hold at most 100,000 records.
  • A PBX can have at most 10 imported versions that wait for review. A version that nobody applies is removed after 30 days. Its import then shows the status removed.
  • Reading requests (the rules, the example, the list of imports and the status of one) are limited to 30 per minute for each PBX. Checking and sending a file share a limit of 6 per minute for each PBX. Above a limit, the answer is 429 with a Retry-After header.

Other answers

Status Meaning
401 The key is missing or not valid.
403 The key does not have the Configuration import scope, or it is a user's login token.
404 The import identifier does not belong to an import of your PBX.
409 Ten versions already wait for review, or another file of the same PBX is being checked at this moment. In the second case, try again shortly.
413 The upload is larger than 50 MB.
429 Too many requests. Wait for the number of seconds in Retry-After.
503 Configuration versions are switched off on this installation.

A brief for an AI agent

Copy this brief into your agent's instructions, together with the API address and the key. The agent learns everything else from the rules.

You convert a telephone system's configuration into a Cockpit PBX configuration file.

API: <the API address>, header "Authorization: Bearer <key>" and "Accept: application/json".

1. GET /configuration-import/rules. Read its "description" first, then the parts it names.
   Work kind by kind: $defs.<kind>, x-cockpit-references, x-cockpit-match and every rule
   in x-cockpit-rules that names the kind.
2. GET /configuration-import/example. Use it as the model for the file's shape.
3. Build configuration.json from the source data. Every record gets a new lowercase UUID,
   used only in this file. Put every audio file in files/<sha256>.<ext> and build the zip
   with "zip -D -X" so it has no folder entries.
4. POST the zip to /configuration-import/validate as the multipart field "file".
   Fix every error by its code, row and column, and check again until "valid" is true.
5. POST the zip to /configuration-imports, then GET /configuration-imports/<id> every few
   seconds until the status is "ready" or "failed".
6. Report links.version and every note to the person who asked you.

Never:
- invent a value for a required column: leave the record out and write a note instead;
- put passwords, PINs, tokens or SIP user names in the file;
- send the example file, or any test file, to a PBX in use.
On 429, wait for Retry-After. On 409, wait and try again, or report it.

Updated