Help Center/ SecMaster/ API Reference/ SecMaster APIs (V1)/ Metering and Billing/ Enabling or Configuring SecMaster Subscription
Updated on 2026-02-05 GMT+08:00

Enabling or Configuring SecMaster Subscription

Function

This API is used to enable or configure the subscription to SecMaster.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/subscriptions/orders

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 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.

X-Language

Yes

String

Current environment language. The value can be zh-cn or en-us.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

scene

Yes

String

Scenario description. The value can be PREPAID (yearly/monthly billing), POSTPAID (pay-per-use billing), or CONFIG (resource usage configuration). The default value is PREPAID. The value is case-insensitive.

promotion_info

No

String

Promotion discount information.

String, JSON format.

operate_type

Yes

String

Operation type. The value can be CREATE (creation) or ALERT_CONFIG (order usage warning configuration). The value is case insensitive.

tag_list

No

Array of SubscriptionTag objects

Billing tag.

product_list

No

Array of Product objects

This parameter is mandatory when scene is set to PREPAID or POSTPAID.

Offering list.

config

No

OrderConfig object

Configuration list. This parameter is mandatory when scene is set to CONFIG.

period_type

No

Integer

Subscription period type. This parameter is mandatory when scene is set to PREPAID.

2: monthly

3: yearly

period_num

No

Integer

Number of subscription periods. This parameter is mandatory when scene is set to PREPAID.

The value must be greater than 0 to avoid reporting an error.

If period_type is set to 2, the value range is [1, 9]. If period_type is set to 3, the value range is [1, 3].

is_auto_renew

No

Integer

Whether to automatically renew the subscription. This parameter is mandatory when scene is set to PREPAID. If this parameter is left empty, the subscription is not automatically renewed.

1: Auto renewal is enabled.

0 (default): Auto renewal is disabled.

Table 4 SubscriptionTag

Parameter

Mandatory

Type

Description

key

No

String

Key.

A maximum of 36 characters are allowed. Only letters, digits, hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF) are allowed.

value

No

String

Value. A maximum of 43 characters are allowed. The value can be an empty string. The character set is as follows: A-Z, a-z, 0-9, periods (.), hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF).

Table 5 Product

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Resource type.

resource_spec_code

Yes

String

Resource specification code.

resource_size

Yes

Integer

Subscription quantity.

Table 6 OrderConfig

Parameter

Mandatory

Type

Description

threshold_list

No

Array of UsageThreshold objects

Thresholds.

alert_config

No

AlertConfig object

Enabling or disabling of current alarm configuration.

Table 7 UsageThreshold

Parameter

Mandatory

Type

Description

resource_spec_code

No

String

Resource type.

source_resource_spec_code

No

String

Original resource type.

threshold

Yes

Double

Threshold.

unit

Yes

String

Unit of the threshold. The options are %, MB, and GB.

If the unit is %, the maximum threshold is 95.

enable

No

Boolean

Alert reporting settings of the current resource type.

Table 8 AlertConfig

Parameter

Mandatory

Type

Description

topic_urn

No

String

Associated SMN topic. When type is set to smn, this parameter can be set. The default value is empty.

type

No

String

Supported order alarm types. SMN is the message protocol, and MC is the message center.

enable

No

Boolean

Enabling or disabling of current alert configuration. true: enabled; false: disabled.

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

order_id

String

ID of the order for creating or changing a resource. This parameter is returned only when scene is set to PREPAID.

order_status

Integer

Order update status. 1: The order is changed successfully. 5: The order fails to be changed.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

  • Subscribe to yearly/monthly resources.

    POST https://{endpoint}/v1/{projectId}/subscriptions/orders
    
    {
      "period_num" : 1,
      "period_type" : 2,
      "is_auto_renew" : 1,
      "scene" : "PREPAID",
      "operate_type" : "CREATE",
      "product_list" : [ {
        "resource_type" : "xxx.resource.type.secmaster.typical",
        "resource_spec_code" : "secmaster.professional",
        "resource_size" : 3
      } ],
      "tag_list" : [ {
        "key" : "testKey1",
        "value" : "testVal1"
      } ]
    }
  • Subscribe to pay-per-use resources.

    {
      "scene" : "POSTPAID",
      "operate_type" : "CREATE",
      "product_list" : [ {
        "resource_type" : "xxx.resource.type.secmaster.typical",
        "resource_spec_code" : "secmaster.basic",
        "resource_size" : 3
      } ],
      "tag_list" : [ {
        "key" : "testKey2",
        "value" : "testVal2"
      } ]
    }

Example Responses

Status code: 200

Request succeeded.

{
  "order_id" : "CS2510212051NLDL4",
  "order_status" : 1
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Request parameter error.

403

Insufficient permissions.

Error Codes

See Error Codes.