# Withdraw

<mark style="color:green;">`POST`</mark> `/withdraw`

Processes a withdrawal by verifying an on-chain redemption transaction and then initiating a bank transfer to the payout details previously sent along with the [redeem](https://docs.prosperavest.com/integrations/publish-your-docs-2/redeem) request. It requires the generated transaction reference (`pvRef`) and the signed redeem transaction hash (`txHash`) from the blockchain.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <api_key>` |

**Body**

<table><thead><tr><th width="173">Name</th><th width="143">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pvRef</code></td><td>string</td><td>The transaction reference generated during redemption.</td></tr><tr><td><code>txHash</code></td><td>string</td><td>The signed transaction hash from the blockchain.</td></tr></tbody></table>

**Example**

{% tabs %}
{% tab title="Mint Allocation Check" %}

```json
{
  "pvRef": "PV-E8823747",
  "txHash": "0x2234a21626a407ae1a065dde7331a361114139c88077978811089f40f7323f90"
}
```

{% endtab %}

{% tab title="Response (200) Ok" %}

```json
{
  "status": 200,
  "message": "Withdrawal processed successfully",
  "data": {
    "pvRef": "PV-E8823747",
    "txHash": "0x2234a21626a407ae1a065dde7331a361114139c88077978811089f40f7323f90",
    "txStatus": "PENDING",
    "receiptStatus": 1,
    "transfer": {
      "status": "success",
      "data": {
        "id": "TR-AB12CD34",
        "reference": "TR-AB12CD34",
        "currency": "NGN",
        "amount": 100,
        "narration": "Withdrawal transfer for ENSC conversion",
        "debit_currency": "NGN",
        "account_bank": "058",
        "account_number": "0343761669",
        "beneficiary_name": "Resolved Account Name",
        "meta": [
          {
            "transactionType": "withdrawal",
            "originalReference": "PV-E8823747"
          }
        ]
      }
    },
    "amount": 100,
    "assetType": "ENSC",
    "payout": {
      "accountName": "Resolved Account Name",
      "bank": "058",
      "accountNumber": "0343761669"
    }
  }
}
```

{% endtab %}
{% endtabs %}

**Common Error Responses**

{% tabs %}
{% tab title="Missing Fields:" %}

```json
{
  "status": 400,
  "error": "Invalid Request",
  "message": "Both pvRef and txHash are required"
}
```

{% endtab %}

{% tab title="Transaction Record Not Found:" %}

```json
{
  "status": 404,
  "error": "Transaction Not Found",
  "message": "No transaction record found for the provided pvRef and entity"
}
```

{% endtab %}

{% tab title="Invalid Asset Type (non‑ENSC):" %}

```json
{
  "status": 400,
  "error": "Invalid Asset",
  "message": "Only ENSC asset type is allowed for withdrawal"
}
```

{% endtab %}

{% tab title="Invalid Transaction Hash:" %}

```json
{
  "status": 400,
  "error": "Invalid Transaction Hash",
  "message": "Transaction not found on blockchain"
}
```

{% endtab %}

{% tab title="Transaction Failed On-chain:" %}

```json
{
  "status": 400,
  "error": "Transaction Failed",
  "message": "The blockchain transaction did not succeed"
}
```

{% endtab %}

{% tab title="Bank Transfer Failure:" %}

```json
{
  "status": 400,
  "error": "Bank Transfer Failed",
  "message": "Unable to initiate bank transfer"
}
```

{% endtab %}
{% endtabs %}
