# List virtual currency balances

> Returns the current balance of every virtual currency for a profile. If the app has no virtual currencies, `data` is an empty array.

## OpenAPI

```yaml
/api-specs/adapty-api.yaml get /api/v2/server-side-api/vc/balances/
openapi: 3.1.0
info:
  title: Adapty server-side API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: Production server
paths:
  /api/v2/server-side-api/vc/balances/:
    get:
      summary: List virtual currency balances
      description: |
        Returns the current balance of every virtual currency for a profile. If the app has no virtual currencies, `data` is an empty array.
      operationId: listVirtualCurrencyBalances
      tags:
        - Virtual Currency
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: The unique ID of the customer in your system. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
          description: The unique ID of the profile in your system. Your best option if you are working with anonymous profiles. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
      responses:
        "200":
          description: Balances returned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VirtualCurrencyBalanceListResponse"
              example:
                response_created_at: 1779791400000
                data:
                  - code: COINS
                    name: Gold Coins
                    balance: 12450
                    held: 0
                    available: 12450
                  - code: GEMS
                    name: Gems
                    balance: 3280
                    held: 0
                    available: 3280
                  - code: ENERGY
                    name: Energy
                    balance: 840
                    held: 0
                    available: 840
        "400":
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Unauthorized. The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: Forbidden. The Server API for virtual currencies is not enabled for this app.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profile not found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          description: Internal server error
components:
  schemas:
    VirtualCurrencyBalanceListResponse:
      type: object
      description: Current balances for all virtual currencies of a profile.
      properties:
        response_created_at:
          type: integer
          format: int64
          description: When the response was generated, as a Unix timestamp in milliseconds.
        data:
          type: array
          items:
            $ref: "#/components/schemas/VirtualCurrencyProfileBalanceItem"
      required:
        - response_created_at
        - data
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: Source of the error
              errors:
                type: array
                items:
                  type: string
                description: Array of error messages
        error_code:
          type: string
          description: Short error name
        status_code:
          type: integer
          description: HTTP status code
      required:
        - errors
        - error_code
        - status_code
    VirtualCurrencyProfileBalanceItem:
      type: object
      properties:
        code:
          type: string
          description: Unique virtual currency code within the app. ASCII letters, digits, and underscore.
        name:
          type: string
          description: Display name of the virtual currency.
        balance:
          type: integer
          format: int32
          minimum: 0
          description: Total balance, including amounts currently held.
        held:
          type: integer
          format: int32
          minimum: 0
          description: Sum of all active holds (reserved amounts). Currently always 0.
        available:
          type: integer
          format: int32
          description: Balance available to spend, computed as `balance - held`.
      required:
        - code
        - name
        - balance
        - held
        - available
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        API requests must be authenticated by your secret API key as the **Authorization** 
        header with the value `Api-Key {your_secret_api_key}`, for example, 
        `Api-Key secret_live_...`. Find this key in the Adapty Dashboard -> 
        **App Settings** -> **General** tab -> **API keys** section.
```
