# Request auto certificates

> Request a Let's Encrypt or Google Trust Services auto certificate: configure DNS validation, check the fee, track progress, and handle automatic renewal and failures.

Bitiful requests and renews auto certificates for you, and updates them to the associated CDN domains and bucket domains. You only need to configure the DNS records once.

Entry point: **Certificate Center › Certificate management › Request auto certificate (证书中心 › 证书管理 › 申请自动证书)** ([open](https://console.bitiful.com/certs/manage)).

## Before you start

- You can edit the domain's DNS records. The domain doesn't need an ICP filing, and doesn't need to resolve to Bitiful.
- For requests that cost money, your account balance must be sufficient. See [Auto certificates](https://docs.bitiful.com/en/prices/detail/autocerts-prices.md).

## Steps

### Enter domains

Enter a domain in the **Domain (域名)** input box and press Enter to add it. You can also separate several with commas, semicolons, or spaces and paste them at once.

- One certificate can have up to 20 domains, and they don't have to share the same root domain
- For a wildcard domain, enter `*.example.com`. It automatically includes `example.com`, so you don't need to enter it again
- A wildcard matches one level only. `*.example.com` doesn't include `a.b.example.com`

### Choose the certificate vendor and algorithm

| Option                        | Description                                                                           |
| ----------------------------- | ------------------------------------------------------------------------------------- |
| **Certificate vendor (证书厂商)** | **Let’s Encrypt** or **Google Trust Services**. The unit prices differ.               |
| **Algorithm (加密算法)**          | **RSA** is more compatible, and **ECC** performs better. It doesn't affect the price. |

### Add DNS records

The **Domain validation (域名验证)** table lists one record for each domain. Add them one by one at your DNS provider:

| Column                 | Description                                                                                                                                      |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Host record (主机记录)** | For example, `_acme-challenge.cdn`. It's relative to your root domain. Some providers require the full domain `_acme-challenge.cdn.example.com`. |
| **Record type (记录类型)** | `CNAME`                                                                                                                                          |
| **Record value (记录值)** | Ends with `.btf.cnamecenter.com`. Copy it as is.                                                                                                 |

- The wildcard `*.example.com` and `example.com` use the same record
- The same host record can't have a TXT record, or validation fails. Delete it first
- If you use a DNS provider that supports proxying (such as the orange cloud), set this record to DNS only

> **Warning**
>
> Don't delete the records after adding them. Once deleted, the certificate can't renew automatically.

### Enter the certificate name and verify

Enter the **Certificate name (证书名称)**: 1 to 36 characters, starting with a letter, containing only letters, digits, and `-` `_` `.` `*`. The name can't duplicate an existing certificate, and can't be changed after the request.

Click **Verify (验证)**. Every row's status must become **Configured (已配置)** before you can continue. If it shows **Not configured (未配置)**, DNS usually hasn't taken effect yet. Wait a few minutes and verify again.

### Check the fee and confirm

Click **Confirm request (确认申请)**. The dialog lists the **Certificate vendor**, **Included domains (包含域名)**, **Charge this time (本次扣费)**, and **Account balance (账户余额)**. After you've checked everything, click **Confirm request** again.

- You can't confirm if your balance is insufficient. Top up first
- You're charged only after the certificate is issued successfully. A failed request isn't charged

### Wait for issuance

After you see "证书申请已提交，签发通常需要几分钟，可稍后刷新列表查看进度" (certificate request submitted, issuance usually takes a few minutes, refresh the list later to check progress), the window closes automatically and you can leave the page.

Refresh the list and watch the dot: blue (requesting) → yellow (deploying) → green (deployed). Once it's green, you can [use it](https://docs.bitiful.com/en/certs-center/deploy.md).

## Free quota and billing

**Free certificate quota (免费证书额度)** at the top of the window shows the number remaining. Each account gets 5 by default, usable only for non-wildcard Let's Encrypt domains.

- **Counted by domain**: A Let's Encrypt certificate with 3 single domains uses 3 quota units. The actual deduction is whatever **Charge this time** shows in the confirmation dialog.
- **Counted by what you currently hold**: After you delete a certificate, its quota is released. A failed request doesn't use quota.
- Wildcard domains and Google Trust Services certificates can't use the free quota.
- The request and each renewal are billed at the quota and unit price at that time. For unit prices, see [Auto certificates](https://docs.bitiful.com/en/prices/detail/autocerts-prices.md).
- Charges are recorded in [Charges › Certificate fees (扣费 › 证书费用)](https://console.bitiful.com/billing/consume/cert), where you can see the details of each request and renewal.

## Automatic renewal

The platform checks once a day. Auto certificates with less than 15 days of validity left are renewed automatically, using the original domains, certificate vendor, and algorithm. After a successful renewal:

1. The contents and expiration time in the Certificate Center are updated;
2. The associated CDN domains switch to the new certificate automatically;
3. The associated bucket domains switch to the new certificate automatically;
4. What you get through the [Certificate API](https://docs.bitiful.com/en/developer/api/certs.md) is updated too.

If a renewal fails, it's tried again every day after that. Common causes:

| Cause                                        | What to do                                                                                                                                   |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| The DNS CNAME record was deleted or modified | In the list, click the icon next to **Auto certificate**, and restore the records as shown in the table under **DNS configuration (DNS配置)**. |
| Insufficient balance                         | Renewals that cost money are skipped. After you top up, they retry automatically the next day.                                               |

The icon next to **Auto certificate** in the list shows DNS status: green means all records are fine, red means some records are **Not configured**, and a spinner means **Checking (检测中)**, which updates automatically soon. Don't leave it red for long.

[Delete](https://docs.bitiful.com/en/certs-center/intro.md#delete-a-certificate) auto certificates you no longer need. As long as a certificate is in the list, it's renewed and billed before expiry, whether or not it's used.

## What to do when a request fails

When the list shows a red dot (**Certificate request failed, delete it and request again (证书申请失败，请删除后重新申请)**), you weren't charged. Check the items below first, then delete the record and request again:

- The `_acme-challenge` CNAME record is in effect on all DNS lines, and there's no TXT record of the same name
- The domain's CAA records allow the selected certificate authority (`letsencrypt.org` for Let's Encrypt, `pki.goog` for Google Trust Services)
- You haven't requested for the same domain repeatedly in a short time, since certificate authorities have rate limits

You can also try again with a different certificate vendor.

## Messages during validation and requests

| Message                                                                                                                                    | What to do                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| "域名格式有误：…" (domain format is invalid: …)                                                                                                   | Check the domain. Don't include a protocol, port, or path. For internationalized domains, enter the Punycode form (starting with `xn--`). |
| "一张证书最多包含 20 个域名" (a certificate can include at most 20 domains)                                                                           | Split it into several certificates.                                                                                                       |
| "证书名称格式有误" (certificate name format is invalid)                                                                                            | Change it according to the naming rules.                                                                                                  |
| "证书备注名称已存在，请修改后重试" (the certificate name already exists, change it and try again)                                                          | Use a different name.                                                                                                                     |
| "已存在同名的申请失败证书，请先在列表中删除它，或换一个证书名称" (a failed certificate with the same name exists, delete it from the list first, or use a different name) | Delete the failed record, or use a different name.                                                                                        |
| "域名 … 已经存在TXT记录，请先删除后重试" (domain … already has a TXT record, delete it and try again)                                                      | Delete the TXT record on `_acme-challenge`.                                                                                               |
| "CNAME记录尚未生效，请确认 … 已指向 … 并等待DNS传播" (the CNAME record isn't in effect yet, confirm … points to … and wait for DNS propagation)              | Check the record value and wait for it to take effect.                                                                                    |
| "查询 … 的域名解析失败，请稍后重试" (DNS lookup for … failed, try again later)                                                                            | Check whether the domain's DNS servers are working.                                                                                       |
| "当前余额不足，请前往充值" (insufficient balance, please top up)                                                                                       | Top up and try again.                                                                                                                     |

## FAQ

<details>
<summary>Can I change an auto certificate's domains, name, or algorithm?</summary>

No. Request a new one with a new name, switch your CDN domains and bucket domains to it, then delete the old certificate.

</details>

<details>
<summary>How long is a certificate valid?</summary>

The certificate authority decides. Use the **Expiration time** in the list as the reference. Automatic renewal completes before expiry.

</details>

<details>
<summary>Do the records I add affect website access?</summary>

No. The `_acme-challenge` record is used only for certificate validation and doesn't affect the domain's existing resolution.

</details>

<details>
<summary>Do I need to enter the full domain in the host record?</summary>

Most DNS providers in China take the relative record from the table, such as `_acme-challenge.cdn`, and append the root domain automatically. If the subdomain is hosted in a separate DNS zone, convert it for that zone.

</details>
