Skip to main content

Environment Management

Platform Edition APIs

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​

FieldRequiredTypeDescription
RequestIdRequiredStringUnique identifier of the request
EnvListYesArray<EnvItem>Environment array

EnvItem​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
SourceYesStringSource. miniapp / qcloud
AliasYesStringEnvironment alias
StatusYesStringStatus. NORMAL / UNAVAILABLE
CreateTimeYesStringCreation time
UpdateTimeYesStringUpdate time
RegionYesStringRegion, e.g. ap-shanghai
PackageIdYesStringPackage ID
PackageNameYesStringPackage name
PackageTypeNoStringPackage type. empty / baas / tcbr
EnvTypeNoStringEnvironment type. baas / run / hosting / weda
PayModeNoStringPayment mode. prepayment / postpaid
IsAutoDegradeNoBooleanWhether to auto-degrade to free plan when expiring
IsDefaultNoBooleanWhether it is the default environment
EnvChannelNoStringEnvironment channel
DatabasesNoArrayDatabase resource details
StoragesNoArrayStorage resource details
FunctionsNoArrayFunction resource details
LogServicesNoArrayLog resource details
StaticStoragesNoStaticStorageInfo[]Static hosting info (including CDN domain)
TagsNoArray<{Key, Value}>Environment tags
EnvPreferencesNoRecord<string, any>Environment preferences

StaticStorageInfo​

Static CDN resource information.

FieldTypeDescription
StaticDomainStringStatic hosting CDN domain, e.g. xxx.tcloudbaseapp.com
DefaultDirNameStringStatic CDN default directory (root)
StatusStringStatus. process / online / offline / init
RegionStringCOS 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​

FieldRequiredTypeDescription
DomainsRequiredArray<Domain>List of domains
envIdRequiredStringEnvironment ID

Domain

FieldRequiredTypeDescription
IdRequiredStringDomain ID
DomainRequiredStringDomain
TypeRequiredStringDomain type. Valid values include: system, user
StatusRequiredStringStatus. Valid values include: ENABLE, DISABLE
CreateTimeRequiredStringCreation time
UpdateTimeRequiredStringUpdate 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​

FieldRequiredTypeDescription
domainsRequiredArray<String>Array of secure domains

3. Return Results​

FieldTypeDescription
RequestIdStringRequest 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​

FieldRequiredTypeDescription
domainsRequiredArray<String>Array of secure domains

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest ID
DeletedRequiredNumberNumber 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​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest ID
EnvInfoYesEnvItemEnvironment 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​

FieldRequiredTypeDescription
aliasYesStringEnvironment alias

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest 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​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest ID
ConfigListRequiredArray<ConfigItem>Login configuration list

ConfigItem​

FieldRequiredTypeDescription
IdRequiredStringConfiguration ID
PlatformRequiredStringPlatform type
PlatformIdRequiredStringPlatform ID
StatusRequiredStringConfiguration status
UpdateTimeRequiredStringConfiguration update time
CreateTimeRequiredStringConfiguration 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​

FieldRequiredTypeDescription
platformRequiredStringPlatform "WECHAT-OPEN", "WECHAT-PUBLIC", "QQ", "ANONYMOUS"
appIdRequiredStringThird-party platform AppID. Note: For anonymous login (platform: ANONYMOUS), enter "anonymous" for appId.
appSecretNoStringThird-party platform AppSecret. Note: For anonymous login (platform: ANONYMOUS), appSecret can be omitted.

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest 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​

FieldRequiredTypeDescription
configIdRequiredStringConfiguration record ID
statusRequiredString"ENABLE", "DISABLE"
appIdRequiredStringThird-party platform AppId. For anonymous login, enter "anonymous" for appId.
appSecretNoStringThird-party platform AppSecret. If anonymous login, this field can be omitted.

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest 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​

FieldRequiredTypeDescription
DealTypeRequiredStringOrder operation type. Valid values: purchase (purchase), renew (renewal), modify (specification change)
ProductTypeRequiredStringProduct type purchased. Valid values: tcb-baas (baas package), tcb-promotion (promotion package), tcb-package (resource package)
PackageIdRequiredStringID of the target product/package to be ordered
CreateAndPayNoBooleanwhether to pay automatically
TimeSpanNoNumberSubscription duration
TimeUnitNoStringSubscription duration unit. Valid values: d (day), m (month), y (year), p (one-time)
ResourceIdNoStringUnique identifier of the resource
SourceNoStringSource. Valid values: qcloud, miniapp
AliasNoStringResource alias
EnvIdNoStringEnvironment ID
EnableExcessNoBooleanWhether to enable excess limit pay-as-you-go
ModifyPackageIdNoStringID of the target product/package for modification
ExtensionNoStringExtension information (JSON string)
AutoVoucherNoBooleanwhether to automatically use vouchers for payment
ResourceTypesNoString[]Resource type. Resources to be provisioned when purchasing a new environment. Valid values: flexdb, cos, cdn, scf

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest ID
EnvIdYesStringEnvironment ID
TranIdRequiredStringOrder 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​

