Skip to main content

Obtain an RSA public key

Use this API operation to retrieve a public key ID and its value.

HTTP API call

Description

Before encrypting the value of the input field, call this operation to obtain the latest supported public key ID and its value.

Prerequisites

API call

GET /api/v1/public-keys/latest

Request parameters

Parameter passing

Field

Data type

Required

Description

Example

Header

Authorization

String

Yes

The API key for authentication.

"Authorization":"Bearer d1**2a"

Response parameters

Field

Data type

Required

Description

request_id

String

Yes

The request ID.

public_key

String

No

The value of the RSA public key.

public_key_id

String

No

The ID of the RSA public key.

Error response parameters

Name

Type

Required

Description

request_id

String

Yes

The request ID.

code

String

No

The error code and error message. For more information, see Error messages.

message

String

No

Request example

  • curl
  • Python SDK
curl -X GET 'https://dashscope.aliyuncs.com/api/v1/public-keys/latest' \
--header 'Authorization: Bearer xxx'

Successful response example

{
    "request_id": "bcb3***",
    "data": {
        "public_key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnojrB579xgPQN5f46SvoRAiQBPWBaPzWh7hp51fWI+OsQk7KqH0qMcw8i0eK5rfOvJIPujOQgnes1ph9/gKAst9NzXVIl9JJYUSPtzTvOabhp4yvS3KBf9g3xHYVjYgW33SOY74Ue/tgbCXn717rV6gXb4sVvq9XK/1BrDcGbEOQEZEgBTFkm/g3lpWLQtACwwqHffoA9eQtkkz15ZFKosAgbR8LedfIvxAl2zk15REzxXiRcFgc9/tLF0U1t2Sxt9FkQefxYwn6EZawTsRJvf4kqF3MaPdTcDbOp0iSNvCl2qzPSf/F+Oll2CUM1tFAEu81oa4l0WaDR3UtvqOtyQIDAQAB",
        "public_key_id": "1"
    }
}

Error response example

{
    "request_id": "bcb3***",
    "code": "InvalidParameter",
    "message": "Required parameter(s) missing or invalid, please check the request parameters."
}

Error codes

For more information about error codes, see Error messages.
Token Plan
Model Playground
Fine-tuning
Model Compression
Statistics and Monitoring
Support