Skip to content

Billing period

BillingPeriod dataclass #

BillingPeriod(
    id: str,
    start_date: datetime,
    end_date: datetime,
    status: str,
    outstanding_cost: float,
    gross_cost: float,
    discount: float,
    response_count: int,
    credits: float | None,
    effective_limit: float | None,
)

What the current billing period has cost so far, and what is left to spend.

All amounts are in US dollars, rounded to the cent. Costs accrue continuously while jobs run, so this is a snapshot: fetch it again for an up-to-date figure.

Attributes:

Name Type Description
id str

The billing period's id.

start_date datetime

When the billing period started.

end_date datetime

When the billing period ends.

status str

The period's lifecycle status — "Open" while it is still accruing cost, and one of "Invoiced", "Void", "Reconciling", "PendingReview" or "Closed" afterwards.

outstanding_cost float

The net cost accrued so far — gross_cost minus discount. This is what the period would be invoiced for today.

gross_cost float

The cost accrued so far, before any discounts.

discount float

The discounts applied to the period so far.

response_count int

The number of billable responses collected in the period.

credits float | None

The prepaid credit still available to spend, or None when the organization is not on a prepaid plan (it is billed for its usage instead). Credits are an organization-level balance rather than a property of the period, so they carry across periods until used up.

effective_limit float | None

The most the organization may spend in this period, or None when it spends without a cap. Vouchers raise it, so on a prepaid plan this is the total credit granted and credits is what remains of it.