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

# Withdraw

> Execute a partial withdrawal from a wallet

<Note>
  **SDK Alternative**: Use `agent.withdraw(amount?)` for a simpler TypeScript interface. [See SDK docs](/sdk-reference/agent/withdrawals)
</Note>

## Description

Executes a partial withdrawal from a wallet. The agent remains active after a partial withdrawal.

For full withdrawal (deactivation), use the [Deactivate Wallet](/api-reference/agents/deactivate-wallet) endpoint.

## Path Parameters

<ParamField path="chain_id" type="integer" required>
  The blockchain chain ID
</ParamField>

<ParamField path="wallet" type="string" required>
  The wallet address
</ParamField>

## Request Body

<ParamField body="amount" type="integer" required>
  Amount to withdraw in smallest token units (e.g., 1000000 = 1 USDC)
</ParamField>

## Response

<ResponseField name="date" type="string">
  Withdrawal date
</ResponseField>

<ResponseField name="total_value" type="number">
  Total withdrawn value
</ResponseField>

<ResponseField name="total_value_in_usd" type="number">
  Total withdrawn value in USD
</ResponseField>

<ResponseField name="withdraw_details" type="array">
  Breakdown of withdrawn tokens
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets/0x...:withdraw" \
    -H "Content-Type: application/json" \
    -H "X-Partner-API-Key: your-api-key" \
    -H "X-Partner-Name: your-partner-name" \
    -d '{"amount": 500000000}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets/0x...:withdraw',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-Partner-API-Key': 'your-api-key',
        'X-Partner-Name': 'your-partner-name',
      },
      body: JSON.stringify({ amount: 500000000 }),
    }
  );
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "date": "2024-01-20T15:00:00Z",
    "total_value": 500.0,
    "total_value_in_usd": 500.0,
    "withdraw_details": [
      {
        "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "amount": "500000000",
        "value": 500.0,
        "value_in_usd": 500.0,
        "principal_amount": 490000000,
        "yield_amount": 10000000,
        "fee_amount": 0
      }
    ]
  }
  ```
</ResponseExample>
