---
title: "Create website subdomain"
method: POST
path: "/api/hosting/v1/accounts/{username}/websites/{domain}/subdomains"
tags: ["Hosting: Domains"]
---

# Create website subdomain

`POST /api/hosting/v1/accounts/{username}/websites/{domain}/subdomains`

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.

## Path parameters

- `username` string, required
- `domain` string, required

## Request body

- HostingV1DomainsCreateSubdomainRequest
  - `subdomain` string, required — Subdomain prefix to create under the selected website
  - `directory` string, nullable — Directory name for the subdomain relative to the website root
  - `is_using_public_directory` boolean — Use the website public directory as the subdomain root directory

## Response `200`

Success empty response

- CommonSuccessEmptyResource
  - `message` string

## Other responses

- `401` — Unauthenticated response
- `422` — Validation error response
- `500` — Error response

---

[API](https://skmtc.dev/hostinger/apis/hostinger-api.md) · [All operations](https://skmtc.dev/hostinger/apis/hostinger-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hostinger/hostinger-api/revisions/75f6fb63f779/schema)
