add_subdomain()

Create a subdomain.

Signature

add_subdomain(array $parameters): mixed

Parameters

Pass these parameters as KasRequestParams. Every request also requires kas_login, kas_auth_type, and kas_auth_data, as shown in SOAP with PHP.

Name Description Requirement
subdomain_name Label of the subdomain Required
domain_name The domain the subdomain label is added to Required
subdomain_path The host path in the account, or for a redirect an FQDN or a website builder (optional, examples: /path/, http://example.com with redirect_status, or wbk:wbk000001) Optional
redirect_status Redirect status: 0|301|302|307, 0 = no redirect Optional Default: 0
statistic_version Deprecated since 2026-10-06, ignored Deprecated
statistic_language Deprecated since 2026-10-06, ignored Deprecated
php_version The requested PHP version: 5.X|7.X Optional Default: 7.1
temporary_until Expiration date of the transitional domain as YYYYMMDD; 0 = no expiration Optional Default: 0

PHP example

<?php

// $sessionToken is returned by KasAuth, see SOAP with PHP.
$parameters = [
    'subdomain_name' => 'test-sub',
    'domain_name' => 'example.com',
    'subdomain_path' => 'subdomain-path',
    'redirect_status' => '0',
];

try {
    $client = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
    $response = $client->KasApi(json_encode([
        'kas_login' => 'w0123456',
        'kas_auth_type' => 'session',
        'kas_auth_data' => $sessionToken,
        'kas_action' => 'add_subdomain',
        'KasRequestParams' => $parameters,
    ]));
    print_r($response);
} catch (SoapFault $fault) {
    echo 'Error: ' . $fault->faultstring;
}

Responses and error codes

  • TRUE the action was carried out
  • missing_parameter a required parameter is missing
  • account_is_dummyaccount
  • domain_for_this_subdomain_doesnt_exist
  • domain_syntax_incorrect
  • max_subdomain_reached
  • couldnt_get_kas_ressources
  • redirect_status_syntax_incorrect
  • subdomain_exist_as_subdomain
  • subdomain_path_syntax_incorrect
  • subdomain_syntax_incorrect
  • hostname_too_long host name longer than 64 characters (RFC 1035 / RFC 1123)
  • wildcardsubdomain_not_in_contract
  • php_version_syntax_incorrect
  • php_version_not_available_on_server
  • temporary_until_syntax_incorrect