# Get User Balance

Get user current balance

## Endpoint

```http
GET /user/balance
```

operationId: `getUserBalance`

### Servers

- `https://api.deepseek.com`

## Authentication

### Alternative 1

**bearerAuth**

`Authorization: Bearer <API_KEY>`

```yaml
type: http
scheme: bearer
```

## Responses

### 200

OK, returns user balance info.

#### application/json

- Reference: [GetUserBalanceResponse](#schema-get-user-balance-response) (`#/components/schemas/GetUserBalanceResponse`)

**Example**

```json
{
  "is_available": true,
  "balance_infos": [
    {
      "currency": "CNY",
      "total_balance": "110.00",
      "granted_balance": "10.00",
      "topped_up_balance": "100.00"
    }
  ]
}
```

## Code samples

### curl

```bash
# Set DEEPSEEK_API_KEY to your API key before running this example.
curl --silent --show-error --max-time 60 "https://api.deepseek.com/user/balance" \
  --header "Authorization: Bearer ${DEEPSEEK_API_KEY}"
```

### Python — requests

```python
# Set DEEPSEEK_API_KEY to your API key before running this example.
import os
import requests

response = requests.get(
    "https://api.deepseek.com/user/balance",
    headers={"Authorization": f"Bearer {os.environ['DEEPSEEK_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

## Referenced schemas

### schema-get-user-balance-response

**GetUserBalanceResponse** — `#/components/schemas/GetUserBalanceResponse`

- `type`: `object`

- **Properties**

  - **`is_available`** (optional)

    Whether the user's balance is sufficient for API calls.

    - `type`: `boolean`

  - **`balance_infos`** (optional)

    - `type`: `array`

    - **Array items**

      - `type`: `object`

      - **Properties**

        - **`currency`** (optional)

          The currency of the balance.

          - `type`: `string`

          - `enum`: `["CNY","USD"]`

        - **`total_balance`** (optional)

          The total available balance, including the granted balance and the topped-up balance.

          - `type`: `string`

          - `nullable`: `false`

          **Example**

          ```json
          "110.00"
          ```

        - **`granted_balance`** (optional)

          The total not expired granted balance.

          - `type`: `string`

          - `nullable`: `false`

          **Example**

          ```json
          "10.00"
          ```

        - **`topped_up_balance`** (optional)

          The total topped-up balance.

          - `type`: `string`

          - `nullable`: `false`

          **Example**

          ```json
          "100.00"
          ```
