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

# Withdraw

> Calldata that pays out a wallet's claimable balance

> [!NOTE]
>
> Seller Financing is in beta and runs on Ethereum Sepolia instances only for now (`DEVELOPMENT` instances on Ethereum). A `PRODUCTION` instance, or one on another network, answers `503 SELLER_FINANCING_UNAVAILABLE`. See [Seller Financing](/endpoints/seller-financing/introduction.md).

Builds the payout of the signing wallet's whole claimable balance, read with [Get Claimable](/endpoints/seller-financing/get-claimable.md), in the payment token. An asset the custody adapter holds in escrow is not part of it: reclaim that with [Claim Escrowed Collateral](/endpoints/seller-financing/claim-escrowed-collateral.md). The wallet that signs is the wallet paid for: only it can withdraw its balance, to `to` or to itself.

A withdrawal stays open while the market is paused. When the payment token refuses to pay a wallet, for example one its issuer blacklisted, the owner of the balance can name another `to`. One wallet's refusal never holds back another's balance.

The step pays out the balance at the moment it is mined, so `amount` in the answer can be lower than what arrives when more was credited in between.

## Path Parameters

**marketId** `string` *required*

The market's record ID, as `id` on [List Markets](/endpoints/seller-financing/list-markets.md).

## Body Parameters

**to** `string`

The wallet that receives the payout. It cannot be the market or its adapter. Omitted, `""` or `null`, the payout goes to `from`.

**from** `string` *required*

The wallet whose balance is paid out, which signs. Without it the answer is `400 FROM_REQUIRED`. A wallet with nothing to withdraw answers `409 TX_WOULD_REVERT` with `NothingToWithdraw`.

## Response Fields

**data** `object`

**action** `string`

`SIGN_TRANSACTIONS`.

**chainId** `integer`

The chain the step is built for.

**steps** `array`

One step, `withdraw` on the market, with `gasLimit`.

**confirmStepIndex** `integer`

`0`.

**preflight** `object`

`{ simulated: true, gasEstimate }`.

**to** `string`

The wallet that receives the payout.

**amount** `string`

The balance of `from` when the request was built, in the payment token's smallest unit.

**amountFormatted** `string`

The same in whole units.

```bash cURL theme={null}
curl -X POST "https://api.trusset.org/seller-financing/api/markets/cmsg4x7k20003sf9q1d8v6b2e/withdraw" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"from": "0x3E22FdfA28e880239541d9c5B66B3b161F9ED77b"}'
```

```typescript TypeScript theme={null}
const res = await fetch(
  `https://api.trusset.org/seller-financing/api/markets/${marketId}/withdraw`,
  {
    method: 'POST',
    headers: { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' },
    body: JSON.stringify({ from: await seller.getAddress() })
  }
);
const { data } = await res.json();
const step = data.steps[0];
await (await seller.sendTransaction({ to: step.to, data: step.data, value: 0, gasLimit: step.gasLimit })).wait();
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "action": "SIGN_TRANSACTIONS",
    "chainId": 11155111,
    "steps": [
      {
        "to": "0xc35e5f74eC4C1dfB8cE2b8798D6161B706F9B5E1",
        "data": "0x51cff8d9...",
        "value": "0",
        "functionName": "withdraw",
        "label": "Withdraw 10000.8633 to 0x3E22...D77b",
        "description": "Withdraw 10000.8633 to 0x3E22...D77b",
        "gasLimit": "258503",
        "chainId": 11155111
      }
    ],
    "confirmStepIndex": 0,
    "preflight": {
      "simulated": true,
      "gasEstimate": "198849"
    },
    "to": "0x3E22FdfA28e880239541d9c5B66B3b161F9ED77b",
    "amount": "10000863300",
    "amountFormatted": "10000.8633"
  },
  "error": null,
  "metadata": {
    "timestamp": "2026-10-18T21:45:31.020Z",
    "requestId": "3f7c2a91-6d84-4b0e-9a15-c2e8f4d7b603",
    "instanceId": "inst_abc123"
  }
}
```

```json Error - Nothing to Withdraw theme={null}
{
  "success": false,
  "data": null,
  "error": {
    "code": "TX_WOULD_REVERT",
    "message": "There is nothing to withdraw for this wallet.",
    "details": {
      "action": "withdrawal",
      "error": "NothingToWithdraw"
    }
  },
  "metadata": {
    "timestamp": "2026-10-18T21:45:31.020Z",
    "requestId": "3f7c2a91-6d84-4b0e-9a15-c2e8f4d7b603",
    "instanceId": "inst_abc123"
  }
}
```

## Error Codes

| Code | HTTP | Cause |
| - | - | - |
| `VALIDATION_ERROR` | `400` | An address is malformed, or the body carries another field. `error.details` names it |
| `FROM_REQUIRED` | `400` | `from` is missing. The message names who signs: the wallet whose claimable balance is paid out |
| `MARKET_NOT_FOUND` | `404` | No market with this ID that your instance reaches on its network |
| `TX_WOULD_REVERT` | `409` | `NothingToWithdraw` when `from` has no balance, `InvalidAddress` when `to` is the market or its adapter, or a refusal of the payment token such as `SafeERC20FailedOperation` |
| `CHAIN_UNAVAILABLE` | `503` | The chain could not be read. Nothing was built. Retry shortly |
| `SELLER_FINANCING_UNAVAILABLE` | `503` | The instance is a `PRODUCTION` instance or not on Ethereum |
| `WITHDRAW_BUILD_FAILED` | `500` | Unexpected failure. Nothing was built. Retry, or contact support with the request ID |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.