Admin

API: Create Account

Create a new hosting account via the Opterius Panel API.

Last updated 1775606400

Creates a new hosting account on the server. The Panel provisions the Nginx vhost, PHP-FPM pool, home directory, DNS zone, and mail configuration automatically.

Endpoint:

POST /api/v1/accounts

Authentication: Bearer token — see API Authentication Overview.

Request Body

{
  "username": "alice",
  "domain": "alice.example.com",
  "email": "alice@example.com",
  "password": "s3cur3p@ss",
  "package_id": 1
}
Field Type Required Notes
username string Yes Lowercase alphanumeric, 3–32 characters. Becomes the Linux system user.
domain string Yes The account's primary domain. Must be a valid FQDN.
email string Yes Contact email for the account owner.
password string Yes Minimum 8 characters. Used for the account's control panel login.
package_id integer Yes ID of the hosting package to assign. Retrieve package IDs from GET /api/v1/packages.

Response

201 Created:

{
  "data": {
    "id": 42,
    "username": "alice",
    "domain": "alice.example.com",
    "email": "alice@example.com",
    "status": "active",
    "package_id": 1,
    "created_at": "2026-04-08T14:32:00Z"
  }
}

Error Codes

Status Error Cause
422 validation_failed One or more required fields missing or invalid
409 conflict Username or domain is already in use on this server
403 license_required License is invalid or expired — see License Invalid
403 account_limit_reached Account count has hit the plan limit (Free: 5 accounts)

curl Example

curl -sk -X POST \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "alice",
    "domain": "alice.example.com",
    "email": "alice@example.com",
    "password": "s3cur3p@ss",
    "package_id": 1
  }' \
  https://SERVER_IP:8443/api/v1/accounts

Notes

Account creation is synchronous from the API's perspective — the 201 response is returned only after all provisioning steps complete. Typical provisioning time is under 5 seconds. If the Agent is unreachable during provisioning, the request returns 503. Check Agent Unreachable if this happens.

The username becomes the Linux system user on the server. It cannot be changed after creation.

WHMCS Integration

When using the Opterius WHMCS module, this endpoint is called automatically on Create and Active order events. You do not need to call it manually. See the WHMCS module documentation for setup instructions.

Related