> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/zga/certificate/createcertificate.md). Agents can also search and read this documentation through its [MCP server](https://docs.console.zenlayer.com/api-reference/~gitbook/mcp).

# CreateCertificate

## 1. API Description

This API (CreateCertificate) is used to create a certificate.

## 2. Input Parameters

The following request parameter list only provides API Input Parameters.

| Parameter Name     | Required | Type   | Description                                                                              |
| ------------------ | -------- | ------ | ---------------------------------------------------------------------------------------- |
| certificateContent | Yes      | String | Certificate content                                                                      |
| certificateKey     | Yes      | String | Certificate key                                                                          |
| certificateLabel   | No       | String | <p>Custom certificate label</p><p>Must not exceed 64 characters</p>                      |
| resourceGroupId    | No       | String | <p>Resource group ID.</p><p>If not provided, the default resource group will be used</p> |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| certificateId  | String | Certificate ID                                                                                                        |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |

## 4. Code Example

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

1. **Upload a certificate.**

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

Request:
{
  "certificateContent": "-----BEGIN CERTIFICATE----- MIIGDTCC****** -----END CERTIFICATE-----",
  "certificateKey": "-----BEGIN RSA PRIVATE KEY----- MIIEogIB****** -----END RSA PRIVATE KEY-----",
}

Response:
{
  "requestId": "T6883FCD0-3E7D-44EA-A517-A421A52A27F4",
  "response": {
    "requestId": "T6883FCD0-3E7D-44EA-A517-A421A52A27F4",
    "certificateId": "f0864***66c6fa"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 provides a supporting [toolkit (SDK)](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk.md). More programming languages will be supported in the future to facilitate quick integration and use of Zenlayer's products and services.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode.md). .

| HTTP Status Code | Error Code                            | Description                                               |
| ---------------- | ------------------------------------- | --------------------------------------------------------- |
| 400              | CERTIFICATE\_EXPIRED                  | Certificate expired                                       |
| 400              | CERTIFICATE\_CONTENT\_NOT\_MATCH\_KEY | Certificate does not match key                            |
| 400              | INVALID\_CERTIFICATE\_CONTENT         | Parse failed. Please check the certificate content format |
| 400              | INVALID\_CERTIFICATE\_KEY             | Parse failed. Please check the key format                 |
| 400              | CERTIFICATE\_DUPLICATED               | Certificate name or content already exists                |
