# Update Pocket

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.

Endpoint: PATCH /api/v2/pockets/{pocket_id}/
Version: Version: 0d14821f
Security: CodeBearer

## Security:

  - `CodeBearer` (unknown)
    oauth2 scopes: pockets.write, pockets.read

## Path parameters:

  - `pocket_id` (string, required)

## Request fields (application/json):

  - `pocket_name` (any)
    Pocket name

  - `status` (any)
    Pocket status

  - `closure_reason` (any)

  - `deposit_strategy_id` (any)
    Pocket deposit trading strategy ID (Example: UST-4W)

  - `reinvestment_strategy_id` (any)
    Pocket reinvestment trading strategy ID (Example: UST-4W)

## Response 200:

  - `200` (unknown)
    Successful Response

## Response 200 fields (application/json):

  - `id` (string, required)
    ID of the pocket

  - `pocket_name` (string, required)
    Pocket name

  - `portfolio` (any)
    Total liquid cash and holdings

  - `portfolio.securities` (array, required)

  - `portfolio.securities.quantity` (integer, required)
    Number of securities

  - `portfolio.securities.market_value` (object, required)

  - `portfolio.securities.market_value.value` (integer, required)
    USD values are always in cents.

  - `portfolio.securities.market_value.currency` (string, required)

  - `portfolio.securities.market_value.formatted` (string)

  - `portfolio.securities.cusip` (string, required)
    CUSIP number of security

  - `portfolio.securities.jiko_mark_price` (string, required)

  - `portfolio.securities.description` (string, required)
    A description of the security

  - `portfolio.securities.type` (string, required)

  - `portfolio.securities.maturity_date` (string, required)
    Due date of the fixed income instrument

  - `portfolio.all_time_earnings` (any)
    All time portfolio earnings. Use of this field is discouraged, as it will be removed in a future release. Please use the [Get Earnings](/products/partner-api/reference/pockets/get-earnings-v2) endpoint instead.

  - `portfolio.fees` (array, required)
    Any outstanding fees

  - `portfolio.fees.type` (string, required)

  - `portfolio.liquidation_value_t1` (any)
    Amount, in USD cents, that a withdrawal to a bank account (wire, ACH, card) can raise settling next business day (T+1): cash plus securities at executable sell quotes. Quotes move; treat as an estimate.

  - `portfolio.on_us_spendable_t0` (any)
    Amount, in USD cents, that a JikoNet or pocket-to-pocket transfer can move settling same day (T+0): cash plus securities at Jiko's mark. Securities stay in Jiko inventory on such transfers, so no sale premium applies and this can exceed `liquidation_value_t0`. `null` when not available.

  - `portfolio.on_us_spendable_t1` (any)
    Amount, in USD cents, that a JikoNet or pocket-to-pocket transfer can move settling next business day (T+1): cash plus securities at Jiko's mark. Securities stay in Jiko inventory on such transfers, so no sale premium applies and this can exceed `liquidation_value_t1`. `null` when not available.

  - `portfolio.pricing_timestamp` (any)
    Timestamp at which `total_value` was priced. Populated for pockets backed by accounts with the `real_time_yield` attribute when at least one underlying CUSIP holding has real-time pricing; `null` otherwise.

  - `portfolio.appreciation_per_second` (any)
    Rate at which `total_value` accrues per second, in USD cents. Combined with `pricing_timestamp`, allows interpolating the displayed total value forward as `total_value + appreciation_per_second × (now - pricing_timestamp)`. Populated for pockets backed by accounts with the `real_time_yield` attribute when at least one underlying CUSIP holding has real-time pricing; `null` otherwise.

  - `status` (string, required)
    Pocket status
    Enum: "PENDING", "OPEN", "FROZEN", "CLOSED"

  - `attributes` (array)

  - `deposit_strategy_id` (string, required)
    Pocket deposit trading strategy ID (Example: UST-4W)

  - `reinvestment_strategy_id` (any, required)
    Pocket reinvestment trading strategy ID (Example: UST-4W)

  - `type` (any)
    Pocket type

  - `object_type` (string, required)

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

