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

# Get Balance

> Get current wallet balance for a subscriber

<Info>
  Balance queries require PIN verification to ensure only authorized users can view account balances.
</Info>

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer olive_live_xxx` or `Bearer eyJ...` (JWT)
</ParamField>

### Path Parameters

<ParamField path="subscriber_id" type="string" required>
  Subscriber UUID (e.g., `sub_abc123`)
</ParamField>

### Body Parameters

<ParamField body="pin" type="string" required>
  Subscriber's 4-digit PIN for verification
</ParamField>

***

## Response

<ResponseField name="success" type="boolean">
  Whether query succeeded
</ResponseField>

<ResponseField name="balance" type="integer">
  Current balance in cents
</ResponseField>

<ResponseField name="balance_formatted" type="string">
  Formatted balance (e.g., `125,000.00 SLE`)
</ResponseField>

<ResponseField name="currency" type="string">
  Currency code (`SLE`)
</ResponseField>

***

## Examples

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://demo.api.vultlocal.com/api/v1/wallet/balance/sub_abc123" \
    -H "Authorization: Bearer olive_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "pin": "1234"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "balance": 12500000,
    "balance_formatted": "125,000.00 SLE",
    "currency": "SLE",
    "subscriber_id": "sub_abc123",
    "last_transaction_at": "2025-01-15T10:30:00Z"
  }
  ```

  ```json 401 Invalid PIN theme={null}
  {
    "success": false,
    "error": "Invalid PIN",
    "attempts_remaining": 2
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "error": "Subscriber not found",
    "code": "SUBSCRIBER_NOT_FOUND"
  }
  ```
</ResponseExample>

***

## Security

<CardGroup cols={2}>
  <Card title="PIN Required" icon="lock">
    Every balance query requires PIN verification
  </Card>

  <Card title="Attempt Limits" icon="shield">
    3 failed attempts locks account for 30 minutes
  </Card>
</CardGroup>

***

## Errors

| Status | Code                   | Description              |
| ------ | ---------------------- | ------------------------ |
| 400    | `INVALID_PIN_FORMAT`   | PIN must be 4 digits     |
| 401    | `INVALID_PIN`          | PIN verification failed  |
| 401    | `UNAUTHORIZED`         | Invalid API key          |
| 403    | `ACCOUNT_LOCKED`       | Too many failed attempts |
| 404    | `SUBSCRIBER_NOT_FOUND` | Subscriber not found     |
| 500    | `INTERNAL_ERROR`       | Server error             |


## OpenAPI

````yaml olive-openapi.json POST /wallet/balance/{subscriber_id}
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths:
  /wallet/balance/{subscriber_id}:
    post:
      tags:
        - Wallet
      summary: Get wallet balance
      description: Get current wallet balance for a subscriber (requires PIN verification)
      parameters:
        - description: Subscriber ID
          name: subscriber_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handler.GetBalanceRequest'
        description: PIN for verification
        required: true
      responses:
        '200':
          description: Balance retrieved
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Invalid request or PIN
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '404':
          description: Subscriber not found
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handler.GetBalanceRequest:
      type: object
      required:
        - pin
      properties:
        pin:
          type: string
          example: '1234'
  securitySchemes:
    ApiKeyAuth:
      description: >-
        API Key for third-party integrations (WhatsApp, Smart PAY, VULT).
        Format: 'Bearer olive_live_xxxxxxxxxxxxx'
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      description: >-
        JWT token from admin login for administrative operations. Format:
        'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
      type: apiKey
      name: Authorization
      in: header

````