---
title: "Remove test funds (paper trading only)"
url: https://docs.truemarkets.co/api/gateway/create-paper-withdrawal
description: "**Paper-trading environments only.** This endpoint is not served in production, where it answers `404`."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Remove test funds (paper trading only)

```
POST https://api.truemarkets.co/v1/gateway/paper/withdrawals
```

**Paper-trading environments only.** This endpoint is not served in production, where it answers `404`.

Sends test funds of the DeFi listing `asset_id` out of the caller's paper wallet. Only the wallet's unallocated balance can leave it, so when the wallet cannot cover the request, allocated balance is first released from CeFi trading through `POST /cefi/releases`, returned in `release`, and the request waits up to 20 seconds for it to free the funds.

With `amount` omitted, the wallet is emptied: everything the caller has allocated of the listing on CeFi is released first, then the whole wallet balance leaves. With `amount` given, CeFi is released from only when the wallet's unallocated balance falls short, and by at most `amount`. The CeFi release is capped at the caller's allocation of the listing; when omitting `amount`, any CeFi balance beyond that allocation stays on CeFi and is reported in `cefi_unbacked`.

When the release has not freed the funds within the wait, the request answers `409` with code `release_settling` and `metadata.release_id`; retry shortly. A wallet that still cannot cover the request with nothing left on CeFi answers `422` with code `insufficient_balance` or `funds_allocated`.

## Authentication

Bearer token in `Authorization`

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `TM-On-Behalf-Of` | header | string (uuid) | no | Act as one of your organization's users. The value is the `user_id` returned when the user was created; the request then reads and writes that user's account. Requires an organization token and a user your organization created: `400` for a personal token, a repeated header or a non-UUID, `403` for a user outside your organization. Not accepted on organization-scoped routes. |

## Request body

`application/json`, required

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `asset_id` | string (uuid) | yes | DeFi listing identifier (UUID) |
| `amount` | string | no | Amount to remove, as a positive decimal string; omit to empty the wallet |

Example:

```json
{
  "asset_id": "b3d9e5f2-1a4c-4e7b-9f0d-2c8a6b3e5f91",
  "amount": "250"
}
```

## Responses

Every error status returns the same body, described in [Errors](https://docs.truemarkets.co/developer-resources/errors.md).

### 200

Test funds removed from the wallet

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `asset_id` | string (uuid) | yes | DeFi listing identifier (UUID) |
| `debited` | string | yes | Amount removed from the wallet, as a decimal string |
| `wallet_balance` | string | yes | The paper wallet's balance of the listing after the funds were removed |
| `release` | object | no | A release and the CeFi transfer it started. |
| `release.id` | string (uuid) | yes | Release identifier |
| `release.status` | string, one of `debiting`, `completed`, `rejected`, `stranded` | yes | Where the release stands. * **debiting** — The amount is being taken out of CeFi. * **completed** — The amount is out of CeFi and free in the wallet again. * **rejected** — The release was refused; the amount stays allocated. * **stranded** — The outcome is unknown and support has to resolve it. |
| `release.asset_id` | string (uuid) | yes | DeFi listing identifier (UUID) |
| `release.asset_symbol` | string | yes | Symbol of the listing |
| `release.amount` | string | yes | Amount freed by this release, as a decimal string |
| `release.transfer` | object | no | The CeFi transfer an allocation or release started, under the exchange's id |
| `release.transfer.id` | string | yes | Exchange transfer identifier |
| `release.transfer.status` | string, one of `INITIALIZED`, `PENDING`, `PROCESSING`, `COMPLETED`, `REJECTED`, `FAILED` | yes | Status as last seen from the exchange |
| `release.failure_reason` | string | no | Why the release was refused or stranded |
| `release.created_at` | string (date-time) | yes |  |
| `release.updated_at` | string (date-time) | yes |  |
| `cefi_unbacked` | string | no | CeFi balance of the listing beyond the caller's allocation, which has no allocation behind it and so was left on CeFi, as a decimal string. Present only when positive. |

### 400

Bad request

### 401

Unauthorized

### 403

Forbidden. On order creation this also covers an asset that is not available to trade from the country the request came from.

### 404

Not found

### 409

Conflict

### 422

Request is well-formed but cannot be processed (e.g. leverage missing or out of range for a perp order)

### 500

Internal server error

### 503

Service unavailable
