---
title: "Records a sale. Closing part of a lot splits it: the closed quantity becomes its own closed row and the remainder stays open on its original cost basis, so a later close of the rest is still priced against what was actually paid for it. The response carries the CLOSED lot, whose id differs from the original one after a partial close."
method: POST
path: "/v1/portfolios/{id}/lots/{lotId}/close"
tags: ["Portfolios"]
---

# Records a sale. Closing part of a lot splits it: the closed quantity becomes its own closed row and the remainder stays open on its original cost basis, so a later close of the rest is still priced against what was actually paid for it. The response carries the CLOSED lot, whose id differs from the original one after a partial close.

`POST /v1/portfolios/{id}/lots/{lotId}/close`

## Request

- Base URL: `https://api.equibles.com`
- URL: `https://api.equibles.com/v1/portfolios/{id}/lots/{lotId}/close`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/equibles/apis/equibles-api/docs/v1/portfolios/:id/lots/:lotId/close/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `id` string, uuid, required
- `lotId` string, uuid, required

## Request body

- ClosePortfolioLotRequest
  - `closePricePerUnit` number, double, required: Price per share the position was closed at, always positive — received for a long, paid to cover a short. For an option, the premium per share of the underlying.
  - `closeDate` string, date, required: The date it was closed, yyyy-MM-dd. Cannot be before the lot was acquired.
  - `quantity` number, double, nullable: How much to close, unsigned. Omit to close the whole lot; pass less to close part of it.

## Response `200`

OK

- PortfolioLotResponse
  - `portfolioId` string, uuid
  - `portfolioName` string, nullable
  - `deduplicated` boolean: True when this request repeated an add that had already landed, so nothing was created and the existing lot is returned. A client that retried a timed-out request reads this instead of discovering a second holding. The response is 200 rather than 201.
  - `lot` PortfolioLotDto
    - `id` string, uuid
    - `instrumentKind` string, nullable: Stock or Option.
    - `ticker` string, nullable: The listed symbol: the stock itself, or an option's underlying.
    - `exchange` string, nullable: The exchange's market identifier code (MIC, e.g. XPAR) for a listing outside the U.S.; null for a U.S. listing. Together with ticker it names the listing, e.g. XPAR:AIR.
    - `name` string, nullable
    - `occTicker` string, nullable: OCC option symbol, e.g. O:AAPL260116C00250000. Null on a stock lot.
    - `expirationDate` string, date, nullable
    - `strikePrice` number, double, nullable
    - `contractType` string, nullable: Call or Put. Null on a stock lot.
    - `sharesPerContract` integer, nullable: Shares of the underlying one contract controls — the P&L multiplier. Null on a stock lot.
    - `quantity` number, double: Signed: shares for a stock, contracts for an option; negative is short or written.
    - `costPerUnit` number, double: Price per share the lot was opened at, always positive. For an option, the premium per share of the underlying rather than per contract.
    - `costBasis` number, double, nullable
    - `currency` string, nullable: ISO 4217 code the lot's prices and own figures are in: its listing's currency.
    - `purchaseFxRate` number, double, nullable: The broker exchange rate recorded with the lot: units of purchaseFxCurrency per 1 unit of currency. Null when none was recorded.
    - `purchaseFxCurrency` string, nullable
    - `acquiredDate` string, date
    - `note` string, nullable
    - `closedDate` string, date, nullable: Set on a closed lot; null while the lot is open.
    - `closePricePerUnit` number, double, nullable
    - `marketValue` number, double, nullable: Null when this pass could not price the instrument — never a zero, which would read as a total loss.
    - `unrealizedGain` number, double, nullable
    - `realizedGain` number, double, nullable: Realized profit or loss on a closed lot; null while the lot is open.
    - `convertedCostBasis` number, double, nullable: The lot's figures in the portfolio's currency: cost at the purchase rate, value at the current rate, and a closed lot's proceeds at the official rate on its closing date. Null on a lot returned by a write, which carries no valuation.
    - `convertedMarketValue` number, double, nullable
    - `convertedUnrealizedGain` number, double, nullable
    - `convertedRealizedGain` number, double, nullable
    - `purchaseRate` PortfolioFxRateDto
      - `from` string, nullable
      - `to` string, nullable
      - `rate` number, double
      - `asOf` string, date, nullable: The official observation date. Weekly releases make a rate a few days old normal.
    - `closeRate` PortfolioFxRateDto
      - `from` string, nullable
      - `to` string, nullable
      - `rate` number, double
      - `asOf` string, date, nullable: The official observation date. Weekly releases make a rate a few days old normal.
    - `isOpen` boolean

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found

## Changes

- **2026-11-06** `666e06778588`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/equibles/apis/equibles-api/changes/v1/portfolios/:id/lots/:lotId/close/post.md)

---

[API](https://skmtc.dev/equibles/apis/equibles-api.md) - [All operations](https://skmtc.dev/equibles/apis/equibles-api/llms.txt) - [OpenAPI document](https://skmtc.dev/equibles/apis/equibles-api/revisions/83f13ba1a993?raw)
