> ## Documentation Index
> Fetch the complete documentation index at: https://crm-social.exuratech.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Debit funds

> Withdraw available funds from Social Trading and complete the movement in the CRM.

`POST /api/v1/wallet/external/withdrawal` debits funds when a user requests a transfer from Social Trading to the CRM.

## Recommended workflow

**1. Create the internal request**

The CRM records the withdrawal with a pending status and assigns an immutable reference.

**2. Request the debit**

The backend calls ExuraCopy with a unique `idempotency_key` for that withdrawal.

**3. Evaluate the response**

`COMPLETED` and `ALREADY_PROCESSED` confirm that the debit exists. A `409` response for insufficient funds must not complete the internal workflow.

**4. Complete the CRM transaction**

After a successful confirmation, the CRM applies the corresponding movement in its own system.

## Request

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://social-api.example.com/api/v1/wallet/external/withdrawal" \
  -H "Authorization: Bearer YOUR_CRM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_reference": "crm-user-127",
    "amount": "50.00",
    "currency": "USD",
    "wallet_code": "PAMM_SOCIAL_USD",
    "idempotency_key": "crm-withdrawal-985422",
    "external_provider": "CRM",
    "external_transaction_reference": "CRM-WDR-985422",
    "description": "Withdrawal from Social Trading wallet",
    "metadata_json": {
      "crm_transaction_id": "CRM-WDR-985422",
      "source": "external_crm"
    }
  }'
```

## Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "result": "COMPLETED",
  "user_id": 42,
  "external_reference": "crm-user-127",
  "wallet_account_id": 105,
  "wallet_code": "PAMM_SOCIAL_USD",
  "transaction_id": 7202,
  "ledger_entry_id": 9106,
  "amount": "50.00000000",
  "currency": "USD",
  "balance": "300.00000000",
  "available_balance": "270.00000000",
  "hold_balance": "30.00000000",
  "completed_at": "2026-07-22T18:20:00Z"
}
```

> [card] [Previous: Credit funds](https://crm-social.exuratech.com/guides/deposits.md)
>
> Return to the deposit workflow.

> [card] [Next: Account webhooks](https://crm-social.exuratech.com/guides/account-webhooks.md)
>
> Receive accounts created in Social Trading.


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