# DescribeCertificates

## 1. API Description

This API is used to query the list of certificates.

## 2. Request Parameters

The following list includes the request parameters required by the API:

| Parameter Name   | Required | Type            | Description                                                                                                              |
| ---------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------ |
| certificateIds   | No       | Array of String | <p>Certificate IDs.</p><p>Supports querying up to 100 IDs.</p>                                                           |
| certificateLabel | No       | String          | Custom certificate label                                                                                                 |
| san              | No       | String          | Subject Alternative Name (domain associated with the certificate)                                                        |
| resourceGroupId  | No       | String          | <p>ID of the resource group.</p><p>If not provided, returns instances from all visible resource groups for the user.</p> |
| expired          | No       | Boolean         | Whether the certificate is expired                                                                                       |
| pageSize         | No       | Integer         | <p>Page size of the results.</p><p>Defaults to 20, maximum is 1000.</p>                                                  |
| pageNum          | No       | Integer         | <p>Page number of the results.</p><p>Defaults to 1.</p>                                                                  |

## 3. Output Parameters

| Parameter Name | Type                                                                                                                      | Description                                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                                                                    | Unique request ID. Returned with every request. This request's requestId is needed when troubleshooting. |
| totalCount     | Integer                                                                                                                   | Total number of items that match the criteria.                                                           |
| dataSet        | Array of [CertificateInfo](https://docs.console.zenlayer.com/test/ci-develop-en/networking/datastructure#certificateinfo) | Result set                                                                                               |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}

1. **Paginate query for certificate list**

```json
POST / HTTP/1.1
Host: console.zenlayer.com/api/v2/cdn
Content-Type: application/json
X-ZC-Action: DescribeCertificates
<Common Request Params>

Request:
{
  "pageNum": 1,
  "pageSize": 1
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "totalCount": 6,
    "dataSet": [
      {
        "certificateId": "certificateIdxxxxx",
        "certificateLabel": "certificatexxx",
        "common": "*.xx.com",
        "fingerprint": "1D7801BBE772D5DE55CBF1F88AEB41A42402DA07",
        "issuer": "TrustAsia TLS RSA CA",
        "sans": ["xx.cn"],
        "algorithm": "RSA",
        "createTime": "2023-04-19T09:11:27Z",
        "startTime": "2023-04-18T09:27:30Z",
        "endTime": "2023-07-18T09:27:30Z",
        "resourceGroupId":"xxx-xx",
        "expired": false
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Error Codes

The following includes error codes encountered in business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/test/ci-develop-en/api-introduction/instruction/commonerrorcode).
