Create website subdomain
Create a new subdomain for the selected website. Provide a subdomain prefix and, optionally, a custom directory or the website public directory to use as the subdomain root.
Create a new subdomain for the selected website.
Provide a subdomain prefix and, optionally, a custom directory or the website public directory to use as the subdomain root.
Authorizations
AuthorizationstringRequired
API Token authentication
Path parameters
usernamestringRequiredExample:
u123456789domainstringRequiredExample:
Domain name
mydomain.tldBody
subdomainstringRequiredExample:
Subdomain prefix to create under the selected website
blogdirectorystring · nullableOptionalExample:
Directory name for the subdomain relative to the website root
blogis_using_public_directorybooleanOptionalExample:
Use the website public directory as the subdomain root directory
trueResponses
200
Success empty response
application/json
messagestringOptionalExample:
Request accepted401
Unauthenticated response
application/json
422
Validation error response
application/json
500
Error response
application/json
post/api/hosting/v1/accounts/{username}/websites/{domain}/subdomains
POST /api/hosting/v1/accounts/{username}/websites/{domain}/subdomains HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 72
{
"subdomain": "blog",
"directory": "blog",
"is_using_public_directory": true
}{
"message": "Request accepted"
}Last updated
Was this helpful?