customers

Get customer-unit spend

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. Use the value returned as customer.id, for example cus_abc123; if you have your own customer ID, use the /api/v2/customers/external/{externalId}/… twin.

get/customers/{id}/customer-units/{externalCustomerUnitId}/spend

Request

  • Base URL: https://api.agentpaid.io/api/v2
  • URL: https://api.agentpaid.io/api/v2/customers/{id}/customer-units/{externalCustomerUnitId}/spend
  • Auth: HTTP bearer

Path parameters

idstring required

Paid customer display id

externalCustomerUnitIdstring required

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

Query parameters

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

startstring date-time

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

endstring date-time

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 required

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

customerIdstring required

The Paid display id of the customer the unit belongs to.

creditsCurrencyIdstring uuid required

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

spentnumber double required

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; exact within ±2^53.

Changes

No recorded changes to this operation across all 1 revision of this API.