> For the complete documentation index, see [llms.txt](https://lavarage.gitbook.io/lavarage/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lavarage.gitbook.io/lavarage/platform/lavarage-api/lavaos-documentation/position-actions/position-sell.md).

# Position Sell

### <mark style="color:orange;">POST</mark> /positions/sell

Closes positions by liquidating collateral at market price to repay loans.

#### Headers

<table><thead><tr><th width="223">Header</th><th width="110">Required</th><th width="110">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>x-api-key</code></td><td>Yes</td><td>string</td><td>API key</td></tr></tbody></table>

#### Example Request

```http
POST https://lavarave.wtf/api/sdk/v1.0/positions/sell
```

#### Request Body Fields

<table><thead><tr><th width="226">Field</th><th width="110">Required</th><th width="110">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>positionId</code></td><td>Yes</td><td>string</td><td>Address of the position.</td></tr><tr><td><code>offerId</code></td><td>Yes</td><td>string</td><td>Address of the loan offer.</td></tr><tr><td><code>quoteToken</code></td><td>Yes</td><td>string</td><td>Address of the token being borrowed.</td></tr><tr><td><code>slippage</code></td><td>Yes</td><td>number</td><td>Maximum acceptable price slippage in basis points.</td></tr><tr><td><code>userPubKey</code></td><td>Yes</td><td>string</td><td>Wallet address of the trader.</td></tr><tr><td><code>partnerFeeRecipient</code></td><td>No</td><td>string</td><td>Partner wallet address to receive fees.</td></tr><tr><td><mark style="color:blue;"><code>profitFeeMarkup</code></mark></td><td>No</td><td>string</td><td>This field is outdated and should be avoided. ⚠️</td></tr><tr><td><code>partnerFeeMarkupBps</code></td><td>No</td><td>number</td><td>Partner fee markup in basis points. Only applies when <code>partnerFeeRecipient</code> is provided. Range: 1-2000.</td></tr><tr><td><code>priorityFeeMicroLamports</code></td><td>No</td><td>number</td><td>Priority fee in microlamports.</td></tr><tr><td><code>platformFeeBps</code></td><td>No</td><td>number</td><td>Swap platform fee in basis points. If not provided, it will not be applied. It is suggested to not set anything as not every platform under the protocol can charge a fee.</td></tr><tr><td><code>platformFeeReceiver</code></td><td>No</td><td>string</td><td>Platform fee receiver account (token account). Used only when <code>platformFeeBps</code> is applied.</td></tr></tbody></table>

#### Response Fields

<table><thead><tr><th width="230">Field</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>transaction</code></td><td>string</td><td>Base58 encoded serialized transaction ready for signing.</td></tr><tr><td><p><mark style="color:purple;"><code>quoteResponse</code></mark> </p><p>(Beta)</p></td><td>object</td><td>Additional quote information. Should be ignored for now - this field is not currently used in integration.</td></tr></tbody></table>

#### Request Body Example

```json
{
  "positionId": "GjKds3RantjgzWn9gBPUTty9wSCxEKsPke1PL4bscDVP",
  "offerId": "7oHv3kSZYNufHsSBczGe6wFqZ92y4dYL6eYDHeeY3WH8",
  "partnerFeeRecipient": "6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF",
  "partnerFeeMarkupBps": 200,
  "quoteToken": "So11111111111111111111111111111111111111112",
  "slippage": 1000,
  "userPubKey": "Ahtpvhub1Z2z3y1RUYPDb7iUkv2J9fYByWWaitPeQXVp"
}
```

#### Response Example

```json
{
  "transaction": "base58_encoded_serialized_transaction"
}
```
