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

# Get the credit balance

GET https://developers.synthesia.io/api/billing/credits

Get your workspace's current billing period and its credit balance.

Amounts are decimal strings (e.g. `"288.00"`).

Reference: https://developers.synthesia.io/docs/api-reference/billing/get-billing-credits

## Authentication

- `Authorization` header (bearer token, required) — Your Synthesia API key. * Send it as `Authorization: Bearer <key>`; a bare key also works. * An endpoint that needs a scope names it in its description; [Scopes](https://developers.synthesia.io/docs/scopes) lists them all. * A `:write` scope also satisfies the same resource's `:read`. * Without the scope, the request fails with a 403 `insufficient_scope`.

## Response

### 200

Successful Response

- `period` (BillingPeriod, required) — The billing window's start and end timestamps.
- `credits` (CreditsBalance, required) — A workspace's wallet balance and latest-period usage. Amounts are decimal strings, not floats, to avoid precision loss on money.

## Errors

### 400 Bad Request Error

Malformed or invalid request

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 401 Unauthorized Error

Unauthenticated

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 402 Payment Required Error

Payment is required on your account (payment_required).

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 403 Forbidden Error

Insufficiently scoped or forbidden

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 404 Not Found Error

Not Found

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 429 Too Many Requests Error

Rate limited

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 500 Internal Server Error

Internal error

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 503 Service Unavailable Error

Service unavailable

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

### 504 Gateway Timeout Error

Upstream timeout

- `type` (string, required) — A URL identifying the error class — documentation, not a contract: branch on `code`, never parse `type`.
- `title` (string, required) — A human-readable summary of the error class.
- `status` (integer, required) — The HTTP status code, repeated from the response.
- `code` (string, required) — The stable, machine-readable error code to branch on. New codes may appear; treat an unknown one by its `status`.
- `detail` (string, optional, nullable) — Human-readable specifics; the wording may change without notice.
- `features` (list of string, optional, nullable) — On `feature_not_in_plan` only: the plan features this request needs.
- `instance` (string, optional, nullable) — The request path that produced the error.
- `requestId` (string, optional, nullable) — Identifies the request in Synthesia's logs (also the `Request-Id` header); quote it when contacting support.

## Types

### BillingPeriod

The billing window's start and end timestamps.

- `startsAt` (datetime, required) — When the current billing period started.
- `endsAt` (datetime, required) — When the current billing period ends.

### CreditsBalance

A workspace's wallet balance and latest-period usage. Amounts are decimal strings, not floats, to avoid precision loss on money.

- `total` (string, required) — The period's full allowance.
- `consumed` (string, required) — What this period has used so far.
- `available` (string, required) — What is left to spend this period.
- `unit` (string, optional, default: credits) — What the amounts are counted in.

## Examples

**Response**

```json
{
  "period": {
    "startsAt": "2024-01-15T09:30:00Z",
    "endsAt": "2024-01-15T09:30:00Z"
  },
  "credits": {
    "total": "1000.00",
    "consumed": "250.50",
    "available": "749.50",
    "unit": "credits"
  }
}
```

**SDK Code**

```python
import requests

url = "https://developers.synthesia.io/api/billing/credits"

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

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

print(response.json())
```

```javascript
const url = 'https://developers.synthesia.io/api/billing/credits';
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://developers.synthesia.io/api/billing/credits"

	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://developers.synthesia.io/api/billing/credits")

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://developers.synthesia.io/api/billing/credits")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://developers.synthesia.io/api/billing/credits', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://developers.synthesia.io/api/billing/credits")! 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()
```