Skip to content

Check a configuration file (pbx)

post /configuration-import/validate

Check a PBX configuration file (kind external) against the published rules and the PBX of your API key, without storing anything. The checks that look at this PBX's own data run (for example an email address one of its users already has). Checks against other PBXs (an email address, an alternative SIP username or a phone number used elsewhere) do not run here and no answer ever tells anything about another PBX: they run in Cockpit, when a person reviews the imported version.

Send multipart/form-data with the file as file: a .zip (the file configuration.json and a files/ folder with sound files) or a plain .json. Fix every error in the answer and send it again until it is valid.

Needs the configuration-import scope. Rate limit: 6 checks per minute per PBX. One file of a PBX is checked at a time (409 while another is). A plain .json upload may be at most 5 MB; inside a zip, configuration.json may be at most 16 MB. Answers 503 while configuration versions are switched off.

HTTP: IntegrationApiKey

API key created on the Cockpit Integrations page (an "API key" integration). It is a bearer token owned by the customer's PBX and limited to the scopes selected when the key was created (e.g. phone-numbers, push-configuration).

Send it in the Authorization header:

Authorization: Bearer <api_key>

Manage keys (create / reveal / revoke) from Integrations → New integration → API key.

HTTP Authorization Scheme
bearer
accept header · string
example: application/json

Request body · required · multipart/form-data

Request schema
file*file
The configuration file: a `.zip` of at most 50 MB, or a plain `.json` of at most 5 MB (send a zip above that).

Responses

The file is valid. Sending it will not be refused by the rules.
Response schema
valid*boolean
example: 1
countsobject
Records in the file per entity name (only when valid).
Free-form object
notes*array<object>
The file's own notes about what could not be brought over.
codestring
example: example.skipped
levelstring
enum: info warning
example: info
textstring
example: One unsupported feature was left out.
subjectstring | null
errors*array<object>
Every rule the file breaks (at most 1000). `code` is listed in `x-cockpit-error-codes` of the rule set; `file.invalid` means the file could not be read at all.
codestring
example: row.pbx_id
messagestring
example: The PBX id must be "00000000-0000-4000-8000-000000000001".
modelstring | null
Entity name of the record kind.
example: extension
model_labelstring | null
example: Extension
rowstring | null
The record's id in the file.
example: 00000000-0000-4000-8000-000000000010
columnstring | null
example: pbx_id
Unauthenticated. The `Authorization: Bearer <token>` header was missing, malformed, or names a token that has been revoked or deleted.
Response schema
messagestring
Forbidden. The bearer token authenticated successfully but does not carry the scope this endpoint requires. Re-create the Integrations API key with the missing scope selected (Integrations > New integration > API key). On a write with a user bearer token, the user lacks the Cockpit permission the same change needs (the message names it).
Response schema
messagestring
Conflict. Another file of this PBX is being checked right now. Nothing was checked or stored. Retry when it has finished.
Response schema
messagestring
Payload Too Large. The file is over the size limit (50 MB). Nothing was checked or stored.
Response schema
messagestring
Unprocessable. Either the request is malformed (no `file`, a wrong extension, an unreadable file, one over the JSON limit of 16 MB: the usual `message` and `errors` of the API), or the file breaks the rules: `valid` is false and `errors` lists every broken rule. Nothing was stored.
Response schema
oneOf
valid*boolean
example: 1
countsobject
Records in the file per entity name (only when valid).
Free-form object
notes*array<object>
The file's own notes about what could not be brought over.
codestring
example: example.skipped
levelstring
enum: info warning
example: info
textstring
example: One unsupported feature was left out.
subjectstring | null
errors*array<object>
Every rule the file breaks (at most 1000). `code` is listed in `x-cockpit-error-codes` of the rule set; `file.invalid` means the file could not be read at all.
codestring
example: row.pbx_id
messagestring
example: The PBX id must be "00000000-0000-4000-8000-000000000001".
modelstring | null
Entity name of the record kind.
example: extension
model_labelstring | null
example: Extension
rowstring | null
The record's id in the file.
example: 00000000-0000-4000-8000-000000000010
columnstring | null
example: pbx_id
messagestring
errorsobject
Free-form object
Too Many Requests. The rate limit for this action has been exceeded. Retry after the window indicated by the Retry-After header.
Response schema
messagestring
Service Unavailable. Configuration versions are switched off on this installation, so configuration import is not available. Nothing was read or stored.
Response schema
messagestring
post https://cockpit.voxbi.com/api/v1/configuration-import/validate
Base URL
Request sample
curl -X POST 'https://cockpit.voxbi.com/api/v1/configuration-import/validate' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -F 'file=@/path/to/file'
const body = new FormData();
body.append('file', fileInput.files[0]); // /path/to/file

const response = await fetch('https://cockpit.voxbi.com/api/v1/configuration-import/validate', {
  method: 'POST',
  headers: { Authorization: `Bearer ${YOUR_TOKEN}` },
  body,
});

const data = await response.json();
console.log(data);
import requests

response = requests.post(
    'https://cockpit.voxbi.com/api/v1/configuration-import/validate',
    headers={'Authorization': f'Bearer {YOUR_TOKEN}'},
    files={
        'file': open('/path/to/file', 'rb'),
    },
)
response.raise_for_status()
data = response.json()
print(data)
<?php
$ch = curl_init('https://cockpit.voxbi.com/api/v1/configuration-import/validate');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN']);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'file' => new CURLFile('/path/to/file'),
]);

$data = json_decode(curl_exec($ch), true);
print_r($data);
Sample request · multipart/form-data
{ … }
"file": "/path/to/file"
}
{ … }
"valid": true,
"errors": [],
"counts": { … },
"extension": 12,
"group": 2
},
"notes": [ … ]
{ … }
"code": "example.skipped",
"level": "info",
"text": "One unsupported feature was left out.",
"subject": null
}
]
}
{ … }
"message": "Unauthenticated."
}
Content-Type string
example: application/json
{ … }
"message": "Invalid ability provided."
}
Content-Type string
example: application/json
{ … }
"message": "Another file of this PBX is being checked. Try again when it has finished."
}
{ … }
"message": "The file is too large. The limit is 50 MB."
}
{ … }
"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": []
}
{ … }
"message": "Too Many Attempts."
}
Retry-After integer
Seconds to wait before retrying.
example: 60
Content-Type string
example: application/json
{ … }
"message": "Configuration import is not available on this system: configuration versions are switched off."
}