FieldRequiredTypeDescription
TranIdRequiredStringOrder transaction ID
UserClientIpRequiredStringUser client IP
WxAppIdNoStringWeChat AppId (optional)

3. Return Results​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest 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​

FieldRequiredTypeDescription
RequestIdRequiredStringRequest ID
KeyIDYesStringKey ID
PrivateKeyYesStringPrivate 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
IsForceNoBooleanWhether to force deletion (for environments in prepaid isolation), default false
BypassCheckNoBooleanwhether to bypass resource data checks and delete directly, default false

3. Return Results​

FieldTypeDescription
RequestIdStringUnique 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>

version tip

This API has been supported since v5.8.8.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID

3. Return Results​

FieldTypeDescription
RequestIdStringUnique 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdNoStringFilter by Environment ID
WxAppIdNoStringWeChat AppId (required for WeChat channel)
IsVisibleNoBooleanUsed in conjunction with Channels to control the filtering direction for visible/invisible channels
ChannelsNoString[]Channel list, such as ["ide","qc_console"]
EnvTypeNoStringEnvironment type: baas / run / weda / hosting
EnvTypesNoString[]List of environment types (takes precedence over EnvType)
LimitNoNumberPage size
OffsetNoNumberPagination offset

3. Return Results​

FieldTypeDescription
EnvListArrayEnvironment list
RequestIdStringUnique 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
AliasRequiredStringEnvironment alias, consisting of lowercase letters/digits/hyphens, cannot start or end with a hyphen, with a maximum length of 20 characters
PackageIdRequiredStringPackage ID, can be obtained via describeBaasPackageList
ResourcesRequiredString[]Resources to be provisioned: flexdb / storage / function
PeriodNoNumberSubscription duration (months), default is 1
AutoVoucherNoBooleanwhether to automatically use vouchers
RenewFlagNoStringRenewal policy: NOTIFY_AND_AUTO_RENEW / NOTIFY_AND_MANUAL_RENEW
ExternalStorageNoExternalStorageUse 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​

FieldRequiredTypeDescription
EnabledNoBooleanWhether to enable external storage. Passing true explicitly is recommended
BucketNameRequiredStringName of the shared bucket
RegionRequiredStringRegion of the shared bucket, for example ap-shanghai
BasePathRequiredStringDirectory 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​

FieldTypeDescription
EnvIdStringID of the newly created environment
RequestIdStringUnique 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>

version tip

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​

FieldRequiredTypeDescription
AliasYesStringEnvironment alias, used to distinguish environments
PlatformIdYesStringPlatform Edition package ID, can be obtained via describePlatforms
ReqKeyYesStringIdempotency key used to prevent duplicate creation

3. Return Results​

FieldTypeDescription
EnvIdStringID of the newly created environment
RequestIdStringUnique 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>

version tip

This API has been supported since v5.8.8.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdNoStringEnvironment ID. If not specified, the current environment is used
StatusNoStringEnvironment status: ENABLE / DISABLE
StorageNoPlatformEnvResourceCloud Storage resource status change
FlexDBNoPlatformEnvResourceFlexDB (document database) resource status change

PlatformEnvResource​

FieldRequiredTypeDescription
StatusNoStringResource status: ENABLE (normal) / DISABLE (fully disabled) / READONLY (read-only). If not specified, no update is made

3. Return Results​

FieldTypeDescription
StatusStringFinal status of the environment, such as manualLimited
RequestIdStringUnique 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
PackageNameNoStringPackage ID. If not filled, all data will be returned.
EnvIdNoStringEnvironment ID
SourceNoStringPackage owner. Valid values: miniapp / qcloud. Default: miniapp
TargetActionNoStringPurpose: new (new purchase) / modify (modification) / renew (renewal)
GroupNameNoStringPackage group: calculation / flux / capacity
InternationalPackageNoBooleanWhether to query international edition packages

3. Return Results​

FieldTypeDescription
PackageListBaasPackageInfo[]Package List
RequestIdStringUnique 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>

version tip

This API has been supported since v5.8.8.

2. Input Parameters​

FieldRequiredTypeDescription
PackageIdNoStringPlatform Edition package ID. If not specified, all packages are returned

3. Return Results​

FieldTypeDescription
PackageListPlatformPackageInfo[]List of Platform Edition packages on sale
RequestIdStringUnique identifier of the request

PlatformPackageInfo​

FieldTypeDescription
PackageIdStringPackage ID
NameStringPackage name
BillTagsStringBilling order parameters (JSON string)
SpecStringPackage specification (JSON string)
DescriptionStringPackage description
IdNumberNumeric 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>

