Find the answers you need

Support Database

How do I provision a mailbox via the API?

POST  /package/{id}/email/{id}

This endpoint permits the creation of mail objects, for example, mailboxes, and email forwarders.

The example below details an example payload for the creation of a mailbox.

PHP examples use our API wrapper, which can be downloaded here:



require_once “vendor/autoload.php”;
$bearer_token = “INSERT API KEY”; //Your 20i API key.
$services_api = new \TwentyI\API\Services($bearer_token);
$packageId = “32025”; //The ID of the 20i package you wish to provision a mail object to.
$domain = “”; //The intended domain.
$prefix = “info”; //The prefix for the mailbox/mail object.
$password = “Password123”; //In this example, this is the password you wish to set for the mailbox.
$newMailbox = [“new” => [“mailbox” => [“local” => $prefix, “send” => “true”, “receive” => “true”, “password” => $password ] ] ];
$response = json_encode($services_api->postWithFields(”/package/$packageId/email/$domain”, $newMailbox), JSON_PRETTY_PRINT);


    "result": {
        "result": [
                "type": "mailbox",
                "id": "info",
                "generatedId": null,
                "password": "Password123"
        "name": ""

The response indicates that a mailbox object has been created with the details we specified in our payload. The mailbox can then be accessed as usual via the 20i control panel.