Updated on 2025-05-29 GMT+08:00

Creating a CSR

Function

Create a CSR.

URI

POST /v3/scm/csr

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Minimum: 32

Maximum: 2097152

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

User-defined CSR name.

Minimum: 0

Maximum: 63

domain_name

Yes

String

Domain name bound to the CSR. If you want to use the CSR, ensure the domain name bound to a certificate contains the domain name set here.

Minimum: 0

Maximum: 63

sans

No

String

Additional domain name bound to the CSR.

Minimum: 0

Maximum: 255

private_key_algo

Yes

String

Private key algorithm. The value can be:

  • RSA_2048

  • RSA_3072

  • RSA_4096

  • EC_P256

  • EC_P384

  • SM2

Minimum: 0

Maximum: 63

usage

Yes

String

CSR usage. The value can be:

  • PERSONAL: individual certificate

  • ENTERPRISE: enterprise certificate

Minimum: 0

Maximum: 255

company_country

No

String

Country. This parameter is mandatory when usage is set to ENTERPRISE. Example value: CN.

Minimum: 0

Maximum: 255

company_province

No

String

Province. This parameter is mandatory when usage is set to ENTERPRISE. Example: Beijing.

Minimum: 0

Maximum: 255

company_city

No

String

City. This parameter is mandatory when usage is set to ENTERPRISE. Example: Beijing.

Minimum: 0

Maximum: 255

company_name

No

String

Company name. This parameter is mandatory when usage is set to ENTERPRISE.

Minimum: 0

Maximum: 255

Response Parameters

Status code: 201

Table 3 Response body parameters

Parameter

Type

Description

id

String

CSR ID.

Minimum: 0

Maximum: 63

name

String

User-defined CSR name.

Minimum: 0

Maximum: 63

domain_name

String

Domain name.

Minimum: 0

Maximum: 63

sans

String

Additional domain name bound to the CSR.

Minimum: 0

Maximum: 255

private_key_algo

String

Key algorithm type. The options are as follows:

  • RSA_2048

  • RSA_3072

  • RSA_4096

  • EC_P256

  • EC_P384

  • SM2

Minimum: 0

Maximum: 63

usage

String

CSR usage. The value can be:

  • PERSONAL: individual certificate

  • ENTERPRISE: enterprise certificate

Minimum: 0

Maximum: 255

company_country

String

Country. This parameter is mandatory when usage is set to ENTERPRISE.

Minimum: 0

Maximum: 255

company_province

String

Province. This parameter is mandatory when usage is set to ENTERPRISE.

Minimum: 0

Maximum: 255

company_city

String

City. This parameter is mandatory when usage is set to ENTERPRISE.

Minimum: 0

Maximum: 255

company_name

String

Company name. This parameter is mandatory when usage is set to ENTERPRISE.

Minimum: 0

Maximum: 255

create_time

Long

CSR creation time.

Minimum: 13

Maximum: 20

update_time

Long

CSR update time.

Minimum: 13

Maximum: 20

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Example Requests

{
  "name" : "CSRxxxx",
  "domain_name" : "xxx.com",
  "private_key_algo" : "RSA_2048",
  "usage" : "ENTERPRISE"
}

Example Responses

Status code: 201

Normal response.

{
  "id" : "48e392628b0f47769e47d91acc7654a5",
  "name" : "xxxx",
  "domain_name" : "xxx.com",
  "sans" : "",
  "private_key_algo" : "RSA_2048",
  "usage" : "ENTERPRISE",
  "company_country" : "CN",
  "company_province" : "Beijing",
  "company_city" : "Beijing",
  "company_name" : "company",
  "create_time" : 1735804566545,
  "update_time" : 1735804566545
}

Status code: 401

Authentication failed.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status code: 403

Access denied.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status code: 500

Failed to complete the request because of an internal server error.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status Codes

Status Code

Description

201

Normal response.

401

Authentication failed.

403

Access denied.

404

Access page not found.

500

Failed to complete the request because of an internal server error.

Error Codes

See Error Codes.