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

# Get account usage and concurrency

GET https://api.beatapi.io/v1/usage

The account's balance, spend and breakdowns. Without `period` the counts cover the whole account history; with `period` they cover the window ending now, and the reply repeats `period`, `since` and `until` so a caller can tell which figure it got. `credit_balance` and `concurrency` are always current. A query parameter other than `period`, or a period outside the set, is refused with `400` rather than ignored.

Reference: https://docs.beatapi.io/api-reference/core/usage/get-usage

## Authentication

- `Authorization` header (bearer token, required) — Send your API key as `Authorization: Bearer <BEATAPI_API_KEY>`.

## Request

### Query parameters

- `period` (enum, optional, default: all) — The window the counts and breakdowns cover, ending now. `all` (the default) is the whole account history.
  - Allowed values: `24h`, `7d`, `30d`, `all`

## Response

### 200

Usage summary

- `data` (Usage, required)

## Errors

### 400 Bad Request Error

Malformed JSON or a field, value or combination this endpoint does not accept (`bad_request`; the message names the field), or input refused by moderation (`content_policy_violation`). Not retryable unchanged.

- `error` (ErrorError, required) — Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

### 401 Unauthorized Error

No API key (`missing_api_key`), or a key that is wrong, expired, disabled or exhausted (`invalid_api_key`; the message says which). Send it as `Authorization: Bearer <key>`; the key works with or without the `sk-` prefix. Not retryable.

- `error` (ErrorError, required) — Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

## Types

### Usage

- `object` (enum, required)
  - Allowed values: `usage`
- `period` (enum, required) — The window `total_tasks`, `credits_settled`, `credits_refunded` and the breakdowns cover. `credit_balance` and `concurrency` are always current.
  - Allowed values: `all`, `24h`, `7d`, `30d`
- `credit_balance` (double, required) — Current USD balance. The compatibility field name is retained; 1 Credit equals $1 USD. The balance may be negative.
- `total_tasks` (integer, required)
- `credits_settled` (double, required)
- `credits_refunded` (double, required)
- `concurrency` (UsageConcurrency, required)
- `by_workflow` (list of UsageByWorkflowItems, required) — Compatibility view containing workflow tasks only. Image, video, and Effect tasks are reported under by_capability instead.
- `by_capability` (list of UsageByCapabilityItems, required)
- `by_model` (list of UsageByModelItems, required)
- `by_api_key` (list of UsageByApiKeyItems, required)
- `since` (integer, optional) — Unix start of the window, inclusive. Absent when `period` is `all`.
- `until` (integer, optional) — Unix end of the window, exclusive. Absent when `period` is `all`.
- `realtime` (UsageRealtime, optional)

### ErrorError

Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

- `code` (enum, required) — Stable machine-readable error code. `unauthorized` is the deprecated name for a 401; since 2026-09-29 a 401 is `missing_api_key` or `invalid_api_key`. Treat a legacy `unauthorized` like `invalid_api_key`.
  - Allowed values: `bad_request`, `missing_api_key`, `invalid_api_key`, `unauthorized`, `forbidden`, `not_found`, `insufficient_credits`, `idempotency_conflict`, `user_concurrency_exceeded`, `rate_limit_exceeded`, `content_policy_violation`, `processing_unavailable`, `processing_failed`, `processing_timeout`, `result_transfer_failed`, `invalid_signature`, `realtime_disabled`, `realtime_capacity_unavailable`, `realtime_session_expired`, `origin_not_allowed`, `invalid_client_secret`, `transport_not_allowed`, `internal_error`
