# Example - subdomains and certificates

Create a subdomain of the site:

```
POST https://api.plsk.org/api/plesk/v2/domains
{"name": "blog.<hostname>", "hosting_type": "virtual", "parent_domain": {"id": <domainId>, "name": "<hostname>"}}
```

Status 201 with the id of the new domain. A subscription may have 5 subdomains. The file API addresses the subdomain by its own domain id.

## Certificates

The certificate `*.lab.plsk.org` covers the hostname of the subscription and does not cover `blog.<hostname>`. Until a certificate for the subdomain exists, the subdomain answers over HTTP only.

The platform requests a Let's Encrypt certificate for each subdomain. The certificate is usually installed within 1 to 2 minutes after the subdomain is created; a failed attempt is repeated after 30 s, then at doubling intervals up to 1 h. After installation, HTTP requests are redirected to HTTPS.

Verification:

```
curl -I https://blog.<hostname>
```

The number of certificates the platform requests is limited per week. When the limit is reached, requests resume when the limit frees. Certificates are not renewed; they are valid for 90 days and a subscription for 14.
