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

# Get Balance Specific Day

> Check what the account balance was on a specific day

## Path Parameters

<ParamField path="merchantId" type="string" required>
  Merchant ID
</ParamField>

## Query Parameters

<ParamField query="currency" type="string">
  Currency code of your deposit account. If not provided, the default value will be DRE.

  Allowed values: `USD`, `AUD`, `EUR`, `GBP`, `BRL`, `CAD`, `CHF`

  Example: `BRL`
</ParamField>

<ParamField query="recipient_id" type="string">
  ID of your recipient

  Example: `12`
</ParamField>

<ParamField query="date" type="string" required>
  Enter the date in the following format: YYYY-MM-DD

  Example: `2024-01-15`
</ParamField>

## Response

<ResponseField name="balance" type="number">
  Example: `15000`
</ResponseField>

<ResponseField name="available_balance" type="number">
  Example: `10000`
</ResponseField>

<ResponseField name="reserve_balance" type="number">
  Example: `0`
</ResponseField>

<ResponseField name="fee" type="number or null">
  This field will only be different from null when the account is configured to receive fees in a wallet. Other than in this case, the balance of the other fee account(wallet) that will receive the fees is returned.

  Default: `null`

  Example: `100`
</ResponseField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/balance/history'?date=2025-01-15 \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer {token}'
  ```

  ```javascript JavaScript theme={null}
  const merchantId = 'your_merchant_id';
  const date = '2024-01-15';

  const response = await fetch(
    `https://api.wepayments.com/v2/account/${merchantId}/balance/history?date=${date}`,
    {
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  console.log('Balance on', date, ':', data.balance);
  ```

  ```python Python theme={null}
  import requests

  merchant_id = 'your_merchant_id'
  date = '2024-01-15'

  url = f'https://api.wepayments.com/v2/account/{merchant_id}/balance/history'
  headers = {
      'Accept': 'application/json',
      'Authorization': 'Bearer YOUR_TOKEN'
  }
  params = {'date': date}

  response = requests.get(url, headers=headers, params=params)
  data = response.json()

  print(f"Balance on {date}: {data['balance']}")
  ```
</CodeGroup>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "balance": 15000,
    "available_balance": 10000,
    "reserve_balance": 0,
    "fee": null
  }
  ```
</ResponseExample>

## Use Cases

<AccordionGroup>
  <Accordion title="Historical Balance Tracking">
    Track balance changes over time for reporting and reconciliation:

    ```javascript theme={null}
    async function getBalanceHistory(merchantId, startDate, endDate) {
      const dates = generateDateRange(startDate, endDate);
      const history = [];
      
      for (const date of dates) {
        const balance = await getBalanceSpecificDay(merchantId, date);
        history.push({ date, ...balance });
      }
      
      return history;
    }
    ```
  </Accordion>

  <Accordion title="End-of-Day Reconciliation">
    Verify end-of-day balances for accounting purposes:

    ```javascript theme={null}
    async function reconcileEndOfDay(merchantId, date) {
      const balance = await getBalanceSpecificDay(merchantId, date);
      const transactions = await getTransactionsForDay(merchantId, date);
      
      // Compare calculated vs actual balance
      const calculatedBalance = calculateBalance(transactions);
      const difference = balance.balance - calculatedBalance;
      
      if (difference !== 0) {
        console.warn(`Reconciliation mismatch: ${difference}`);
      }
      
      return { balance, transactions, difference };
    }
    ```
  </Accordion>

  <Accordion title="Financial Reporting">
    Generate balance reports for specific periods:

    ```javascript theme={null}
    async function generateMonthlyReport(merchantId, year, month) {
      const daysInMonth = new Date(year, month, 0).getDate();
      const report = [];
      
      for (let day = 1; day <= daysInMonth; day++) {
        const date = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
        const balance = await getBalanceSpecificDay(merchantId, date);
        report.push({ date, balance: balance.balance });
      }
      
      return report;
    }
    ```
  </Accordion>

  <Accordion title="Audit Trail">
    Create an audit trail of balance changes:

    ```javascript theme={null}
    async function auditBalanceChanges(merchantId, dates) {
      const audit = [];
      
      for (let i = 0; i < dates.length - 1; i++) {
        const currentBalance = await getBalanceSpecificDay(merchantId, dates[i]);
        const nextBalance = await getBalanceSpecificDay(merchantId, dates[i + 1]);
        
        const change = nextBalance.balance - currentBalance.balance;
        
        audit.push({
          date: dates[i],
          balance: currentBalance.balance,
          change: change,
          percentChange: (change / currentBalance.balance) * 100
        });
      }
      
      return audit;
    }
    ```
  </Accordion>
</AccordionGroup>

## Date Format

The `date` parameter must be in the format `YYYY-MM-DD`:

* ✅ Valid: `2024-01-15`
* ✅ Valid: `2023-12-31`
* ❌ Invalid: `15/01/2024`
* ❌ Invalid: `01-15-2024`
* ❌ Invalid: `2024/01/15`

## Response Fields

### balance

The total balance in the account on the specified date.

### available\_balance

The balance available for withdrawal or transactions on the specified date.

### reserve\_balance

The amount held in reserve on the specified date (if applicable).

### fee

Fee balance on the specified date (only applicable when the account is configured to receive fees in a wallet).

## Best Practices

<Note>
  **Historical Data Availability**: Balance history is typically available for the past 90 days. Check with your account manager for specific data retention policies.
</Note>

<Warning>
  **Rate Limiting**: When querying multiple dates, implement rate limiting to avoid hitting API limits. Consider batching requests or adding delays between calls.
</Warning>

<Tip>
  **Caching**: Historical balance data doesn't change. Cache responses indefinitely to improve performance and reduce API calls.
</Tip>
