
If your application is in PHP, this SDK saves you from building requests by hand. It covers all 256 operations of our API, one method per operation: domains, DNS, SMS, E-mail Center, AI, billing, support, servers and the rest. It is generated from the OpenAPI specification, so it keeps up with the API.
What it does
It gives you a client, MozOut\Client, with one area per part of the API: domains, dns, sms, emailCenter, ai and the others. The API address is already in the SDK.
It also handles errors, retries and the Idempotency-Key, and checks webhook signatures.
What you need
PHP 7.4 or newer with the curl and json extensions. You install it with Composer; without Composer, require the autoload.php of the package.
And an API key, created in the API Center of My MozOut.
Installing, step by step
|
|
|
use MozOut\Client;
$client = new Client(); // or new Client(['api_key' => 'sandbox_...'])
echo $client->status->pingGet()['data']['status'];
If the request comes back without an error, the key and the SDK are working. Sending an SMS, for example, looks like this:
$client->sms->messagesCreate(['number' => '+14155550123', 'text' => 'Your order is ready.']);
| Complete examples are in the examples/ folder of the repository, and every operation is listed in OPERATIONS.md. |
The API key and its permissions
If the key lacks the permission for an operation, the API answers 403 insufficient_scope. Give the key only the permissions of the areas you use: see permissions by area.
Other common errors: 401 unauthorized (wrong or expired key), 402 insufficient_credit (not enough balance) and 429 rate_limited.
Testing without spending
Start with a sandbox_ key: it reads your real data, but writes are simulated and never charge. The X-API-Simulated header, in $client->lastResponse, tells you whether a write was simulated.
Good to know
Retries: on 429 and 5xx, the SDK waits and tries again, up to 2 times by default, and follows Retry-After. Where an operation accepts an Idempotency-Key, it creates one itself, so a request is never done twice.
Webhooks: \MozOut\Webhook::verify checks the signature in the X-Webhook-Signature header.
Help
If the API returns an error you do not understand, open a support ticket and send us the correlation_id from the exception, never the key. The code is in the PHP SDK repository, under the MIT license.
|
Ready to call the API from PHP? Download the latest release |
|
SEE ALSO |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from R118.80/mo (3-year plan, with coupon) See plans |











