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

# Update Slippage Setting

> Set the market-order slippage cap for your account within a market deployer, in basis points. The cap bounds how far a market order may execute from the mark price.

The `updateSlippageSetting` action sets the **market-order slippage cap** for your account within a market deployer, expressed in basis points. Market orders are priced from the mark price plus or minus this allowance, so the cap bounds how far a market order may execute from the current mark.

The setting is scoped to the pair **(account, market deployer)** — it is not per-contract, and one call covers every contract under that deployer. The default is **1000 bps (10%)**. Your `accountId` is recovered from the signature.

## Endpoint

```text theme={null}
POST https://dev.upsidemax.xyz/exchange
Content-Type: application/json
```

## Request

```json theme={null}
{
  "action": {
    "type": "updateSlippageSetting",
    "marketDeployerId": 1,
    "marketSlippageBps": 500
  },
  "signature": { "r": "0x...", "s": "0x...", "v": 28 },
  "nonce": 1778858900000
}
```

### Action fields

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

<ParamField body="marketDeployerId" type="int32" required>
  The market deployer this setting applies to. You must already be enrolled in it.
</ParamField>

<ParamField body="marketSlippageBps" type="int" required>
  The market-order slippage cap in basis points. Valid range is `(0, 10000]`, where `10000` equals 100%. Values outside this range are rejected. Defaults to `1000` (10%) when never set.
</ParamField>

## Response

### Success

```json theme={null}
{
  "status": "ok",
  "requestId": "req-144115188075856500",
  "response": {
    "type": "updateSlippageSetting",
    "data": { "marketSlippageBpsBefore": 1000, "marketSlippageBpsAfter": 500 }
  }
}
```

### Rejection

Rejections still return HTTP 200 with `status: "ok"`. A rejected request carries a non-zero `errorCode` and an `errorMessage` **inside `response.data`**, and both `marketSlippageBpsBefore` and `marketSlippageBpsAfter` are `0`.

<Note>
  A non-zero `errorCode` means the request was refused and **the slippage setting is unchanged**. Check for it on every call — `status: "ok"` alone does not mean the setting was applied.
</Note>

### Response fields

<ResponseField name="marketSlippageBpsBefore" type="int">
  The cap in effect before this call. Returns `0` on rejection.
</ResponseField>

<ResponseField name="marketSlippageBpsAfter" type="int">
  The cap in effect after this call. Returns `0` on rejection.
</ResponseField>

<ResponseField name="errorCode" type="int">
  Present only on rejection. Identifies the failure reason.
</ResponseField>

<ResponseField name="errorMessage" type="string">
  Present only on rejection. Human-readable description of the failure.
</ResponseField>

## Errors

| Condition                                  | Result                                                                        |
| ------------------------------------------ | ----------------------------------------------------------------------------- |
| `marketSlippageBps` outside `(0, 10000]`   | `400 BAD_REQUEST`, or a rejection carrying `errorCode` inside `response.data` |
| Account not enrolled in `marketDeployerId` | Rejection carrying `errorCode` inside `response.data`                         |

## Reading the current value

The cap in effect is returned as `marketSlippageBps` by the [`userAccount`](/info/user-account) query — the same field this action writes. Read it back there rather than caching the value locally.