- `message` (string, required) — English sentence that states the cause; for `bad_request` it names the field. Written for people and logs, not for parsing.
- `retryable` (boolean, required) — Whether making the same call again could succeed. Present on every error; branch on it instead of the status code. True for 429, 500 and 503 (rate_limit_exceeded, user_concurrency_exceeded, internal_error, processing_unavailable, processing_timeout, processing_failed, result_transfer_failed, realtime_capacity_unavailable). False for a request, key or balance that must change first (bad_request, content_policy_violation, missing_api_key, invalid_api_key, insufficient_credits, forbidden, not_found, idempotency_conflict, realtime_disabled and the other realtime credential codes).
- `request_id` (string, required) — Correlation ID to retain for BeatAPI support.
- `retry_after_seconds` (integer, optional) — Seconds to wait before retrying. Present on every 429, and on a 503 when the wait is known; the same value is sent in the `Retry-After` header.
- `docs` (string, optional) — The public Skill page that says what to do about an error. Present on errors answered by the capability endpoints (`/v1/capabilities/search`, `/v1/capabilities/inspect`, `/v1/capabilities/run`); absent on every other endpoint.

### UsageConcurrency

- `limit` (integer, required)
- `active` (integer, required) — Active processing tasks currently using BeatAPI processing resources. Music Video storyboard_ready and requires_action tasks can have settled USD usage without counting toward this value.

### UsageByWorkflowItems

- `workflow` (enum, required)
  - Allowed values: `music-video`, `ecommerce-video`, `video-analysis`
- `tasks` (integer, required)
- `credits_settled` (double, required)

### UsageByCapabilityItems

- `task_kind` (enum, required)
  - Allowed values: `workflow`, `effect`, `image`, `video`
- `capability_id` (string, required)
- `tasks` (integer, required)
- `credits_settled` (double, required)

### UsageByModelItems

- `media_type` (enum, required)
  - Allowed values: `image`, `video`
- `model` (string, required)
- `tasks` (integer, required)
- `credits_settled` (double, required)

### UsageByApiKeyItems

- `api_key_id` (string, required)
- `title` (string, required)
- `key_prefix` (string, required)
- `tasks` (integer, required)
- `credits_settled` (double, required)

### UsageRealtime

- `sessions` (integer, required) — Total BeatAPI realtime sessions for this account.
- `credits` (double, required) — USD amount settled by connected realtime sessions.
- `active` (integer, required) — Realtime sessions in ready, connecting, or active state.

## Examples

**Response**

```json
{
  "data": {
    "object": "usage",
    "period": "all",
    "credit_balance": 21.6,
    "total_tasks": 12,
    "credits_settled": 14.4,
    "credits_refunded": 9,
    "concurrency": {
      "limit": 2,
      "active": 1
    },
    "by_workflow": [
      {
        "workflow": "music-video",
        "tasks": 8,
        "credits_settled": 9.6
      },
      {
        "workflow": "ecommerce-video",
        "tasks": 4,
        "credits_settled": 4.8
      }
    ],
    "by_capability": [
      {
        "task_kind": "image",
        "capability_id": "seedream-5-pro",
        "tasks": 3,
        "credits_settled": 0.42
      },
      {
        "task_kind": "video",
        "capability_id": "veo-3.1",
        "tasks": 2,
        "credits_settled": 14
      }
    ],
    "by_model": [
      {
        "media_type": "image",
        "model": "seedream-5-pro",
        "tasks": 3,
        "credits_settled": 0.42
      }
    ],
    "by_api_key": [
      {
        "api_key_id": "key_abc123",
        "title": "Production",
        "key_prefix": "sk_live_abcd",
        "tasks": 12,
        "credits_settled": 14.4
      }
    ],
    "realtime": {
      "sessions": 3,
      "credits": 1.8,
      "active": 1
    }
  }
}
```

**SDK Code**

```python Usage_getUsage_example
import requests

url = "https://api.beatapi.io/v1/usage"

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

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

print(response.json())
```

```javascript Usage_getUsage_example
const url = 'https://api.beatapi.io/v1/usage';
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 Usage_getUsage_example
package main

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

func main() {

	url := "https://api.beatapi.io/v1/usage"

	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 Usage_getUsage_example
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/usage")

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 Usage_getUsage_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.beatapi.io/v1/usage")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.beatapi.io/v1/usage', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Usage_getUsage_example
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/usage");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Usage_getUsage_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/usage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```