How to Use the cPanel API

cPanel provides a powerful API that allows you to programmatically manage your hosting account - creating email accounts, managing databases, querying account info, and much more. dotCanada's cPanel supports both UAPI (the modern API) and the older cPanel API 2.

Generating an API Token

  1. Log in to cPanel.
  2. Go to Security > Manage API Tokens.
  3. Click Create, give your token a name, and optionally set an expiry.
  4. Copy the token - you won't be able to see it again.

Making API Requests

You can call the cPanel API using curl or any HTTP client. Here's an example using UAPI to list email accounts:

curl -H 'Authorization: cpanel username:API_TOKEN' 'https://yourdomain.com:2083/execute/Email/list_pops'

Replace username with your cPanel username, API_TOKEN with your token, and yourdomain.com with your domain.

Common UAPI Modules

  • Email - Manage email accounts, forwarders, autoresponders
  • Mysql - Create and manage databases and users
  • Fileman - File management operations
  • DomainInfo - Query domain and DNS information
  • SSL - Manage SSL certificates

Response Format

All UAPI responses are returned in JSON format, making them easy to parse in any language including PHP, Python, and Node.js.

If you need help building scripts using the cPanel API on your dotCanada account, contact our support team and we'll be glad to assist.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today