All Products
Search
Document Center

Expenses and Costs:SubscribeBillToOSS

Last Updated:Oct 28, 2025

Subscribes to bill files and stores the bill data in a specified Object Storage Service (OSS) bucket.

Operation description

Note the following when you call this operation:

  • You can subscribe to only one type of bill file at a time.

  • After you subscribe, the system starts to push the previous day's bill file daily. On the fourth day of each month, the system pushes the full bill file for the previous billing cycle. The monthly bill in PDF format for the previous month is also pushed on the fourth day of each month.

  • The generation of daily bill files may be delayed. A delayed bill file is pushed on the following day. This file may also include bill data that was delayed from the previous day. Pull the full data for the previous month at the beginning of each month.

Note

The first time you subscribe to bills using OSS, you must grant the AliyunConsumeDump2OSSRole permission to the subscriber. If the authorization is revoked, the system stops pushing files. You must grant the permission again.

  • This subscription is equivalent to the "Data Storage" feature in the Expenses and Costs console. The subscriptions are synchronized.

  • When you subscribe to a folder in a bucket, make sure that the folder name meets the following requirements:

    • Do not use emojis. Use valid UTF-8 characters.

    • Use a forward slash (/) to separate paths and create subdirectories. Do not start a name with a forward slash (/) or a backslash (\). Do not use consecutive forward slashes (/).

    • Do not name a subdirectory "..".

    • The total length must be 1 to 254 characters.

  • File names:

    • BillingItemDetailForBillingPeriod (Bill details by billing item)

      • Format of daily pushed files: UID_BillingItemDetail_YYYYMMDD. Example: 169**_BillingItemDetail_20190310.

      • Format of full files at the beginning of the next month: UID_BillingItemDetail_YYYYMM. Example: 169**_BillingItemDetail_201903.

    • InstanceDetailForBillingPeriod (Bill details by instance)

      • Format of daily pushed files: UID_InstanceDetail_YYYYMMDD. Example: 169**_InstanceDetail_20190310.

      • Format of full files at the beginning of the next month: UID_InstanceDetail_YYYYMM. Example: 169**_InstanceDetail_201903.

    • InstanceDetailMonthly (Monthly bill summary by instance)

      • Format of daily pushed files: UID_InstanceDetailMonthly_YYYYMM. Example: 169**_InstanceDetailMonthly_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.

    • BillingItemDetailMonthly (Monthly bill summary by billing item)

      • Format of daily pushed files: UID_BillingItemDetailMonthly_YYYYMM. Example: 169**_BillingItemDetailMonthly_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.

    • SplitItemDetailDaily (Daily summary of split bills)

      • Format of daily pushed files: UID_SplitItemDetailDaily_YYYYMM. Example: 169**_SplitItemDetailDaily_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.

    • MonthBill (Monthly bill in PDF)

      • Format of monthly pushed files: UID_MonthBill_YYYYMM. Example: 169**_MonthBill_201903. The bill file for the previous month is pushed on the fourth day of each month.

  • Except for MonthBill files, which are in PDF format, all other files are in CSV format. If the number of data rows in a bill exceeds a specific threshold, the bill is split into multiple CSV files. These files are then merged and compressed into a ZIP file. The ZIP file uses the same file name format.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

bss:ModifySubscribeToOSS

create

*All Resource

*

None

None

Request parameters

Parameter

Type

Required

Description

Example

SubscribeBucket

string

Yes

The name of the OSS bucket where the subscribed bill files are stored.

xxxxxx-bucket

SubscribeType

string

No

The subscription type. Valid values:

  • BillingItemDetailForBillingPeriod: bill details by billing item.

  • InstanceDetailForBillingPeriod: bill details by instance.

  • BillingItemDetailMonthly: monthly bill summary by billing item.

  • InstanceDetailMonthly: monthly bill summary by instance.

  • SplitItemDetailDaily: daily summary of split bills.

  • MonthBill: monthly bill in PDF format. You can subscribe to monthly bills only for an Alibaba Cloud account.

BillingItemDetailForBillingPeriod

MultAccountRelSubscribe

string

No

The type of bill to which you want to subscribe. This parameter is available only for multi-tier accounts. Valid values:

  • MA: Pushes the bills of the Alibaba Cloud account and the bills of non-trusteeship linked accounts.

  • ACP1: Pushes the bills of sub-accounts of a virtual dealer.

Default: MA.

MA

BucketOwnerId

integer

No

The UID of the OSS bucket owner. This parameter is required only when a distributor subscribes to bills and saves them to an OSS bucket of a sub-account. In this case, the sub-account must be a sub-account of the distributor's account and granted the AliyunConsumeDump2OSSRole permission. Regular users do not need to specify this parameter. By default, the UID of the current account is used.

12341324

BeginBillingCycle

string

No

The initial billing cycle from which bills are pushed. After you subscribe to the bills, the system automatically pushes the data from the initial billing cycle to the current time. This parameter is invalid for monthly bill subscriptions in PDF format. Historical data is not repushed. You can push data generated within the last year.

2021-03

BucketPath

string

No

The specified folder in the bucket to which you subscribe.

testpath

RowLimitPerFile

integer

No

The maximum number of rows in a single file. If a bill file exceeds this limit, it is split into multiple files. The files are then merged and compressed into a ZIP package.

300000

UsingSsl

string

No

Specifies whether to use Secure Sockets Layer (SSL) to protect network communications. Valid values:

  • true: Enables SSL encryption to ensure data security and integrity during transmission.

  • false (default): Disables SSL encryption.

true

Response elements

Parameter

Type

Description

Example

object

Code

string

The status code.

Success

Message

string

The error message.

Successful!

RequestId

string

The request ID.

F61FCE4B-9B56-4FD9-A17E-******

Success

boolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

{ "Code": "Success", "Message": "Successful!", "RequestId": "F61FCE4B-9B56-4FD9-A17E-******", "Success": true }

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.