Path: API › ACME 证书

`POST /acme`

将通过 ACME（Let's Encrypt 等）签发的 SSL 证书部署到指定网站，开启 HTTPS。

## Request body

_Required._

- `action0.request_time` (string, required) — Unix 时间戳。
- `action0.request_token` (string, required) — 按 API 概览生成的签名。
- `action0.action` (string, required) — 具体操作名称。
  - one of `"SetCertToSite"`
- `action0.index` (string, required) — 证书订单索引 ID
- `action0.siteName` (string, required) — 目标网站域名

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "SetCertToSite",
  "index": "string",
  "siteName": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/acme" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=SetCertToSite" \
  --data-urlencode "index=<index>" \
  --data-urlencode "siteName=<siteName>"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "status": true,
  "msg": "SSL开启成功!",
  "csr": "-----BEGIN CERTIFICATE-----\nMIIE7T..."
}
```

- `action0.response.default.status` (boolean, optional) — `true` 部署成功
- `action0.response.default.msg` (string, optional) — `SSL开启成功!`
- `action0.response.default.csr` (string, optional) — 部署的完整证书链（PEM 格式）


## SetCertToSite (ACME)

将通过 ACME（Let's Encrypt 等）签发的 SSL 证书部署到指定网站，开启 HTTPS。

- **路由**：`POST /acme`
- **action**：`SetCertToSite`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `SetCertToSite` |
| index | 是 | String | 证书订单索引 ID |
| siteName | 是 | String | 目标网站域名 |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | Boolean | `true` 部署成功 |
| msg | String | `SSL开启成功!` |
| csr | String | 部署的完整证书链（PEM 格式） |

## 示例

### 请求

```
POST /acme HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded

action=SetCertToSite&index=851cc157ad22888459e59c3cfdc5ac95&siteName=testapi.bt.local
```

### 响应

```json
{
  "status": true,
  "msg": "SSL开启成功!",
  "csr": "-----BEGIN CERTIFICATE-----\nMIIE7T..."
}
```

## 相关接口

- [apply_cert_api](/api/acme/apply_cert_api) — 申请证书
- [apply_dns_auth](/api/acme/apply_dns_auth) — DNS 验证签发

