Welcome to 20i Support

Web Hosting Knowledge Base

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: https://my.20i.com/reseller/api



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


    "result": {
        "result": [
                "type": "mailbox",
                "id": "info",
                "generatedId": null,
                "password": "Password123"
        "name": "20isupport.com"

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.