Billing / Client / get_credits

get_credits

Billing.Client.get_credits(**kwargs)

Returns the list of Amazon Web Services account credits for the specified account. Each credit includes its identifier, type, monetary amounts, applicable products, expiration, sharing configuration, and current enabled status.

When the caller is the management account of a consolidated billing family and payerAccountFlag is true, the response aggregates credits across the entire family. Otherwise, the response includes only credits owned by the account specified in accountId.

See also: AWS API Documentation

Request Syntax

response = client.get_credits(
    accountId='string',
    startDate=datetime(2015, 1, 1),
    endDate=datetime(2015, 1, 1),
    payerAccountFlag=True|False
)
Parameters:
  • accountId (string) –

    [REQUIRED]

    The Amazon Web Services account ID. Must be a 12-digit numeric string.

  • startDate (datetime) –

    [REQUIRED]

    The start date for the credit period as Unix epoch seconds. Must be a past date that is not more than one year before the current date.

  • endDate (datetime) – The end date for the credit period as Unix epoch seconds. Must not be a future date and must be on or after startDate. Defaults to the current date when omitted.

  • payerAccountFlag (boolean) – When true and the caller is the management account, the response aggregates credits across the entire consolidated billing family. When false or omitted, returns only credits for the specified accountId.

Return type:

dict

Returns:

Response Syntax

{
    'credits': [
        {
            'creditId': 'string',
            'accountId': 'string',
            'creditType': 'string',
            'initialAmount': {
                'currencyCode': 'string',
                'currencyAmount': 'string'
            },
            'remainingAmount': {
                'currencyCode': 'string',
                'currencyAmount': 'string'
            },
            'estimatedAmount': {
                'currencyCode': 'string',
                'currencyAmount': 'string'
            },
            'applicableProductNames': [
                'string',
            ],
            'description': 'string',
            'startDate': datetime(2015, 1, 1),
            'endDate': datetime(2015, 1, 1),
            'exhaustDate': datetime(2015, 1, 1),
            'applicationType': 'BEFORE_CROSS_SERVICE_DISCOUNTS'|'AFTER_DISCOUNTS',
            'shareableAccounts': [
                'string',
            ],
            'accountHasCreditSharingEnabled': True|False,
            'creditConsoleVisibility': 'string',
            'creditSharingType': 'DEFAULT'|'DISABLED'|'CUSTOM'|'COST_CATEGORY_RULE',
            'costCategoryArn': 'string',
            'ruleName': 'string',
            'creditStatus': 'ENABLED'|'DISABLED',
            'purchaseTypeApplications': [
                'string',
            ]
        },
    ]
}

Response Structure

  • (dict) –

    • credits (list) –

      The list of credits matching the request. Returns an empty list when no credits exist.

      • (dict) –

        Detailed information about an Amazon Web Services credit, including its identifier, type, monetary amounts, applicable products, sharing configuration, and current enabled status.

        • creditId (string) –

          The unique identifier for the credit.

        • accountId (string) –

          The Amazon Web Services account ID that owns the credit.

        • creditType (string) –

          The type of credit. Examples: Promotion, Refund, TrueUp.

        • initialAmount (dict) –

          The initial amount of the credit when it was issued.

          • 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.

        • remainingAmount (dict) –

          The unused balance of the credit.

          • 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.

        • estimatedAmount (dict) –

          The estimated remaining balance, including in-flight (open) bills that have not yet been finalized.

          • 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.

        • applicableProductNames (list) –

          The names of Amazon Web Services services this credit applies to.

          • (string) –

        • description (string) –

          A human-readable description of the credit.

        • startDate (datetime) –

          The date the credit becomes valid, as Unix epoch seconds.

        • endDate (datetime) –

          The date the credit expires, as Unix epoch seconds.

        • exhaustDate (datetime) –

          The date the credit balance reached zero, as Unix epoch seconds.

        • applicationType (string) –

          When the credit is applied during bill computation. Valid values: BEFORE_CROSS_SERVICE_DISCOUNTS, AFTER_DISCOUNTS.

        • shareableAccounts (list) –

          The Amazon Web Services account IDs entitled to apply this credit.

          • (string) –

        • accountHasCreditSharingEnabled (boolean) –

          Whether the owning account has account-level credit sharing turned on.

        • creditConsoleVisibility (string) –

          The display configuration for the credit in the Amazon Web Services Billing console.

        • creditSharingType (string) –

          The sharing configuration for the credit. Valid values: DEFAULT, DISABLED, CUSTOM, COST_CATEGORY_RULE.

        • costCategoryArn (string) –

          The Amazon Resource Name (ARN) of the Cost Category controlling the credit’s sharing scope. Present only when creditSharingType is COST_CATEGORY_RULE.

        • ruleName (string) –

          The rule name within the Cost Category. Present only when creditSharingType is COST_CATEGORY_RULE.

        • creditStatus (string) –

          Whether the credit participates in billing runs. Valid values: ENABLED, DISABLED.

        • purchaseTypeApplications (list) –

          Restricts which purchase types this credit applies to. When null or omitted, the credit applies to all purchase types.

          • (string) –

Exceptions