You can call this operation to change the billing method of an ApsaraDB for Redis instance from pay-as-you-go to subscription.

For more information about how to perform the corresponding operation in the console, see Switch to subscription.

Note However, you cannot change the billing method of an instance from subscription to pay-as-you-go.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No TransformToPrePaid

The operation that you want to perform. Set the value to TransformToPrePaid.

InstanceId String Yes r-bp1xxxxxxxxxxxxx

The ID of the instance.

Period Long Yes 12

The subscription period of the instance. Unit: months. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

AutoPay Boolean No true

Specifies whether to enable auto-renewal. Valid values:

  • true
  • false

Default value: true.

Note If you set this parameter to false, manually renew the instance before the instance expires.
RegionId String No cn-hangzhou

The ID of the region where the instance is deployed.

Response parameters

Parameter Type Example Description
RequestId String 426F1356-B6EF-4DAD-A1C3-DE53B9DAF586

The ID of the request.

OrderId String 111111111111111

The ID of the order.

EndTime String 2019-01-18T16:00:00Z

The expiration time of the instance after the billing method is changed from pay-as-you-go to subscription.


Sample requests
&<Common request parameters>

Sample success responses

XML format


JSON format

    "OrderId": "111111111111111",
    "RequestId": "426F1356-B6EF-4DAD-A1C3-DE53B9DAF586",
    "EndTime": "2019-01-18T16:00:00Z"

Error codes

HttpCode Error code Error message Description
400 MissingParameter Period is mandatory for this action. The error message returned because the instance ID is required.
400 InvalidParam Period is invalid The error message returned because the specified period is invalid.
403 AlreadyPrePaid This instance is already prepaid The error message returned because this instance is already a subscription instance.
400 ResourceNotAvailable Resource you requested is not available for finance user. The error message returned because the requested resource is unavailable to a finance user.
400 InsufficientBalance Your account does not have enough balance. The error message returned because you do not have sufficient account balance. Recharge your account and try it again.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because your account has not passed the real-name verification.

For a list of error codes, visit the API Error Center.