# Get Customer Earnings

Returns current-period earnings for each of a customer's Pockets plus their exact aggregate, in a single call. The aggregate is the field-wise sum of the per-Pocket entries (sum of `earnings`, sum of `appreciation_per_second`, earliest `pricing_timestamp`), so it always matches the total of the individual rows. By default every Pocket that is not closed is covered; a closed Pocket's earnings can still be fetched by listing it explicitly in `pocket_id[]`. At most 30 Pockets can be covered per call — a request covering more is rejected with a `400` and should be narrowed with the `pocket_id[]` filter. Only the defined periods (`wtd`, `mtd`, `ytd`, `all-time`) are supported — for a custom date range, use the single-Pocket earnings endpoint.

Endpoint: GET /api/v2/customers/{customer_id}/earnings/
Version: Version: d28453d9
Security: HTTPBearer

## Path parameters:

  - `customer_id` (string, required)

## Query parameters:

  - `period` (string)
    The period to fetch earnings for. Can be one of

 * ytd (Year-to-date)
 * mtd (Month-to-date)
 * wtd (Week-to-date)
 * all-time

Custom date ranges are not supported at the customer level; use the
single-pocket earnings endpoint with 'range' instead.

  - `pocket_id[]` (any)
    Restricts the earnings to the given pockets. Defaults to all of the customer's pockets except closed ones; a closed pocket's earnings are included only when it is listed here explicitly.

## Header parameters:

  - `x-jiko-idempotency` (string, required)

  - `x-jiko-signature` (string, required)

## Response 200 fields (application/json):

  - `aggregate` (any, required)

  - `aggregate.earnings` (object, required)

  - `aggregate.earnings.value` (integer, required)
    USD values are always in cents.

  - `aggregate.earnings.currency` (string, required)

  - `aggregate.earnings.formatted` (string)

  - `aggregate.date_from` (any, required)

  - `aggregate.date_to` (string, required)

  - `aggregate.pricing_timestamp` (any)

  - `aggregate.appreciation_per_second` (any)

  - `pockets` (array, required)

  - `pockets.date_from` (any, required)

  - `pockets.date_to` (string, required)

  - `pockets.pricing_timestamp` (any)

  - `pockets.appreciation_per_second` (any)

  - `pockets.pocket_id` (string, required)

## Response 422 fields (application/json):

  - `detail` (array)

  - `detail.loc` (array, required)

  - `detail.msg` (string, required)

  - `detail.type` (string, required)

  - `detail.input` (any)

  - `detail.ctx` (object)

