# Get Balance - Check Member Wallet Credits via API

> Retrieve the wallet balance for a specific user. Check credits, deposits, and available funds via API.

Source: https://docs.botsubscription.com/api/balance/get/

Check how much credit a member has in their wallet. BotSubscription allows users to maintain a balance that can be applied toward future subscriptions, and this endpoint lets you query that amount along with the configured currency.

<ApiEndpoint method="GET" endpoint="/v2/projects/{project_id}/balance" />

<ApiAuthorization type="Bearer API Key" />

**API key access:** Unrestricted project API key required. Restricted keys cannot call this endpoint.

Wallet top-up is currently unsupported for project API keys because its request contract cannot select the required recipient. Support requires a backend contract decision.

<ApiSection title="Path Parameters">
  <ApiParameter name="project_id" type="string" required description="The unique identifier of the project." />
</ApiSection>

<ApiSection title="Query Parameters">
  <ApiParameter name="user_id" type="string" required description="The explicit user ID whose balance to query." />
</ApiSection>

<ApiSamplePane>

<ApiRequestSample title="Request">

```bash
curl -X GET "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/balance?user_id=123456789012345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```javascript
const project_id = 'YOUR_PROJECT_ID';
const user_id = '123456789012345678';
const response = await fetch(`https://api.botsubscription.com/v2/projects/${project_id}/balance?user_id=${user_id}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});
const data = await response.json();
```

```python
import requests

project_id = 'YOUR_PROJECT_ID'
user_id = '123456789012345678'
response = requests.get(
    f'https://api.botsubscription.com/v2/projects/{project_id}/balance',
    params={'user_id': user_id},
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
data = response.json()
```

```php
$project_id = 'YOUR_PROJECT_ID';
$user_id = '123456789012345678';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.botsubscription.com/v2/projects/{$project_id}/balance?user_id={$user_id}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_API_KEY']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
```

</ApiRequestSample>

<ApiResponseTabs>
  <ApiResponse status={200} description="Success">

```json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "GET",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/balance",
  "code": 200,
  "data": {
    "balance": "25.00",
    "currency": "USD"
  }
}
```

  </ApiResponse>
  <ApiResponse status={422} description="Missing required parameter">

```json
{
  "ok": false,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "GET",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/balance",
  "code": 422,
  "error": {
    "error_code": "VALIDATION_ERROR",
    "message": "user_id parameter is required for privileged access"
  }
}
```

  </ApiResponse>
  <ApiResponse status={401} description="Invalid or expired API key">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "GET",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/balance",
  "code": 401,
  "error": {
    "message": "Invalid or expired authentication token.",
    "error_code": "UNAUTHORIZED"
  }
}
```

  </ApiResponse>
</ApiResponseTabs>

</ApiSamplePane>