version tip

This API has been supported since v5.8.8.

The PlatformId required by createPlatformEnv can be obtained via this API.

2. Input Parameters​

FieldRequiredTypeDescription
PlatformIdsNoString[]List of Platform Edition package IDs. If not specified, all Platform Edition resources under the account are returned with pagination
LimitNoNumberPage size, ranging from 10 to 100, default 10
OffsetNoNumberPagination offset, default 0

3. Return Results​

FieldTypeDescription
PlatformListPlatformInfo[]Platform Edition resource list
TotalNumberTotal count
RequestIdStringUnique identifier of the request

PlatformInfo​

FieldTypeDescription
PlatformIdStringPlatform Edition package ID
AliasStringPackage alias
PackageIdStringPackage ID
BillStatusStringBilling status: normal / isolated / destroyed
StatusNumberPackage resource status: 0 (available) / 5 (provisioning)
SpecStringResource configuration (JSON string)
BillTimeStringPurchase time, format YYYY-MM-DD HH:mm:ss
ExpireTimeStringPackage expiration time, format YYYY-MM-DD HH:mm:ss
IsAutoRenewNumberAuto-renewal setting: 0 (not set) / 1 (auto-renewal) / 2 (no renewal upon expiration)
ResourcesPlatFormResourceInfo[]Resource information list
RegionStringRegion, such as ap-shanghai (Shanghai) / ap-singapore (Singapore)

PlatFormResourceInfo​

FieldTypeDescription
ResTypeStringResource type: log (logs) / storage (Cloud Storage) / hosting (Static Hosting)
ResNameStringUnique resource identifier
DetailStringResource details (JSON string)
StatusNumberResource status: 0 (normal) / 5 (initializing)
PlatformIdNumberResource ID
IdNumberCorresponding 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
PackageIdRequiredStringTarget Package ID
AutoVoucherNoBooleanwhether to automatically use vouchers

3. Return Results​

FieldTypeDescription
RequestIdStringUnique identifier of the request

renewEnv​

1. API Description​

API feature: renew the specified environment

API declaration: app.env.renewEnv(params): Promise<Object>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
PeriodNoNumberRenewal duration (months), default is 1
AutoVoucherNoBooleanwhether to automatically use vouchers

3. Return Results​

FieldTypeDescription
RequestIdStringUnique 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
packageIdRequiredStringPackage ID
regionRequiredStringRegion, such as ap-shanghai
periodNoNumberSubscription duration (months)
currencyNoStringCurrency: 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
envIdRequiredStringEnvironment ID
periodNoNumberRenewal duration (months)
currencyNoStringCurrency: 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
envIdRequiredStringEnvironment ID
packageIdRequiredStringTarget Package ID
currencyNoStringCurrency: 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdNoStringEnvironment ID. If not passed, environments under the account are queried.
LimitNoNumberNumber of items per page
OffsetNoNumberPagination 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
WxAppIdNoStringWeChat AppId
WithHistoryCircleNoBooleanWhether to return the previous and the one before the previous billing cycle, default false

3. Return Results​

FieldTypeDescription
StartTimeStringcurrent billing cycle start time
EndTimeStringcurrent billing cycle end time
HistoryTimeArrayHistorical cycle list (including start/end times)
RequestIdStringUnique 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>

version tip

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​

FieldRequiredTypeDescription
PlatformIdYesStringPlatform Edition package ID
WithHistoryCircleNoBooleanWhether to return the last two historical cycles, default false

3. Return Results​

FieldTypeDescription
StartTimeStringCurrent billing cycle start time
EndTimeStringCurrent billing cycle end time
HistoryTimeCircleTime[]Historical cycle list, in order of the previous and the one before the previous cycle
ExpiredBooleanWhether the package is currently expired
RequestIdStringUnique identifier of the request

CircleTime​

FieldTypeDescription
StartTimeStringCycle start time
EndTimeStringCycle 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>

version tip

This API has been supported since v5.0.0.

2. Input Parameters​

FieldRequiredTypeDescription
EnvIdYesStringEnvironment ID
ModulesYesString[]Module list, optional: EKS / Database / SCF / COS / AI / HOSTING / Auth / Other
StartDateYesStringStart date, format: YYYY-MM-DD
EndDateYesStringEnd date, format: YYYY-MM-DD
NeedUsageDetailsYesBooleanwhether 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>

version tip

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​

FieldRequiredTypeDescription
PlatformIdYesStringPlatform Edition package ID
StartDateYesStringStart date, format YYYY-MM-DD
EndDateYesStringEnd date, format YYYY-MM-DD

3. Return Results​

