# Get Earnings

Returns the earnings of a single Pocket for a period: `wtd`, `mtd`, `ytd`, `all-time` (the default), or `range`. For `range`, `date_from` and `date_to` are required.

Endpoint: GET /api/v2/pockets/{pocket_id}/earnings/
Version: Version: 323de9c9
Security: HTTPBearer

## Security:

  - `HTTPBearer` (unknown)
    http bearer

## Path parameters:

  - `pocket_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
 * range

When 'range' is chosen, you need to specify 'date_from' and 'date_to' (inclusive).

  - `date_from` (any)

  - `date_to` (any)

## Header parameters:

  - `x-jiko-idempotency` (string, required)
    A new UUID that you generate for each request, reads included. It is part of the request signature and prevents replay of a request. A value that was already sent in the last hour is rejected with `409 jiko.errors.DuplicateRequestError`, even if the first request failed. When you retry a request, generate a new value and sign the request again.

  - `x-jiko-signature` (string, required)
    Base64-encoded HMAC-SHA256 hash of `x-jiko-idempotency + request pathname + body`, keyed with your shared secret. See [Authentication](/products/partner-api/guides/building/auth) for the full algorithm and a code sample.

## Response 200:

  - `200` (unknown)
    Successful Response

## Response 200 fields (application/json):

  - `earnings` (object, required)

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

  - `earnings.currency` (string, required)

  - `earnings.formatted` (string)

  - `date_from` (any, required)

  - `date_to` (string, required)

  - `pricing_timestamp` (any)

  - `appreciation_per_second` (any)

## Response 401:

  - `401` (unknown)
    The access token is missing, invalid or expired.

## Response 401 fields (application/json):

  - `type` (string, required)

  - `instance` (string, required)

  - `detail` (string, required)

  - `trace_id` (any)

  - `fields` (any)
    Present only on input validation errors. Each entry identifies one invalid field: `loc` is its location, `msg` is the problem, and `type` is the validation rule that failed.

## Response 403:

  - `403` (unknown)
    `x-jiko-signature` does not match the request, or the access token does not permit this action.

## Response 403 fields (application/json):

  - `type` (string, required)

  - `instance` (string, required)

  - `detail` (string, required)

  - `trace_id` (any)

  - `fields` (any)
    Present only on input validation errors. Each entry identifies one invalid field: `loc` is its location, `msg` is the problem, and `type` is the validation rule that failed.

## Response 404:

  - `404` (unknown)
    A resource identified in the path does not exist.

## Response 404 fields (application/json):

  - `type` (string, required)

  - `instance` (string, required)

  - `detail` (string, required)

  - `trace_id` (any)

  - `fields` (any)
    Present only on input validation errors. Each entry identifies one invalid field: `loc` is its location, `msg` is the problem, and `type` is the validation rule that failed.

## Response 422:

  - `422` (unknown)
    Validation Error

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

