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

# Get Credit Wallet

> Retrieve the account AI credit wallet balance with USD equivalents

Returns the account AI credit wallet: total, remaining, and used credits, each with its USD equivalent at the account rate of **1000 credits = \$1**. The response also includes the currency, the conversion rate, and the last time balances were synced.

<Note>
  This endpoint is restricted to **account owners and billing managers**. The API key must belong to a user with the `client_owner` or `client_accessBillings` role, otherwise the request is rejected with `403`.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api-integration.ollang.com/integration/credits" \
    -H "X-Api-Key: <your-api-key>"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api-integration.ollang.com/integration/credits",
    {
      method: "GET",
      headers: {
        "X-Api-Key": "<your-api-key>",
      },
    }
  );

  const wallet = await response.json();
  ```

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

  headers = {
      'X-Api-Key': '<your-api-key>'
  }

  response = requests.get(
      'https://api-integration.ollang.com/integration/credits',
      headers=headers
  )
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://api-integration.ollang.com/integration/credits',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => array(
          'X-Api-Key: <your-api-key>'
      ),
  ));

  $response = curl_exec($curl);
  curl_close($curl);
  ```

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

  import (
      "net/http"
  )

  func main() {
      req, _ := http.NewRequest("GET", "https://api-integration.ollang.com/integration/credits", nil)
      req.Header.Set("X-Api-Key", "<your-api-key>")

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

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.get("https://api-integration.ollang.com/integration/credits")
    .header("X-Api-Key", "<your-api-key>")
    .asString();
  ```
</RequestExample>

## Authorizations

This endpoint requires API key authentication. Include your API key in the request header:

* **Header name**: `X-Api-Key`
* **Header value**: Your API key from the Ollang dashboard
* **Format**: `X-Api-Key: your-api-key-here`

You can obtain your API key from your [Ollang dashboard](https://lab.ollang.com).

The key must belong to a user with the `client_owner` or `client_accessBillings` role. Requests from keys without one of these billing roles are rejected with `403`.

## Response

<ResponseField name="totalCredits" type="number">
  Total AI credits assigned to the account (active + depleted). Unit: credits.
</ResponseField>

<ResponseField name="remainingCredits" type="number">
  Currently remaining AI credits. Unit: credits.
</ResponseField>

<ResponseField name="usedCredits" type="number">
  AI credits consumed so far. Unit: credits.
</ResponseField>

<ResponseField name="currency" type="string">
  Currency the credits convert to (for example `USD`).
</ResponseField>

<ResponseField name="creditsPerUsd" type="number">
  Conversion rate: credits per one unit of currency (for example `1000`).
</ResponseField>

<ResponseField name="totalUsd" type="number">
  Total credits expressed in USD (`totalCredits / 1000`).
</ResponseField>

<ResponseField name="remainingUsd" type="number">
  Remaining credits expressed in USD (`remainingCredits / 1000`).
</ResponseField>

<ResponseField name="usedUsd" type="number">
  Used credits expressed in USD (`usedCredits / 1000`).
</ResponseField>

<ResponseField name="lastSyncDate" type="string">
  Last time credit balances were synced (ISO 8601 format), or `null` if never synced.
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "totalCredits": 30000000,
    "remainingCredits": 26649461.48,
    "usedCredits": 3350538.52,
    "currency": "USD",
    "creditsPerUsd": 1000,
    "totalUsd": 30000,
    "remainingUsd": 26649.46,
    "usedUsd": 3350.54,
    "lastSyncDate": "2026-01-15T10:30:00Z"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Unauthorized",
    "message": "Invalid or missing API key",
    "code": "UNAUTHORIZED"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "Access denied",
    "message": "The API key user lacks the client_owner or client_accessBillings role",
    "code": "ACCESS_DENIED"
  }
  ```
</ResponseExample>
