> For the complete documentation index, see [llms.txt](https://docs.sudo.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sudo.finance/sudo-sdk/v0.0.6/api-reference/sudoapi/pledge-in-position.md).

# Pledge In Position

The `pledgeInPosition` function allows users to add more collateral to an existing position.

#### Function Signature

```typescript
pledgeInPosition(
  pcpId: string,
  collateralToken: string,
  indexToken: string,
  amount: number,
  coinObjects: string[],
  long: boolean
): Promise<TransactionBlock>
```

#### Parameters

* `pcpId`: The ID of the position to pledge into
* `collateralToken`: The token used as collateral (e.g., "USDC")
* `indexToken`: The token used as the market index (e.g., "BTC")
* `amount`: The amount of collateral to add
* `coinObjects`: Array of coin object IDs to use for the transaction
* `long`: Boolean indicating if this is a long (true) or short (false) position

#### Return Value

Returns a `Promise` that resolves to a `TransactionBlock` object.

#### Usage Example

```typescript
const tx = await sudoAPI.pledgeInPosition(
  '0x123...', // pcpId
  'USDC',     // collateralToken
  'BTC',      // indexToken
  1000000,    // amount (1 USDC if USDC has 6 decimals)
  ['0x456...', '0x789...'], // coinObjects
  true        // long position
);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sudo.finance/sudo-sdk/v0.0.6/api-reference/sudoapi/pledge-in-position.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
