Skip to navigation

Get customer-unit spend (by external customer id)

Returns the credits of one credits currency spent by this customer unit and every unit beneath it during a window, whether or not the unit has a cap. The window runs from start (inclusive) to end (exclusive), at most 366 days; omit both for the current calendar month (UTC). For a capped unit over its cap’s current period, spent equals the cap’s used. Spend from a signal that names no unit counts toward no unit. Select the currency with creditsCurrencyId; it may be omitted only when the organization has exactly one credits currency, which is then used and echoed back. 404 when the customer or the unit does not exist. Addresses the customer by your external customer id.

Authentication

AuthorizationBearer
API Key authentication using Bearer token

Path parameters

externalIdstringRequired>=1 character

Customer ID from your system, stored on Paid as the customer’s externalId.

externalCustomerUnitIdstringRequired>=1 character

Your own id for the unit (its externalId), unique within this customer.

Query parameters

creditsCurrencyIdstringOptionalformat: "uuid"

The credits currency to read. Omit it only when the organization has exactly one credits currency, which is then used; otherwise it is required.

startdatetimeOptional

ISO 8601 timestamp, the window’s inclusive start. Give start and end together, with start before end, or omit both for the current calendar month (UTC).

enddatetimeOptional

ISO 8601 timestamp, the window’s exclusive end. Give start and end together, with start before end, or omit both for the current calendar month (UTC).

Response

200
externalCustomerUnitIdstring>=1 character

Your own id for the unit (its externalId), the identifier the unit and cap routes take.

customerIdstringformat: "^cus_.+"
The Paid display id of the customer the unit belongs to.
creditsCurrencyIdstringformat: "uuid"

The credits currency this response is about: the requested creditsCurrencyId, or the organization’s only credits currency when it was omitted.

windowobject

The window spent covers: the one requested, or the current calendar month (UTC) when none was given.

spentdouble

Credits of this currency spent by this unit and every unit beneath it during the window, net of reversals. Counted whether or not the unit has a cap. JSON number, up to 6 decimal places, truncated toward zero; exact only within ±2^53. Use spentDecimal for the exact value.

spentDecimalstringformat: "^-?\d+(\.\d{1,15})?$"

Exact value of spent as a decimal string, at any magnitude and every decimal place it carries.

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error