All Products
Search
Document Center

Expenses and Costs:SubscribeBillToOSS

Last Updated:Sep 10, 2026

Subscribes to bill files by using Object Storage Service (OSS), which stores billing data in a specified OSS bucket.

Operation description

Before calling this operation, note the following information:

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

  • After subscription, the bill file generated on the previous day is pushed daily starting from the next day. On the 4th of each month, the full bill files for the entire billing cycle of the previous month are pushed. The monthly bill PDF is pushed on the 4th of each month for the previous month.

  • Bill files generated on a daily basis may be delayed. Delayed bills are pushed the day after they are generated and may include bills from earlier days that were delayed until the previous day. Pull the full files for the previous month at the beginning of each month.

Note

To use OSS subscription for the first time, grant the AliyunConsumeDump2OSSRole permission to the subscribing user. If the authorization is revoked, the system stops pushing files, and the user must re-authorize.

  • This subscription is the same feature as "Bill Data Storage" in the Expenses and Costs console. Subscriptions are synchronized between the two.

  • When subscribing to a directory under a bucket, follow the directory naming conventions:

    • Emojis are not allowed. Use valid UTF-8 characters.

    • Use / to separate paths and quickly create subdirectories. Do not start with / or , and do not use consecutive / characters.

    • A subdirectory named .. is not allowed.

    • The total length must be 1 to 254 characters.

  • File names:

    • BillingItemDetailForBillingPeriod (billing item details)

      • Daily push file name format: UID_BillingItemDetail_YYYYMMDD, for example, 169**_BillingItemDetail_20190310.

      • Full file name format at the beginning of the next month: UID_BillingItemDetail_YYYYMM, for example, 169**_BillingItemDetail_201903.

    • InstanceDetailForBillingPeriod (instance bill details)

      • Daily push file name format: UID_InstanceDetail_YYYYMMDD, for example, 169**_InstanceDetail_20190310.

      • Full file name format at the beginning of the next month: UID_InstanceDetail_YYYYMM, for example, 169**_InstanceDetail_201903.

    • InstanceDetailMonthly (instance bill summary by billing cycle)

      • Daily push file name format: UID_InstanceDetailMonthly_YYYYMM, for example, 169**_InstanceDetailMonthly_201903. This file is updated daily with full data from the beginning of the month to the current day, until the 4th of the next month.

    • BillingItemDetailMonthly (billing item summary by billing cycle)

      • Daily push file name format: UID_BillingItemDetailMonthly_YYYYMM, for example, 169**_BillingItemDetailMonthly_201903. This file is updated daily with full data from the beginning of the month to the current day, until the 4th of the next month.

    • SplitItemDetailDaily (split bill daily summary)

      • Daily push file name format: UID_SplitItemDetailDaily_YYYYMM, for example, 169**_SplitItemDetailDaily_201903. This file is updated daily with full data from the beginning of the month to the current day, until the 4th of the next month.

    • MonthBill (monthly bill PDF)

      • Monthly push file name format: UID_MonthBill_YYYYMM, for example, 169**_MonthBill_201903. The file for the previous month is pushed on the 4th of each month.

  • Except for MonthBill, which is a PDF file, all other file types are CSV files. If the number of rows in a bill file exceeds a certain threshold, the file is automatically split into multiple CSV files, which are then compressed into a single ZIP file. The ZIP file name follows the same 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 that stores the subscribed bill files.

xxxxxx-bucket

SubscribeType

string

No

The type of the subscribed bill. Valid values:

  • BillingItemDetailForBillingPeriod: billing item details.

  • InstanceDetailForBillingPeriod: instance bill details.

  • BillingItemDetailMonthly: billing item summary by billing cycle.

  • InstanceDetailMonthly: instance bill summary by billing cycle.

  • SplitItemDetailDaily: split bill daily summary.

  • MonthBill: monthly bill PDF. Only MA subscription is supported.

BillingItemDetailForBillingPeriod

MultAccountRelSubscribe

string

No

For multi-level accounts, specifies the type of bills to push. Valid values:

  • MA: Pushes bills for the primary account and non-trusteeship linked accounts in the financial cloud.

  • ACP1: Pushes bills for Partner Platform V2.0 sub-accounts.

Default value: MA.

MA

BucketOwnerId

integer

No

The UID of the OSS owner that stores the files. Specify this parameter if you are a Bid/Reseller subscriber and need to push files to a sub-account's OSS. The specified account must be a sub-account of the calling account, and the AliyunConsumeDump2OSSRole permission must be granted to this account. Regular users do not need to specify this parameter. The default value is the calling account.

12341324

BeginBillingCycle

string

No

The start billing cycle for pushing. After a successful subscription, the system automatically pushes data from the start billing cycle to the current time. This parameter is invalid for monthly bill PDF subscriptions, and historical data is not re-pushed. Data within the last year can be pushed.

2021-03

BucketPath

string

No

The specified directory under the bucket to which the subscription is delivered.

testpath

RowLimitPerFile

integer

No

The maximum number of rows per file. If a bill file exceeds this limit, it is split into multiple files and compressed into a single archive.

300000

UsingSsl

string

No

Specifies whether to use the Secure Sockets Layer (SSL) encryption protocol to protect network communication. Valid values:

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

  • false (default): Does not enable SSL encryption.

true

Response elements

Element

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.