# PATCH /domains/{name}

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the domains group.

Update a domain's settings

- Who may call it: administrator, reseller, customer
- Token scope, any of: domains, all
- Answers: 200 OK

Supply at least one change. UrbeStack synchronizes the DNS zones it manages and returns the updated domain in the same format as GET /domains/{name}. An unknown domain returns 404. Access to an existing domain is limited to administrators, the domain owner and the owner's reseller. Other callers receive 403.

Use www_alias to control whether the site also answers to www.<domain>, and wildcard to control whether it also answers to *.<domain>. Set www_redirect to www or bare to redirect to that form of the domain name, or to none to disable the redirect. The directory_listing option controls whether visitors see a file list when there is no index page. Enable error_pages to serve errors/{403,404,500}.html from the document root. Use stats_enabled to control inclusion in nightly statistics.

Set ssl_mode to auto for automatic certificate issuance or none to disable it. Set challenge to http for HTTP-01 validation or dns for DNS-01 validation. With auto, UrbeStack uses HTTP-01 unless wildcard is enabled, in which case it uses DNS-01. Once a certificate is installed, force_https redirects visitors to HTTPS and hsts instructs browsers to keep using HTTPS. Set either field to false to disable that option.

Set php_version to an installed version available for new selections, such as 8.4, or to null to follow the server default. Administrators can hide versions from new selections. Version selection is unavailable while a PHP installation is running.

Administrators can set php_settings. Resellers can set them for their customers, except for settings reserved for administrators. Passing null or an empty string for a setting removes the override and restores the server default. Only administrators can set pm.max_children, pm.process_idle_timeout (in seconds), pm.max_requests and open_basedir_tmp. Set open_basedir_tmp to on to include the shared /tmp directory in the pool's open_basedir or to off to exclude it. It defaults to off for new domains.

The php.ini settings are memory_limit, upload_max_filesize, post_max_size, max_execution_time, max_input_vars, disable_functions, display_errors and date.timezone. For disable_functions, use a comma-separated list of function names or none.

The API returns 400 if the request supplies no changes, an unknown PHP setting name or an invalid value for www_redirect, ssl_mode or challenge. It returns 403 if the caller lacks permission to change a requested PHP setting.

## As a command

- [urbestack-domain-set](https://urbestack.com/docs/commands/urbestack-domain-set.md): Changes settings for an existing domain and synchronizes the DNS zones UrbeStack manages.

## Parameters

- `name` (path, DomainName, required)

## Request body

JSON, the type [DomainPatch](https://urbestack.com/docs/api/types/DomainPatch.md).

- `challenge` (string, one of auto, http, dns)
- `directory_listing` (boolean)
- `error_pages` (boolean)
- `force_https` (boolean)
- `hsts` (boolean)
- `php_settings` (object of string, up to 64 characters)
- `php_version` (string, matching ^[5-9]\.[0-9]$ or null)
- `ssl_mode` (string, one of none, auto): Certificate mode, either none or auto. Set the mode to custom by installing a custom certificate.
- `stats_enabled` (boolean)
- `wildcard` (boolean)
- `www_alias` (boolean)
- `www_redirect` (string, one of none, www, bare)

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PATCH "$API/domains/example.com" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "challenge": "auto",
    "directory_listing": true,
    "error_pages": true,
    "force_https": true,
    "hsts": true,
    "php_settings": {},
    "php_version": "8.4",
    "ssl_mode": "none",
    "stats_enabled": true,
    "wildcard": true,
    "www_alias": true,
    "www_redirect": "none"
  }'
```

Response, 200 OK:

```
{
  "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

- 400: --php-setting expects KEY=VALUE, got '<kv>'
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid PHP version, expected e.g. 8.2
- 400: Invalid domain name
- 400: Nothing to change
- 400: Unknown PHP setting '<k>'
- 400: Unknown PHP setting '<key>'; known: 
- 400: Unknown PHP setting '<raw>'
- 400: Unknown PHP version '<version>'
- 400: Unknown ssl key '<k>'
- 400: challenge must be auto, http or dns
- 400: ssl must be an object
- 400: ssl_mode must be none or auto; a custom certificate is put on with its own route
- 400: www_redirect must be none, www or bare
- 401: Authentication required
- 403: <k> is set by an administrator, on the PHP page
- 403: Insufficient privileges
- 403: PHP settings are set by an administrator, or by the reseller of the customer
- 404: Domain '<name>' not found
