跳转到内容

下载证书接口

合作商可通过本接口按订单号下载已签发证书的部署材料。接口会返回证书链、叶子证书、中间证书、私钥、CSR、指纹、序列号、域名和有效期等必要信息。

安全提醒

响应中包含 private_key / key 私钥字段,请只在可信服务端调用并妥善保存,不要在前端页面、日志或第三方系统中明文暴露。

请求信息

项目说明
请求地址/partner/DownloadCertificate/
请求方式POST
Content-Typeapplication/jsonapplication/x-www-form-urlencoded

请求参数

参数类型必填说明
apikeystringAPI 密钥。推荐传 app_id:api_secret,也支持通过 X-API-KeyAuthorization: Bearer {apikey} 传入。
order_nostring创建订单接口返回的订单号。也兼容 order_number
cert_idstring指定证书 ID。订单存在多期证书时可用于精确下载。也兼容 certificate_id
installment_nointeger指定证书期数。未传时默认返回该订单中最早一张已签发证书。

请求示例

json
{
  "apikey": "ak_xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "order_no": "CERT202607041730001234"
}

指定证书 ID

json
{
  "apikey": "ak_xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "order_no": "CERT202607041730001234",
  "cert_id": "4a1d9f70-1d53-4f70-8f4f-1d9f701d5333"
}

使用请求头鉴权

bash
curl -X POST "https://example.com/partner/DownloadCertificate/" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ak_xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -d '{
    "order_no": "CERT202607041730001234"
  }'

响应参数

参数类型说明
codeinteger业务状态码,200 表示成功。
messagestring响应消息。
data.order_nostring订单号。
data.order_statusinteger本地订单状态。
data.cert_idstring证书 ID。
data.cert_statusinteger本地证书状态,下载成功时为 1
data.installment_nointeger当前证书期数。
data.installments_countinteger订单总期数。
data.product_namestring产品名称。
data.brand_namestring品牌名称。
data.main_domainstring主域名。
data.sans_domainsarray附加单域名。
data.wildcard_domainsarray附加通配符域名。
data.domainsarray证书包含的全部域名。
data.signature_algorithmstring签名算法。
data.hash_algorithmstring哈希算法。
data.key_specstring密钥规格。
data.serial_numberstring证书序列号。
data.fingerprint_sha256string证书 SHA-256 指纹。
data.issued_atstring/null签发时间。
data.start_datestring/null有效期开始时间。
data.end_datestring/null有效期结束时间。
data.valid_fromstring/null有效期开始日期。
data.valid_tostring/null有效期结束日期。
data.certificate.certificate_chainstring完整证书链 PEM。
data.certificate.certificate_leafstring叶子证书 PEM。
data.certificate.intermediate_certificatestring中间证书 PEM。
data.certificate.private_keystring私钥 PEM。
data.certificate.csrstringCSR PEM。
data.certificate.crtstringcertificate_chain 的部署别名。
data.certificate.keystringprivate_key 的部署别名。
data.certificate.ca_bundlestringintermediate_certificate 的部署别名。
data.has_certificateboolean是否包含证书内容。
data.has_private_keyboolean是否包含私钥。
data.downloaded_atstring本次下载时间。

响应示例

json
{
  "code": 200,
  "message": "获取证书信息成功",
  "data": {
    "order_no": "CERT202607041730001234",
    "order_status": 2,
    "order_status_label": "已完成",
    "cert_id": "4a1d9f70-1d53-4f70-8f4f-1d9f701d5333",
    "cert_status": 1,
    "cert_status_label": "签发成功",
    "installment_no": 1,
    "installments_count": 1,
    "product_name": "DV SSL",
    "brand_name": "ExampleCA",
    "main_domain": "example.com",
    "sans_domains": [],
    "wildcard_domains": [],
    "domains": ["example.com"],
    "years": 1,
    "signature_algorithm": "rsa",
    "hash_algorithm": "sha256",
    "key_spec": "rsa-2048",
    "verification_method": "dns",
    "serial_number": "0123456789ABCDEF",
    "fingerprint_sha256": "ABCDEF...",
    "issued_at": "2026-07-14 15:30:00",
    "start_date": "2026-07-14 15:30:00",
    "end_date": "2027-07-14 15:30:00",
    "valid_from": "2026-07-14",
    "valid_to": "2027-07-14",
    "certificate": {
      "certificate_chain": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n",
      "certificate_leaf": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n",
      "intermediate_certificate": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n",
      "private_key": "-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n",
      "csr": "-----BEGIN CERTIFICATE REQUEST-----\\n...\\n-----END CERTIFICATE REQUEST-----\\n",
      "crt": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n",
      "key": "-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n",
      "ca_bundle": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n"
    },
    "has_certificate": true,
    "has_private_key": true,
    "downloaded_at": "2026-07-14T15:40:00+08:00"
  }
}

处理规则

  • order_no 必须属于当前 API Key 对应的用户。
  • 仅证书状态为 1(签发成功)时允许下载。
  • 如果证书已签发但本地尚未写入证书内容,请先调用“获取订单状态接口”同步证书,或稍后重试。
  • 多期证书订单可通过 cert_idinstallment_no 指定要下载的证书。

错误码

code说明
400参数错误、证书尚未签发成功,或本地尚未写入证书内容。
401API 密钥无效。
403API 密钥关闭、吊销、过期,IP 不在白名单内,或账号被封禁。
404证书不存在或不属于当前 API Key 对应用户。
405请求方式错误。
500服务器错误。

EveryoneTrust SSL 文档中心,帮助你稳定完成 HTTPS 运维。