Billing / Client / get_credit_allocation_history

get_credit_allocation_history

Billing.Client.get_credit_allocation_history(**kwargs)

Returns the per-billing-month allocation history for credits applied to an Amazon Web Services account’s bills. Traverses the consolidated billing family to capture cross-account credit applications. Supports pagination and optional filtering to a single credit.

See also: AWS API Documentation

Request Syntax

response = client.get_credit_allocation_history(
    accountId='string',
    creditId=123,
    startDate=datetime(2015, 1, 1),
    endDate=datetime(2015, 1, 1),
    nextToken='string',
    maxResults=123
)
Parameters:
  • accountId (string) –

    [REQUIRED]

    The Amazon Web Services account ID whose allocation history to retrieve. Must be a 12-digit numeric string.

  • creditId (integer) – Filters the result to a single credit. When omitted, returns allocation entries for all credits.

  • startDate (datetime) –

    [REQUIRED]

    Inclusive start date as Unix epoch seconds. Must be on or before endDate. The range from startDate to endDate cannot exceed 24 billing months.

  • endDate (datetime) –

    [REQUIRED]

    Inclusive end date as Unix epoch seconds.

  • nextToken (string) – Pagination token from a previous response. Pass the value returned in nextToken to retrieve the next page of results.

  • maxResults (integer) – The maximum number of records to return per page. Range: 1 to 1000. Default: 100.

Return type:

dict

Returns:

Response Syntax

{
    'creditAllocationHistoryList': [
        {
            'creditId': 'string',
            'creditAmount': {
                'currencyCode': 'string',
                'currencyAmount': 'string'
            },
            'description': 'string',
            'accountId': 'string',
            'appliedServiceName': 'string',
            'billingMonth': 'string',
            'isEstimatedBill': True|False
        },
    ],
    'partialResults': True|False,
    'failedMonths': [
        'string',
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • creditAllocationHistoryList (list) –

      Allocation entries sorted by billingMonth in descending order.

      • (dict) –

        A single entry in the credit allocation history, representing how a credit was applied to a specific service during a billing month.

        • creditId (string) –

          The identifier of the credit that was applied.

        • creditAmount (dict) –

          The amount of credit applied. Negative values represent credits that reduced the bill.

          • currencyCode (string) –

            The ISO 4217 currency code for the amount (for example, USD).

          • currencyAmount (string) –

            The amount as a decimal string (for example, "743.21"). Negative values represent credits that reduce a bill.

        • description (string) –

          A human-readable description of the credit allocation.

        • accountId (string) –

          The Amazon Web Services account the credit was applied to.

        • appliedServiceName (string) –

          The Amazon Web Services service the credit was applied to.

        • billingMonth (string) –

          The billing month of the application in YYYY-MM format.

        • isEstimatedBill (boolean) –

          true when the entry was applied to an in-flight bill that has not yet been finalized.

    • partialResults (boolean) –

      true when data could not be retrieved for one or more billing months. The failedMonths field lists which months are missing.

    • failedMonths (list) –

      Billing months in YYYY-MM format that failed to return data. Non-empty only when partialResults is true.

      • (string) –

    • nextToken (string) –

      Pagination token. Present when more pages are available; null when there are no more results.

Exceptions

  • Billing.Client.exceptions.ThrottlingException

  • Billing.Client.exceptions.AccessDeniedException

  • Billing.Client.exceptions.ValidationException

  • Billing.Client.exceptions.InternalServerException