# 仮想通貨残高の一覧取得

> プロファイルのすべての仮想通貨の現在の残高を返します。アプリに仮想通貨が存在しない場合、`data` は空の配列になります。

## OpenAPI

```yaml
/api-specs/adapty-api.yaml get /api/v2/server-side-api/vc/balances/
openapi: 3.1.0
info:
  title: Adapty サーバーサイド API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: 本番サーバー
paths:
  /api/v2/server-side-api/vc/balances/:
    get:
      summary: 仮想通貨残高の一覧取得
      description: |
        プロファイルのすべての仮想通貨の現在の残高を返します。アプリに仮想通貨が存在しない場合、`data` は空の配列になります。
      operationId: listVirtualCurrencyBalances
      tags:
        - Virtual Currency
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: お客様のシステムにおけるカスタマーの一意のID。`adapty-customer-user-id` または `adapty-profile-id` のいずれかが必須です。
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
          description: お客様のシステムにおけるプロファイルの一意のID。匿名プロファイルを扱う場合に最適な選択肢です。`adapty-customer-user-id` または `adapty-profile-id` のいずれかが必須です。
      responses:
        "200":
          description: 残高が正常に返されました
          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: リクエストが不正です。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: 認証エラー。APIキーが存在しないか無効です。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "403":
          description: アクセス拒否。このアプリでは仮想通貨向けのServer APIが有効化されていません。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: プロファイルが見つかりません。
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          description: 内部サーバーエラー
components:
  schemas:
    VirtualCurrencyBalanceListResponse:
      type: object
      description: プロファイルのすべてのバーチャル通貨の現在の残高。
      properties:
        response_created_at:
          type: integer
          format: int64
          description: レスポンスが生成された日時（Unixタイムスタンプ、ミリ秒単位）。
        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: エラーの発生源
              errors:
                type: array
                items:
                  type: string
                description: エラーメッセージの配列
        error_code:
          type: string
          description: エラーの短い名称
        status_code:
          type: integer
          description: HTTPステータスコード
      required:
        - errors
        - error_code
        - status_code
    VirtualCurrencyProfileBalanceItem:
      type: object
      properties:
        code:
          type: string
          description: アプリ内で一意の仮想通貨コード。ASCII文字、数字、アンダースコアが使用可能です。
        name:
          type: string
          description: 仮想通貨の表示名。
        balance:
          type: integer
          format: int32
          minimum: 0
          description: 現在保留中の金額を含む合計残高。
        held:
          type: integer
          format: int32
          minimum: 0
          description: すべてのアクティブな保留（予約済み金額）の合計。現在は常に0です。
        available:
          type: integer
          format: int32
          description: 支出可能な残高。`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リクエストは、シークレットAPIキーを **Authorization** ヘッダーに `Api-Key {your_secret_api_key}` の形式で設定することで認証されます。例えば、`Api-Key secret_live_...` のように指定します。このキーは Adapty ダッシュボード -> **App Settings** -> **General** タブ -> **API keys** セクションで確認できます。
```
