> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsidemax.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# cancelTpSl: Cancel All TP/SL for a Position

> Cancel all take-profit and stop-loss trigger orders for a specific position in one request. Returns a count of cancelled orders; zero is not an error.

The `cancelTpSl` action cancels all TP/SL trigger orders associated with a specific position, identified by contract ID and position side. This is the fastest way to remove all trigger orders for a position without having to look up and cancel individual order IDs.

This action is idempotent: if there are no active TP/SL orders for the specified position, the request succeeds and returns `cancelledCount: 0` rather than an error.

## Endpoint

```
POST https://dev.upsidemax.xyz/exchange
```

## Request

All requests must include an ECDSA signature and a millisecond-precision nonce.

```json theme={"system"}
{
  "action": {
    "type": "cancelTpSl",
    "a": 1,
    "positionSide": 0
  },
  "signature": { "r": "0x...", "s": "0x...", "v": 28 },
  "nonce": 1778858700000
}
```

### Action fields

<ParamField body="type" type="string" required>
  Fixed value: `"cancelTpSl"`.
</ParamField>

<ParamField body="a" type="int32" required>
  The contract ID whose TP/SL orders you want to cancel.
</ParamField>

<ParamField body="positionSide" type="int8">
  Scopes the cancellation by position side: `0` = cancel all TP/SL orders for the entire contract, `1` = cancel LONG position TP/SL only, `2` = cancel SHORT position TP/SL only. Defaults to `0`.
</ParamField>

## Response

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "cancelTpSl",
    "data": { "cancelledCount": 2 }
  }
}
```

### Response fields

<ResponseField name="cancelledCount" type="int">
  The number of TP/SL trigger orders that were cancelled. A value of `0` means no orders were found for the specified position — this is not an error condition.
</ResponseField>

<Tip>
  To cancel a single specific TP or SL order by its ID, use [cancelConditional](/exchange/cancel-conditional) instead.
</Tip>
