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

# Get Balance

> Retrieve your business balance

## Overview

Returns your current business balance and payout balance in cents. Use this endpoint to programmatically check your available funds.

<Note>
  All amounts are returned in **cents** (e.g., `1500000` = \$15,000.00).
</Note>

## Authentication

This endpoint requires your **Secret API Key** (server-side only). See [Authentication](/api/authentication) for details.

```bash theme={null}
Authorization: Bearer sk_live_xxxxxxxxxxxx
```

<Warning>
  Never expose your Secret API Key in client-side code. This endpoint should only be called from your backend server.
</Warning>

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.payviox.com/balance \
    -H "Authorization: Bearer sk_live_xxxxxxxxxxxx"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.payviox.com/balance', {
    headers: {
      'Authorization': 'Bearer sk_live_xxxxxxxxxxxx'
    }
  });

  const data = await response.json();
  console.log(data.balance);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.payviox.com/balance',
      headers={
          'Authorization': 'Bearer sk_live_xxxxxxxxxxxx'
      }
  )

  data = response.json()
  print(data['balance'])
  ```

  ```php PHP theme={null}
  <?php

  $apiKey = 'sk_live_xxxxxxxxxxxx';
  $url = 'https://api.payviox.com/balance';

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer ' . $apiKey
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $result = json_decode($response, true);
  echo $result['balance'];
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'

  uri = URI('https://api.payviox.com/balance')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = 'Bearer sk_live_xxxxxxxxxxxx'

  response = http.request(request)
  result = JSON.parse(response.body)
  puts result['balance']
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      url := "https://api.payviox.com/balance"

      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "Bearer sk_live_xxxxxxxxxxxx")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      var result map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&result)
      fmt.Println(result["balance"])
  }
  ```
</CodeGroup>

## Example Response

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "balance": 1500000,
    "payout_balance": 500000
  }
  ```

  ```json Unauthorized (401) theme={null}
  {
    "error": "Unauthorized"
  }
  ```
</ResponseExample>

## Error Responses

<AccordionGroup>
  <Accordion title="401 — Unauthorized">
    Returned when the API key is missing or invalid. This endpoint requires your **Secret API Key**.

    **How to resolve:** Ensure you are sending a valid Secret API key in the `Authorization: Bearer` header. Public API keys are not accepted for this endpoint.

    ```json theme={null}
    {
      "error": "Unauthorized"
    }
    ```
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml GET /balance
openapi: 3.0.3
info:
  title: Payviox API
  description: Payment processing API
  version: 1.0.0
servers:
  - url: https://api.payviox.com
security:
  - bearerAuth: []
paths:
  /balance:
    get:
      tags:
        - Business
      summary: Get Balance
      description: Retrieve your current business balance
      operationId: getBalance
      responses:
        '200':
          description: Balance retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBalanceResponse'
              example:
                balance: 1500000
                payout_balance: 500000
        '401':
          description: Unauthorized
components:
  schemas:
    GetBalanceResponse:
      type: object
      properties:
        balance:
          type: integer
          description: Current business balance in cents (e.g., 1500000 = $15,000.00)
        payout_balance:
          type: integer
          description: Current payout balance in cents (e.g., 500000 = $5,000.00)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````