# Pockets

## List Customer Pockets

 - [GET /api/v2/pockets/](https://docs.jiko.io/products/customer-api/reference/pockets/list_customer_pockets_api_v2_pockets__get.md): This endpoint lists all the pockets for a given customer. It returns a Pockets object which is a paginated list of Pocket objects.

## Create Customer Pocket

 - [POST /api/v2/pockets/](https://docs.jiko.io/products/customer-api/reference/pockets/create_customer_pocket_api_v2_pockets__post.md): This endpoint creates a new pocket for a customer.

The request body requires a CreatePocketRequest object, specifying the trading_strategy_id and a pocket_name. It returns the newly created Pocket object.

## Get Customer Pocket

 - [GET /api/v2/pockets/{pocket_id}/](https://docs.jiko.io/products/customer-api/reference/pockets/get_customer_pocket_api_v2_pockets__pocket_id___get.md): This endpoint retrieves the details of a specific pocket, and returns a Pocket object with detailed portfolio information.

## Update Pocket

 - [PATCH /api/v2/pockets/{pocket_id}/](https://docs.jiko.io/products/customer-api/reference/pockets/update_pocket_api_v2_pockets__pocket_id___patch.md): This endpoint updates a pocket's information, such as its name or status (e.g., closing a pocket).
If the intent is to close a pocket, then there are two requirements: The pocket needs to be empty,
and there has to be at least one other open pocket belonging to the customer. Additionally,
when you close a pocket, you also need to pass a closure_reason along with the status update.

The request body requires an UpdatePocketRequest object. It returns the updated Pocket object.

## Get Single Pocket Earnings

 - [GET /api/v2/pockets/{pocket_id}/earnings/](https://docs.jiko.io/products/customer-api/reference/pockets/get_single_pocket_earnings_api_v2_pockets__pocket_id__earnings__get.md): This endpoint returns pocket earnings for a single pocket for a specified datetime period.

- Optionally pre-defined ranges are defined as such:

  - ytd (Year-to-date) From January 1st of the current year
  - mtd (Month-to-date) From the 1st calendar day of the current month, or start of business that month
  - wtd (Week-to-date) From the most recent Monday, or start of business that week.
  - all-time (default) From Account start
  - All through to the current day if buisness day, or last buisness day.

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

