> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mixlayer.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mixlayer.com/_mcp/server.

# Get a billing account

GET https://api.mixlayer.com/v1/billing_accounts/{billing_account_id}

When authenticated with an API key, this operation requires `api-read`.

Reference: https://docs.mixlayer.com/api-reference/platform-api/billing-accounts/get-billing-account

## Authentication

- `Authorization` header (bearer token, required) — Console user session or Mixlayer API key supplied as a Bearer token.

## Request

### Path parameters

- `billing_account_id` (string, required) — Billing account ID

### Query parameters

- `force_refresh` (boolean, optional, default: false) — Refresh billing provider state before returning.
- `include` (string, optional) — Comma-separated optional sections: `auto_refill`, `spend_controls`, or `all`.

## Response

### 200

Billing account details

- `data` (ApiDataResponseBillingAccountResponseData, required) — Billing account details returned by the public API.

## Errors

### 400 Bad Request Error

Query parameters are missing or invalid.

- `error` (ApiErrorBody, required) — Structured error details.

### 401 Unauthorized Error

Authentication is missing or invalid.

- `error` (ApiErrorBody, required) — Structured error details.

### 403 Forbidden Error

The authenticated principal cannot perform this operation.

- `error` (ApiErrorBody, required) — Structured error details.

### 404 Not Found Error

Billing account not found

- `error` (ApiErrorBody, required) — Structured error details.

### 500 Internal Server Error

An unexpected server or database error occurred.

- `error` (ApiErrorBody, required) — Structured error details.

## Types

### ApiDataResponseBillingAccountResponseData

Billing account details returned by the public API.

- `billing_email` (string, required) — Email address used for billing communications.
- `billing_mode` (enum, required) — Whether usage is billed before or after consumption.
  - Allowed values: `prepaid`, `postpaid`
- `created_at` (datetime, required) — Time the billing account was created.
- `credit_balance_cents` (long, required) — Current prepaid credit balance in cents.
- `has_default_payment_method` (boolean, required) — Whether the account has a default payment method.
- `id` (string, required) — Stable billing account identifier.
- `payment_method_required` (boolean, required) — Whether a payment method is required before the account can be used.
- `prepaid_entitlement_state` (enum, required) — Current prepaid-account entitlement state.
  - Allowed values: `disabled`, `enabled`, `provisioning_failed`, `payment_required`, `payment_failed`, `action_required`
- `updated_at` (datetime, required) — Time the billing account was last updated.
- `auto_refill` (PrepaidAutoRefillSummary, optional, nullable) — Auto-refill settings, included only when requested.
- `balance_checked_at` (datetime, optional, nullable) — Time the prepaid credit balance was last checked.
- `payment_method_description` (string, optional, nullable) — Human-readable default payment method, when available.
- `spend_controls` (SpendControlsResponse, optional, nullable) — Spend controls, included only when requested.

### ApiErrorBody

Structured error details returned by the platform API.

- `message` (string, required) — Human-readable error message.
- `code` (string, optional, nullable) — Stable machine-readable error code, when available.
- `details` (any, optional) — Error-specific structured context, when available.

### PrepaidAutoRefillSummary

Current automatic prepaid refill settings.

- `enabled` (boolean, required) — Whether automatic refills are enabled.
- `recharge_to_cents` (long, optional, nullable) — Target balance after a refill, in cents.
- `threshold_cents` (long, optional, nullable) — Balance threshold that triggers a refill, in cents.

### SpendControlsResponse

Spend controls configured for a billing account.

- `billing_account_id` (string, required) — Billing account owning the controls.
- `prepaid_low_balance_warning` (SpendControlAlert, optional, nullable) — Low prepaid balance warning, or null when disabled.
- `usage_spend_cutoff` (UsageSpendCutoffControl, optional, nullable) — Usage-spend cutoff, or null when disabled.
- `usage_spend_warning` (SpendControlAlert, optional, nullable) — Usage-spend warning, or null when disabled.

### SpendControlAlert

Spend-control warning threshold.

- `threshold_cents` (long, required) — Configured threshold in cents.

### UsageSpendCutoffControl

Usage-spend cutoff threshold and enforcement state.

- `local_state` (enum, required) — Current local enforcement state.
  - Allowed values: `ok`, `blocked`
- `threshold_cents` (long, required) — Configured cutoff threshold in cents.

## Examples

**Response**

```json
{
  "data": {
    "billing_email": "string",
    "billing_mode": "prepaid",
    "created_at": "2024-01-15T09:30:00Z",
    "credit_balance_cents": 1,
    "has_default_payment_method": true,
    "id": "string",
    "payment_method_required": true,
    "prepaid_entitlement_state": "disabled",
    "updated_at": "2024-01-15T09:30:00Z",
    "auto_refill": null,
    "balance_checked_at": null,
    "payment_method_description": "string",
    "spend_controls": null
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.mixlayer.com/v1/billing_accounts/billing_account_id"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.mixlayer.com/v1/billing_accounts/billing_account_id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mixlayer.com/v1/billing_accounts/billing_account_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.mixlayer.com/v1/billing_accounts/billing_account_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.mixlayer.com/v1/billing_accounts/billing_account_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.mixlayer.com/v1/billing_accounts/billing_account_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```