Get your free beta license ↗
API operation · domains group
POST

/domains

First published 3 Oct 20260.1.0Unchanged since publication

Add a hosted domain

Who may call it
AdministratorResellerCustomer
Token scope, any of
domainsall
Answers201 Created

UrbeStack creates the document root, Apache virtual host and PHP-FPM pool, and updates DNS and mail configuration. The response contains the new domain in domain. The user field selects the owner and defaults to the signed-in user's account. The name must be unique among domains and aliases on this server.

To add a subdomain, set parent to a standalone domain owned by the same customer. The new name must be below the parent's name in DNS. Subdomains count toward the customer's package limit for domains and are deleted with their parent.

If you specify php_version, such as 8.4, select an installed version that is available for new domains. Wait for any PHP installation to finish before selecting a version. The Apache virtual host template defaults to default. Supplying a nonempty template as a reseller or customer returns 403.

Only administrators can use reserved names, the server's own names, names above or below the server's own names, or names in the server's own DNS zones. The same restriction applies to names above or below another account's domain or alias and names that overlap another server's zone in the DNS distribution network. If this server holds the name's zone for a DNS client, an administrator's request takes over the zone for the new domain and blocks further updates from that client.

When mail.unpointed_domains is set to refuse, the name must already point to this server unless the request specifies a parent or comes from an administrator.

As a command

Run as root on the server

Request body

JSON ·DomainCreate· 5 fields
nameDomainNameRequired
A domain name is case-insensitive and stored in lowercase.
A domain name is case-insensitive and stored in lowercase.
php_versionstring, matching ^[5-9]\.[0-9]$
templatestring, matching ^[a-z][a-z0-9-]{0,31}$
Name of the virtual host template used to render the site's configuration. The name must match ^[a-z][a-z0-9-]{0,31}$ and refer to an available template in UrbeStack's apache-vhost-<name>.tmpl files or the administrator's overrides. Only administrators can set this field. Requests from anyone else that supply it return 403.
A username consists of lowercase letters, digits and underscores. For the user role, it also serves as the system account name.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/domains" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "example.com",
    "parent": "example.com",
    "php_version": "8.4",
    "template": "default",
    "user": "alice"
  }'
Response · 201 Created
{
  "domain": {
    "bandwidth_cut": true,
    "created_at": "2026-09-09T10:15:00Z",
    "directory_listing": true,
    "docroot": "/home/alice/files/web/example.com/public_html",
    "error_pages": true,
    "id": 1,
    "move_state": "text",
    "name": "example.com",
    "package": "basic",
    "parent": "example.com",
    "php_effective": {},
    "php_settings": {},
    "php_version": "8.4",
    "ssl": {},
    "stats_enabled": true,
    "status": "active",
    "template": "default",
    "user": "alice",
    "user_id": 2,
    "wildcard": true,
    "www_alias": true,
    "www_redirect": "none"
  }
}

Errors

27 errors, each a status and a sentence
400<_> is set per domain, on the PHP page's Domains tab, never as a server default
400A subdomain belongs to the same user as its parent
400A subdomain cannot have a subdomain as its parent
400Domain name required
400Domain name too long
400Domains belong to users with role 'user'
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid PHP version, expected e.g. 8.2
400Invalid domain name
400Invalid port
400Invalid setting key
400Invalid status
400Invalid template name
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400PHP settings must be an object of setting: value
400Subdomain '<name>' does not sit under '<parent.name>'
400Unknown PHP version '<version>'
400Username '<value>' is reserved
401Authentication required
403The virtual host template is set by an administrator
404Parent domain '<parent>' not found
404Setting '<key>' not found
404User '<owner>' not found
409'<name>' is already an alias here
409Domain '<name>' already exists
409The package <p.name> allows <limit>
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/post-domains/