FieldTypeDescription
DeductValueCountNumberTotal in-package deduction of resource points
PackageDeductValueCountNumberTotal resource package deduction of resource points
ReportValueCountNumberTotal pay-as-you-go reported resource points
OriginCreditsCountNumberTotal original price consumption of resource points
DailyListPlatformCreditsUsageDaily[]Daily resource point usage list
RequestIdStringUnique identifier of the request

PlatformCreditsUsageDaily​

FieldTypeDescription
DateStringDate
DeductValueNumberIn-package usage of resource points
PackageDeductValueNumberResource package usage of resource points
ReportValueNumberPay-as-you-go usage of resource points
OriginCreditsNumberOriginal 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>

version tip

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​

FieldRequiredTypeDescription
PlatformIdYesStringPlatform Edition package ID
ModulesYesString[]Module list, see the enumeration below
StartDateYesStringStart date, format YYYY-MM-DD
EndDateYesStringEnd date, format YYYY-MM-DD
NeedUsageDetailsYesBooleanWhether 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​

FieldTypeDescription
UsagesPlatformPkgCreditsUsage[]Usage data of each module
RequestIdStringUnique identifier of the request

PlatformPkgCreditsUsage​

FieldTypeDescription
PlatformIdStringPlatform Edition package ID
ModuleStringModule
CreditsValueNumberTotal resource point usage of the module
MetricUsageDetailMetricUsage[]Metric usage details
DeductValueNumberIn-package usage of resource points
PackageDeductValueNumberResource package usage of resource points
ReportValueNumberPay-as-you-go usage of resource points
OriginCreditsNumberOriginal price consumption of resource points

MetricUsage​

FieldTypeDescription
MetricNameStringMetric name
ResourceTypeStringResource type
ValueNumberRaw resource usage
CreditsValueNumberResource point usage
BillingCycleTypeStringBilling cycle type: hourly / daily
UnitStringUnit of raw resource usage
ValueDetailListValueDetail[]Daily details of raw resource usage
DeductValueNumberIn-package usage of resource points
PackageDeductValueNumberResource package usage of resource points
ReportValueNumberPay-as-you-go usage of resource points
OriginCreditsNumberOriginal price consumption of resource points

ValueDetail​

FieldTypeDescription
CalcTimeStringTime, format YYYY-MM-DD HH:mm:ss
RawValueNumberRaw resource usage
CreditsValueNumberResource point usage
DeductValueNumberIn-package usage of resource points
PackageDeductValueNumberResource package usage of resource points
ReportValueNumberPay-as-you-go usage of resource points
OriginCreditsNumberOriginal 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>

version tip

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​

FieldRequiredTypeDescription
PlatformIdNoStringPlatform Edition package ID
TimeRangeNoStringQuery time range, default Today
PageSizeNoNumberPage size, default 50
AfterRankNoNumberPagination 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​

FieldTypeDescription
TimeRangeStringQuery time range
StartTimeStringStart time, format YYYY-MM-DD HH:mm:ss
EndTimeStringEnd time, format YYYY-MM-DD HH:mm:ss
DataAsOfTimeStringStatistics cutoff time, format YYYY-MM-DD HH:mm:ss
HasMoreBooleanWhether there is more data on the next page
NextAfterRankNumberPagination offset value for the next item
TotalCountNumberTotal count
CreditsScaleNumberResource point precision
SnapshotIdStringRanking snapshot version
ItemsEnvCreditsRank[]Environment ranking list
RequestIdStringUnique identifier of the request

EnvCreditsRank​

FieldTypeDescription
EnvIdStringEnvironment ID
TotalCreditsNumberTotal resource point usage
RankNumberRanking 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>

version tip

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​

FieldRequiredTypeDescription
EnvIdNoStringEnvironment ID. If not specified, the current environment is used
StartDateNoStringQuery start date, format YYYY-MM-DD
EndDateNoStringQuery end date, format YYYY-MM-DD
ResourceTypesNoString[]Resource type list, see the enumeration below
NeedUsageDetailsNoBooleanWhether 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​

FieldTypeDescription
ResourcesPlatformResUsageItem[]Resource usage information
TotalCreditsNumberTotal resource points
CreditsScaleNumberResource point rounding factor
RequestIdStringUnique identifier of the request

PlatformResUsageItem​

FieldTypeDescription
ResourceTypeStringResource type
TotalCreditsNumberTotal resource points of this resource type
MetricsPlatformMetricUsageItem[]Metric usage information

PlatformMetricUsageItem​

FieldTypeDescription
MetricNameStringMetric name
OriginalResourceTypeStringOriginal resource type
OriginalMetricNameStringOriginal metric name
UsageValueNumberResource usage
UsageUnitStringResource usage unit, such as MB, Count
CreditsNumberResource point usage
DailyUsageListDailyUsageList[]Daily usage detail list

DailyUsageList​

FieldTypeDescription
DateStringDate, format YYYY-MM-DD
CreditsNumberResource point usage
UsageValueNumberRaw 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()