Environment Management
APIs with the Platform prefix in their names are used to manage Platform Edition resources and are accessed via app.platform (e.g., app.platform.createPlatformEnv); all other APIs are accessed via app.env. The Platform Edition is an account-level package solution. For more information, see Platform Edition Overview.
listEnvs
1. API Description
API feature: obtains all environment information
API declaration: listEnvs(): Promise<Object>
2. Input Parameters
N/A
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Unique identifier of the request |
| EnvList | Yes | Array<EnvItem> | Environment array |
EnvItem
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| Source | Yes | String | Source. miniapp / qcloud |
| Alias | Yes | String | Environment alias |
| Status | Yes | String | Status. NORMAL / UNAVAILABLE |
| CreateTime | Yes | String | Creation time |
| UpdateTime | Yes | String | Update time |
| Region | Yes | String | Region, e.g. ap-shanghai |
| PackageId | Yes | String | Package ID |
| PackageName | Yes | String | Package name |
| PackageType | No | String | Package type. empty / baas / tcbr |
| EnvType | No | String | Environment type. baas / run / hosting / weda |
| PayMode | No | String | Payment mode. prepayment / postpaid |
| IsAutoDegrade | No | Boolean | Whether to auto-degrade to free plan when expiring |
| IsDefault | No | Boolean | Whether it is the default environment |
| EnvChannel | No | String | Environment channel |
| Databases | No | Array | Database resource details |
| Storages | No | Array | Storage resource details |
| Functions | No | Array | Function resource details |
| LogServices | No | Array | Log resource details |
| StaticStorages | No | StaticStorageInfo[] | Static hosting info (including CDN domain) |
| Tags | No | Array<{Key, Value}> | Environment tags |
| EnvPreferences | No | Record<string, any> | Environment preferences |
StaticStorageInfo
Static CDN resource information.
| Field | Type | Description |
|---|---|---|
| StaticDomain | String | Static hosting CDN domain, e.g. xxx.tcloudbaseapp.com |
| DefaultDirName | String | Static CDN default directory (root) |
| Status | String | Status. process / online / offline / init |
| Region | String | COS region |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.listEnvs()
const { EnvList } = res
for (let envItem of EnvList) {
console.log(envItem.EnvId, envItem.Alias)
// Get static hosting domain
const staticDomain = envItem.StaticStorages?.[0]?.StaticDomain
if (staticDomain) {
console.log('Static hosting domain:', staticDomain)
}
}
}
test()
getEnvAuthDomains
1. API Description
API feature: obtains the list of legal domains
API declaration: getEnvAuthDomains(): Promise<Object>
2. Input Parameters
N/A
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| Domains | Required | Array<Domain> | List of domains |
| envId | Required | String | Environment ID |
Domain
| Field | Required | Type | Description |
|---|---|---|---|
| Id | Required | String | Domain ID |
| Domain | Required | String | Domain |
| Type | Required | String | Domain type. Valid values include: system, user |
| Status | Required | String | Status. Valid values include: ENABLE, DISABLE |
| CreateTime | Required | String | Creation time |
| UpdateTime | Required | String | Update time |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.getEnvAuthDomains()
const { Domains } = res
for (let domain in Domains) {
console.log(domain)
}
}
test()
createEnvDomain
1. API Description
API feature: Add environment security domain name
API declaration: createEnvDomain(domains: string[]): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| domains | Required | Array<String> | Array of secure domains |
3. Return Results
| Field | Type | Description |
|---|---|---|
| RequestId | String | Request ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.createEnvDomain(['luke.com'])
console.log(res)
}
test()
deleteEnvDomain
1. API Description
API feature: Delete environment security domain
API declaration: deleteEnvDomain(domains: string[]): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| domains | Required | Array<String> | Array of secure domains |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
| Deleted | Required | Number | Number of successfully deleted domains |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.deleteEnvDomain(['luke.com'])
const { Deleted } = res
console.log(Deleted) // Number of deleted domains
}
test()
getEnvInfo
1. API Description
API feature: obtain environment information
API declaration: getEnvInfo(): Promise<Object>
2. Input Parameters
N/A
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
| EnvInfo | Yes | EnvItem | Environment information |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.getEnvInfo()
const { EnvInfo } = res
console.log(EnvInfo)
}
test()
updateEnvInfo
1. API Description
API feature: modify environment alias
API declaration: updateEnvInfo(alias: string): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| alias | Yes | String | Environment alias |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.updateEnvInfo('lukemodify')
console.log(res)
}
test()
getLoginConfigList
1. API Description
API feature: Pull login configuration list
API declaration: getLoginConfigList(): Promise<Object>
2. Input Parameters
N/A
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
| ConfigList | Required | Array<ConfigItem> | Login configuration list |
ConfigItem
| Field | Required | Type | Description |
|---|---|---|---|
| Id | Required | String | Configuration ID |
| Platform | Required | String | Platform type |
| PlatformId | Required | String | Platform ID |
| Status | Required | String | Configuration status |
| UpdateTime | Required | String | Configuration update time |
| CreateTime | Required | String | Configuration creation time |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.getLoginConfigList()
const { ConfigList } = res
for (let config in ConfigList) {
console.log(config)
}
}
test()
createLoginConfig
1. API Description
API feature: Create login method
API declaration: createLoginConfig(platform, appId, appSecret): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| platform | Required | String | Platform "WECHAT-OPEN", "WECHAT-PUBLIC", "QQ", "ANONYMOUS" |
| appId | Required | String | Third-party platform AppID. Note: For anonymous login (platform: ANONYMOUS), enter "anonymous" for appId. |
| appSecret | No | String | Third-party platform AppSecret. Note: For anonymous login (platform: ANONYMOUS), appSecret can be omitted. |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
await env.createLoginConfig('WECHAT-OPEN', 'appId', 'appSecret')
}
test()
updateLoginConfig
1. API Description
API feature: Update login method configuration
API declaration: updateLoginConfig(configId, status, appId, appSecret): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| configId | Required | String | Configuration record ID |
| status | Required | String | "ENABLE", "DISABLE" |
| appId | Required | String | Third-party platform AppId. For anonymous login, enter "anonymous" for appId. |
| appSecret | No | String | Third-party platform AppSecret. If anonymous login, this field can be omitted. |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const loginConfigRes = await env.getLoginConfigList()
await env.updateLoginConfig(
loginConfigRes.ConfigList[0].Id,
'ENABLE',
'appId',
'appSecret'
)
}
test()
createBillingDeal
1. API Description
API feature: create environment billing order
API declaration: createBillingDeal(params: CreateBillingDealParams): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| DealType | Required | String | Order operation type. Valid values: purchase (purchase), renew (renewal), modify (specification change) |
| ProductType | Required | String | Product type purchased. Valid values: tcb-baas (baas package), tcb-promotion (promotion package), tcb-package (resource package) |
| PackageId | Required | String | ID of the target product/package to be ordered |
| CreateAndPay | No | Boolean | whether to pay automatically |
| TimeSpan | No | Number | Subscription duration |
| TimeUnit | No | String | Subscription duration unit. Valid values: d (day), m (month), y (year), p (one-time) |
| ResourceId | No | String | Unique identifier of the resource |
| Source | No | String | Source. Valid values: qcloud, miniapp |
| Alias | No | String | Resource alias |
| EnvId | No | String | Environment ID |
| EnableExcess | No | Boolean | Whether to enable excess limit pay-as-you-go |
| ModifyPackageId | No | String | ID of the target product/package for modification |
| Extension | No | String | Extension information (JSON string) |
| AutoVoucher | No | Boolean | whether to automatically use vouchers for payment |
| ResourceTypes | No | String[] | Resource type. Resources to be provisioned when purchasing a new environment. Valid values: flexdb, cos, cdn, scf |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
| EnvId | Yes | String | Environment ID |
| TranId | Required | String | Order transaction ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.createBillingDeal({
DealType: 'purchase',
ProductType: 'tcb-baas',
PackageId: 'baas_personal',
CreateAndPay: false,
TimeSpan: 1,
TimeUnit: 'm',
Alias: 'test',
EnvId: 'test-12345'
})
console.log(res.TranId) // Order transaction ID
}
test()
cancelDeal
1. API Description
API feature: Cancel unpaid orders
API declaration: cancelDeal(params: Object): Promise<Object>
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| TranId | Required | String | Order transaction ID |
| UserClientIp | Required | String | User client IP |
| WxAppId | No | String | WeChat AppId (optional) |
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
// First, create an order
const dealRes = await env.createBillingDeal({
DealType: 'purchase',
ProductType: 'tcb-baas',
PackageId: 'baas_personal',
CreateAndPay: false,
TimeSpan: 1,
TimeUnit: 'm',
Alias: 'test',
EnvId: 'test-12345'
})
// Cancel the order
const res = await env.cancelDeal({
TranId: dealRes.TranId,
UserClientIp: '127.0.0.1'
})
console.log(res)
}
test()
createCustomLoginKeys
1. API Description
API feature: Create custom login key
API declaration: createCustomLoginKeys(): Promise<Object>
2. Input Parameters
N/A
3. Return Results
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | Required | String | Request ID |
| KeyID | Yes | String | Key ID |
| PrivateKey | Yes | String | Private Key |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const { env } = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await env.createCustomLoginKeys()
const { KeyID, PrivateKey } = res
console.log(KeyID, PrivateKey)
}
test()
destroyEnvWithParams
1. API Description
API feature: Destroy the specified environment, supporting options such as forced deletion and bypassing resource checks
API declaration: app.env.destroyEnvWithParams(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| IsForce | No | Boolean | Whether to force deletion (for environments in prepaid isolation), default false |
| BypassCheck | No | Boolean | whether to bypass resource data checks and delete directly, default false |
3. Return Results
| Field | Type | Description |
|---|---|---|
| RequestId | String | Unique identifier of the request |
destroyPlatformEnv
1. API Description
API feature: Delete a Platform Edition environment. Data within the environment will be cleared simultaneously and cannot be recovered.
API declaration: app.platform.destroyPlatformEnv(params): Promise<Object>
This API has been supported since v5.8.8.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
3. Return Results
| Field | Type | Description |
|---|---|---|
| RequestId | String | Unique identifier of the request |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.destroyPlatformEnv({
EnvId: 'env-to-destroy'
})
console.log(res.RequestId)
}
test()
describeEnvs
1. API Description
API feature: Queries the list of CloudBase environments under an account, supporting multi-dimensional filtering.
API declaration: app.env.describeEnvs(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | No | String | Filter by Environment ID |
| WxAppId | No | String | WeChat AppId (required for WeChat channel) |
| IsVisible | No | Boolean | Used in conjunction with Channels to control the filtering direction for visible/invisible channels |
| Channels | No | String[] | Channel list, such as ["ide","qc_console"] |
| EnvType | No | String | Environment type: baas / run / weda / hosting |
| EnvTypes | No | String[] | List of environment types (takes precedence over EnvType) |
| Limit | No | Number | Page size |
| Offset | No | Number | Pagination offset |
3. Return Results
| Field | Type | Description |
|---|---|---|
| EnvList | Array | Environment list |
| RequestId | String | Unique identifier of the request |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const { EnvList } = await app.env.describeEnvs({ EnvType: 'baas' })
EnvList.forEach(e => console.log(e.EnvId, e.Alias))
}
test()
createEnv
1. API Description
API feature: Creates a new CloudBase environment
API declaration: app.env.createEnv(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| Alias | Required | String | Environment alias, consisting of lowercase letters/digits/hyphens, cannot start or end with a hyphen, with a maximum length of 20 characters |
| PackageId | Required | String | Package ID, can be obtained via describeBaasPackageList |
| Resources | Required | String[] | Resources to be provisioned: flexdb / storage / function |
| Period | No | Number | Subscription duration (months), default is 1 |
| AutoVoucher | No | Boolean | whether to automatically use vouchers |
| RenewFlag | No | String | Renewal policy: NOTIFY_AND_AUTO_RENEW / NOTIFY_AND_MANUAL_RENEW |
| ExternalStorage | No | ExternalStorage | Use a shared COS bucket for cloud storage. When specified, no dedicated bucket is allocated for the environment, and files are stored under its directory prefix (BasePath) in the shared bucket. Resources must include storage. Applies to cloud storage only; the shared bucket for static website hosting is assigned by the platform when hosting is enabled, see Appendix: Shared COS Bucket (ExternalStorage) |
ExternalStorage
| Field | Required | Type | Description |
|---|---|---|---|
| Enabled | No | Boolean | Whether to enable external storage. Passing true explicitly is recommended |
| BucketName | Required | String | Name of the shared bucket |
| Region | Required | String | Region of the shared bucket, for example ap-shanghai |
| BasePath | Required | String | Directory prefix of the environment in the shared bucket. Must be unique among environments in the same shared bucket |
External storage currently supports only Tencent Cloud Object Storage (COS). Set BucketName to a COS bucket name; you do not need to specify a storage provider.
3. Return Results
| Field | Type | Description |
|---|---|---|
| EnvId | String | ID of the newly created environment |
| RequestId | String | Unique identifier of the request |
createPlatformEnv
1. API Description
API feature: Create a new environment under a purchased Platform Edition package
API declaration: app.platform.createPlatformEnv(params): Promise<Object>
This API has been supported since v5.8.8.
The Platform Edition is an account-level package. No PackageId is required when creating an environment; environment resources are metered and deducted from the Platform Edition package uniformly. ReqKey is an idempotency key used to prevent duplicate creation.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| Alias | Yes | String | Environment alias, used to distinguish environments |
| PlatformId | Yes | String | Platform Edition package ID, can be obtained via describePlatforms |
| ReqKey | Yes | String | Idempotency key used to prevent duplicate creation |
3. Return Results
| Field | Type | Description |
|---|---|---|
| EnvId | String | ID of the newly created environment |
| RequestId | String | Unique identifier of the request |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.createPlatformEnv({
Alias: 'user-001',
PlatformId: 'your-platform-id',
ReqKey: 'create-user-001-20260920'
})
console.log(res.EnvId)
}
test()
modifyPlatformEnv
1. API Description
API feature: Modify the status of a Platform Edition environment, supporting enabling/disabling the environment as well as status changes of Cloud Storage (Storage) and FlexDB (document database) resources; resources not passed in will not be updated
API declaration: app.platform.modifyPlatformEnv(params): Promise<Object>
This API has been supported since v5.8.8.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | No | String | Environment ID. If not specified, the current environment is used |
| Status | No | String | Environment status: ENABLE / DISABLE |
| Storage | No | PlatformEnvResource | Cloud Storage resource status change |
| FlexDB | No | PlatformEnvResource | FlexDB (document database) resource status change |
PlatformEnvResource
| Field | Required | Type | Description |
|---|---|---|---|
| Status | No | String | Resource status: ENABLE (normal) / DISABLE (fully disabled) / READONLY (read-only). If not specified, no update is made |
3. Return Results
| Field | Type | Description |
|---|---|---|
| Status | String | Final status of the environment, such as manualLimited |
| RequestId | String | Unique identifier of the request |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
// Disable the specified environment
const res = await app.platform.modifyPlatformEnv({
EnvId: 'your-env-id',
Status: 'DISABLE'
})
console.log(res.Status)
}
test()
describeBaasPackageList
1. API Description
API feature: Query the CloudBase package list, used to obtain optional packages before create/modify/renew.
API declaration: app.env.describeBaasPackageList(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PackageName | No | String | Package ID. If not filled, all data will be returned. |
| EnvId | No | String | Environment ID |
| Source | No | String | Package owner. Valid values: miniapp / qcloud. Default: miniapp |
| TargetAction | No | String | Purpose: new (new purchase) / modify (modification) / renew (renewal) |
| GroupName | No | String | Package group: calculation / flux / capacity |
| InternationalPackage | No | Boolean | Whether to query international edition packages |
3. Return Results
| Field | Type | Description |
|---|---|---|
| PackageList | BaasPackageInfo[] | Package List |
| RequestId | String | Unique identifier of the request |
describePlatformPackageList
1. API Description
API feature: Query the list of Platform Edition packages on sale, used to query optional packages before purchase; does not involve purchased resources
API declaration: app.platform.describePlatformPackageList(params?): Promise<Object>
This API has been supported since v5.8.8.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PackageId | No | String | Platform Edition package ID. If not specified, all packages are returned |
3. Return Results
| Field | Type | Description |
|---|---|---|
| PackageList | PlatformPackageInfo[] | List of Platform Edition packages on sale |
| RequestId | String | Unique identifier of the request |
PlatformPackageInfo
| Field | Type | Description |
|---|---|---|
| PackageId | String | Package ID |
| Name | String | Package name |
| BillTags | String | Billing order parameters (JSON string) |
| Spec | String | Package specification (JSON string) |
| Description | String | Package description |
| Id | Number | Numeric package ID |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformPackageList()
res.PackageList.forEach(pkg => {
console.log(pkg.PackageId, pkg.Name)
})
}
test()
describePlatforms
1. API Description
API feature: Query the list of purchased Platform Edition resource instances under the current account, returning billing information and details of underlying resources such as storage, logs, and static hosting
API declaration: app.platform.describePlatforms(params?): Promise<Object>
This API has been supported since v5.8.8.
The PlatformId required by createPlatformEnv can be obtained via this API.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PlatformIds | No | String[] | List of Platform Edition package IDs. If not specified, all Platform Edition resources under the account are returned with pagination |
| Limit | No | Number | Page size, ranging from 10 to 100, default 10 |
| Offset | No | Number | Pagination offset, default 0 |
3. Return Results
| Field | Type | Description |
|---|---|---|
| PlatformList | PlatformInfo[] | Platform Edition resource list |
| Total | Number | Total count |
| RequestId | String | Unique identifier of the request |
PlatformInfo
| Field | Type | Description |
|---|---|---|
| PlatformId | String | Platform Edition package ID |
| Alias | String | Package alias |
| PackageId | String | Package ID |
| BillStatus | String | Billing status: normal / isolated / destroyed |
| Status | Number | Package resource status: 0 (available) / 5 (provisioning) |
| Spec | String | Resource configuration (JSON string) |
| BillTime | String | Purchase time, format YYYY-MM-DD HH:mm:ss |
| ExpireTime | String | Package expiration time, format YYYY-MM-DD HH:mm:ss |
| IsAutoRenew | Number | Auto-renewal setting: 0 (not set) / 1 (auto-renewal) / 2 (no renewal upon expiration) |
| Resources | PlatFormResourceInfo[] | Resource information list |
| Region | String | Region, such as ap-shanghai (Shanghai) / ap-singapore (Singapore) |
PlatFormResourceInfo
| Field | Type | Description |
|---|---|---|
| ResType | String | Resource type: log (logs) / storage (Cloud Storage) / hosting (Static Hosting) |
| ResName | String | Unique resource identifier |
| Detail | String | Resource details (JSON string) |
| Status | Number | Resource status: 0 (normal) / 5 (initializing) |
| PlatformId | Number | Resource ID |
| Id | Number | Corresponding platform resource ID |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatforms({ Limit: 20 })
console.log('Total Platform Edition resources:', res.Total)
res.PlatformList.forEach(p => {
console.log(p.PlatformId, p.Alias, p.BillStatus)
})
}
test()
modifyEnvPlan
1. API Description
API feature: Modify the package of the specified environment (upgrade/downgrade)
API declaration: app.env.modifyEnvPlan(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| PackageId | Required | String | Target Package ID |
| AutoVoucher | No | Boolean | whether to automatically use vouchers |
3. Return Results
| Field | Type | Description |
|---|---|---|
| RequestId | String | Unique identifier of the request |
renewEnv
1. API Description
API feature: renew the specified environment
API declaration: app.env.renewEnv(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| Period | No | Number | Renewal duration (months), default is 1 |
| AutoVoucher | No | Boolean | whether to automatically use vouchers |
3. Return Results
| Field | Type | Description |
|---|---|---|
| RequestId | String | Unique identifier of the request |
calculatePackageCreatePrice
1. API Description
API feature: Calculate the estimated price for a new purchase package.
API declaration: app.env.calculatePackageCreatePrice(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| packageId | Required | String | Package ID |
| region | Required | String | Region, such as ap-shanghai |
| period | No | Number | Subscription duration (months) |
| currency | No | String | Currency: CNY or USD |
3. Return Results
Returns the result of the price calculation, including fields such as the original price and discounted price.
calculatePackageRenewPrice
1. API Description
API feature: Calculate the estimated price for a renewal package.
API declaration: app.env.calculatePackageRenewPrice(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| envId | Required | String | Environment ID |
| period | No | Number | Renewal duration (months) |
| currency | No | String | Currency: CNY or USD |
3. Return Results
Returns the result of the price calculation, including fields such as the original price and discounted price.
calculatePackageModifyPrice
1. API Description
API feature: Calculate the estimated price for a change package.
API declaration: app.env.calculatePackageModifyPrice(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| envId | Required | String | Environment ID |
| packageId | Required | String | Target Package ID |
| currency | No | String | Currency: CNY or USD |
3. Return Results
Returns the result of the price calculation, including fields such as the original price and discounted price.
describeBillingInfo
1. API Description
API feature: query the billing information of the specified environment
API declaration: app.env.describeBillingInfo(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | No | String | Environment ID. If not passed, environments under the account are queried. |
| Limit | No | Number | Number of items per page |
| Offset | No | Number | Pagination offset |
3. Return Results
Returns the billing details of the environment (including package, expiration time, billing status, etc., with specific structure subject to backend implementation).
When paginating, the returned Total may not match the number of items that can actually be paged through. Determine whether there is a next page by checking whether the number of items returned on the current page reaches Limit.
describeEnvAccountCircle
1. API Description
API feature: query the billing cycle information of the environment (current and historical cycles)
API declaration: app.env.describeEnvAccountCircle(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| WxAppId | No | String | WeChat AppId |
| WithHistoryCircle | No | Boolean | Whether to return the previous and the one before the previous billing cycle, default false |
3. Return Results
| Field | Type | Description |
|---|---|---|
| StartTime | String | current billing cycle start time |
| EndTime | String | current billing cycle end time |
| HistoryTime | Array | Historical cycle list (including start/end times) |
| RequestId | String | Unique identifier of the request |
describePlatformAccountCircle
1. API Description
API feature: Query the current billing cycle of Platform Edition resources
API declaration: app.platform.describePlatformAccountCircle(params): Promise<Object>
This API has been supported since v5.8.8.
Platform Edition resource points are settled monthly, and the billing cycle starts from the purchase date, with a deduction quota for each cycle. For example, purchasing 3 months on 2026-01-05 (expiring on 2026-04-05) results in three cycles: 01-05 ~ 02-05, 02-06 ~ 03-05, and 03-06 ~ 04-05.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PlatformId | Yes | String | Platform Edition package ID |
| WithHistoryCircle | No | Boolean | Whether to return the last two historical cycles, default false |
3. Return Results
| Field | Type | Description |
|---|---|---|
| StartTime | String | Current billing cycle start time |
| EndTime | String | Current billing cycle end time |
| HistoryTime | CircleTime[] | Historical cycle list, in order of the previous and the one before the previous cycle |
| Expired | Boolean | Whether the package is currently expired |
| RequestId | String | Unique identifier of the request |
CircleTime
| Field | Type | Description |
|---|---|---|
| StartTime | String | Cycle start time |
| EndTime | String | Cycle end time |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformAccountCircle({
PlatformId: 'your-platform-id',
WithHistoryCircle: true
})
console.log('Current cycle:', res.StartTime, '~', res.EndTime)
}
test()
describeCreditsUsageDetail
1. API Description
API feature: query the usage details of environment resource points, supports filtering by module and date.
API declaration: app.env.describeCreditsUsageDetail(params): Promise<Object>
This API has been supported since v5.0.0.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | Yes | String | Environment ID |
| Modules | Yes | String[] | Module list, optional: EKS / Database / SCF / COS / AI / HOSTING / Auth / Other |
| StartDate | Yes | String | Start date, format: YYYY-MM-DD |
| EndDate | Yes | String | End date, format: YYYY-MM-DD |
| NeedUsageDetails | Yes | Boolean | whether to return daily usage details |
3. Return Results
Returns the usage details of resource points for each module (specific structure subject to backend implementation).
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.env.describeCreditsUsageDetail({
EnvId: 'your-env-id',
Modules: ['SCF', 'Database', 'COS'],
StartDate: '2025-01-01',
EndDate: '2025-01-31',
NeedUsageDetails: true
})
console.log(JSON.stringify(res, null, 2))
}
test()
describePlatformCreditsUsage
1. API Description
API feature: Query the aggregated resource point usage of Platform Edition resources
API declaration: app.platform.describePlatformCreditsUsage(params): Promise<Object>
This API has been supported since v5.8.8.
Returns the resource point usage statistics within the specified time range, including four types of totals (in-package deduction, resource package deduction, pay-as-you-go reporting, and original price consumption) as well as daily details.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PlatformId | Yes | String | Platform Edition package ID |
| StartDate | Yes | String | Start date, format YYYY-MM-DD |
| EndDate | Yes | String | End date, format YYYY-MM-DD |
3. Return Results
| Field | Type | Description |
|---|---|---|
| DeductValueCount | Number | Total in-package deduction of resource points |
| PackageDeductValueCount | Number | Total resource package deduction of resource points |
| ReportValueCount | Number | Total pay-as-you-go reported resource points |
| OriginCreditsCount | Number | Total original price consumption of resource points |
| DailyList | PlatformCreditsUsageDaily[] | Daily resource point usage list |
| RequestId | String | Unique identifier of the request |
PlatformCreditsUsageDaily
| Field | Type | Description |
|---|---|---|
| Date | String | Date |
| DeductValue | Number | In-package usage of resource points |
| PackageDeductValue | Number | Resource package usage of resource points |
| ReportValue | Number | Pay-as-you-go usage of resource points |
| OriginCredits | Number | Original price consumption of resource points |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformCreditsUsage({
PlatformId: 'your-platform-id',
StartDate: '2026-09-01',
EndDate: '2026-09-20'
})
console.log('Total in-package deduction:', res.DeductValueCount)
}
test()
describePlatformCreditsUsageDetail
1. API Description
API feature: Query the resource point usage details of Platform Edition resources
API declaration: app.platform.describePlatformCreditsUsageDetail(params): Promise<Object>
This API has been supported since v5.8.8.
Returns the resource point usage and raw usage details of each module in a three-level hierarchy: modules (Usages) → metrics (MetricUsageDetail) → daily details (ValueDetailList).
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PlatformId | Yes | String | Platform Edition package ID |
| Modules | Yes | String[] | Module list, see the enumeration below |
| StartDate | Yes | String | Start date, format YYYY-MM-DD |
| EndDate | Yes | String | End date, format YYYY-MM-DD |
| NeedUsageDetails | Yes | Boolean | Whether to return daily usage details |
Valid values for Modules: FLEXDB (document database), TDSQL (MySQL database), SCF (Cloud Function), AI (large model), EKS (CloudBase Run), COS (Cloud Storage), HOSTING (Static Hosting), Auth (user permissions), APIInvocation (API invocation), HTTPInvocation (HTTP invocation), VM (host), Workflow (workflow), PostgreSQL, Token, Other
3. Return Results
| Field | Type | Description |
|---|---|---|
| Usages | PlatformPkgCreditsUsage[] | Usage data of each module |
| RequestId | String | Unique identifier of the request |
PlatformPkgCreditsUsage
| Field | Type | Description |
|---|---|---|
| PlatformId | String | Platform Edition package ID |
| Module | String | Module |
| CreditsValue | Number | Total resource point usage of the module |
| MetricUsageDetail | MetricUsage[] | Metric usage details |
| DeductValue | Number | In-package usage of resource points |
| PackageDeductValue | Number | Resource package usage of resource points |
| ReportValue | Number | Pay-as-you-go usage of resource points |
| OriginCredits | Number | Original price consumption of resource points |
MetricUsage
| Field | Type | Description |
|---|---|---|
| MetricName | String | Metric name |
| ResourceType | String | Resource type |
| Value | Number | Raw resource usage |
| CreditsValue | Number | Resource point usage |
| BillingCycleType | String | Billing cycle type: hourly / daily |
| Unit | String | Unit of raw resource usage |
| ValueDetailList | ValueDetail[] | Daily details of raw resource usage |
| DeductValue | Number | In-package usage of resource points |
| PackageDeductValue | Number | Resource package usage of resource points |
| ReportValue | Number | Pay-as-you-go usage of resource points |
| OriginCredits | Number | Original price consumption of resource points |
ValueDetail
| Field | Type | Description |
|---|---|---|
| CalcTime | String | Time, format YYYY-MM-DD HH:mm:ss |
| RawValue | Number | Raw resource usage |
| CreditsValue | Number | Resource point usage |
| DeductValue | Number | In-package usage of resource points |
| PackageDeductValue | Number | Resource package usage of resource points |
| ReportValue | Number | Pay-as-you-go usage of resource points |
| OriginCredits | Number | Original price consumption of resource points |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformCreditsUsageDetail({
PlatformId: 'your-platform-id',
Modules: ['SCF', 'FLEXDB'],
StartDate: '2026-09-01',
EndDate: '2026-09-20',
NeedUsageDetails: true
})
res.Usages.forEach(u => {
console.log(u.Module, u.CreditsValue)
})
}
test()
describePlatformEnvCreditsRanking
1. API Description
API feature: Query the resource point usage ranking of environments under the Platform Edition
API declaration: app.platform.describePlatformEnvCreditsRanking(params?): Promise<Object>
This API has been supported since v5.8.8.
Returns the resource point usage ranking of environments within the specified time range. Ranking data is calculated periodically by the backend and may have hour-level delay.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| PlatformId | No | String | Platform Edition package ID |
| TimeRange | No | String | Query time range, default Today |
| PageSize | No | Number | Page size, default 50 |
| AfterRank | No | Number | Pagination offset, pass the Rank of the last item on the previous page |
Valid values for TimeRange: Today (last 1 day), Recent7Days (last 7 days), CurrentCycle (current billing cycle), PreviousCycle (previous billing cycle), Previous2Cycle (two billing cycles ago)
3. Return Results
| Field | Type | Description |
|---|---|---|
| TimeRange | String | Query time range |
| StartTime | String | Start time, format YYYY-MM-DD HH:mm:ss |
| EndTime | String | End time, format YYYY-MM-DD HH:mm:ss |
| DataAsOfTime | String | Statistics cutoff time, format YYYY-MM-DD HH:mm:ss |
| HasMore | Boolean | Whether there is more data on the next page |
| NextAfterRank | Number | Pagination offset value for the next item |
| TotalCount | Number | Total count |
| CreditsScale | Number | Resource point precision |
| SnapshotId | String | Ranking snapshot version |
| Items | EnvCreditsRank[] | Environment ranking list |
| RequestId | String | Unique identifier of the request |
EnvCreditsRank
| Field | Type | Description |
|---|---|---|
| EnvId | String | Environment ID |
| TotalCredits | Number | Total resource point usage |
| Rank | Number | Ranking number |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformEnvCreditsRanking({
PlatformId: 'your-platform-id',
TimeRange: 'Recent7Days'
})
res.Items?.forEach(item => {
console.log(item.Rank, item.EnvId, item.TotalCredits)
})
}
test()
describePlatformEnvUsage
1. API Description
API feature: Query the usage of each resource type within a Platform Edition environment
API declaration: app.platform.describePlatformEnvUsage(params): Promise<Object>
This API has been supported since v5.8.8.
Returns the usage of each metric by resource type (storage, functions, databases, etc.) with daily details, including resource point usage and raw usage values with their corresponding units.
2. Input Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| EnvId | No | String | Environment ID. If not specified, the current environment is used |
| StartDate | No | String | Query start date, format YYYY-MM-DD |
| EndDate | No | String | Query end date, format YYYY-MM-DD |
| ResourceTypes | No | String[] | Resource type list, see the enumeration below |
| NeedUsageDetails | No | Boolean | Whether to show usage details |
Valid values for ResourceTypes: Storage (Cloud Storage), Function (Cloud Function), Database, HOSTING (Static Hosting), Log (logs), Gateway, Cloudrun (CloudBase Run), Token, EO (EdgeOne)
3. Return Results
| Field | Type | Description |
|---|---|---|
| Resources | PlatformResUsageItem[] | Resource usage information |
| TotalCredits | Number | Total resource points |
| CreditsScale | Number | Resource point rounding factor |
| RequestId | String | Unique identifier of the request |
PlatformResUsageItem
| Field | Type | Description |
|---|---|---|
| ResourceType | String | Resource type |
| TotalCredits | Number | Total resource points of this resource type |
| Metrics | PlatformMetricUsageItem[] | Metric usage information |
PlatformMetricUsageItem
| Field | Type | Description |
|---|---|---|
| MetricName | String | Metric name |
| OriginalResourceType | String | Original resource type |
| OriginalMetricName | String | Original metric name |
| UsageValue | Number | Resource usage |
| UsageUnit | String | Resource usage unit, such as MB, Count |
| Credits | Number | Resource point usage |
| DailyUsageList | DailyUsageList[] | Daily usage detail list |
DailyUsageList
| Field | Type | Description |
|---|---|---|
| Date | String | Date, format YYYY-MM-DD |
| Credits | Number | Resource point usage |
| UsageValue | Number | Raw resource usage |
4. Sample Code
const CloudBase = require('@cloudbase/manager-node')
const app = new CloudBase({ secretId: 'Your SecretId', secretKey: 'Your SecretKey', envId: 'your-env-id' })
async function test() {
const res = await app.platform.describePlatformEnvUsage({
EnvId: 'your-env-id',
StartDate: '2026-09-01',
EndDate: '2026-09-20',
ResourceTypes: ['Storage', 'Function']
})
console.log('Total resource points:', res.TotalCredits)
res.Resources?.forEach(r => {
console.log(r.ResourceType, r.TotalCredits)
})
}
test()