> 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 current draft invoices

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

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

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

## Authentication

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

## Request

### Path parameters

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

## Response

### 200

Current draft invoices

- `data` (list of ApiDataResponseVecSimpleInvoiceDataItems, required) — Response payload.

## Errors

### 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

### ApiDataResponseVecSimpleInvoiceDataItems

Invoice charges and aggregate credits, with fractional cents preserved.

- `adjustments` (list of InvoiceAdjustment, required) — Adjustments applied at invoice level.
- `credits` (list of InvoiceCredit, required) — Credits applied to this invoice.
- `credits_applied_cents` (double, required) — Positive amount deducted by credits, including unallocated credits.
- `currency` (string, required) — Mixlayer bills in USD; monetary JSON numbers retain fractional cents.
- `line_items` (list of SimpleInvoiceLineItem, required) — Invoice line items.
- `period` (InvoicePeriod, required) — Billing period covered by the invoice.
- `subtotal_cents` (double, required) — Sum of gross charge amounts, before credits or adjustments.
- `total_cents` (double, required) — Authoritative provider amount due, including invoice adjustments.
- `id` (string, optional, nullable) — Invoice ID.

### 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.

### InvoiceAdjustment

Signed invoice-level amount not attributable to an individual charge.

- `amount_cents` (double, required) — Signed adjustment amount, in fractional cents.
- `description` (string, required) — Human-readable adjustment name.

### InvoiceCredit

Aggregate credit usage or one charge's allocation, in positive fractional cents.

- `amount_cents` (double, required) — Positive credit deduction, in fractional cents.
- `description` (string, required) — Human-readable credit name.
- `id` (string, required) — Credit ID.
- `type` (enum, required) — Source of the credit funds.
  - Allowed values: `promotional`, `prepaid`, `other`

### SimpleInvoiceLineItem

Actual charge with gross cost and only unambiguous credit allocations.

- `amount_cents` (double, required) — Gross charge before credits, in fractional cents.
- `credits` (list of InvoiceCredit, required) — Credits unambiguously allocated to this charge.
- `description` (string, required) — Human-readable charge name.
- `id` (string, required) — Provider ID, or an invoice-scoped row ID when the provider omits it.
- `net_amount_cents` (double, required) — Charge after allocated credits, in fractional cents.
- `quantity` (double, required) — Billed usage quantity.
- `unit_price_cents` (double, required) — Unit price, in fractional cents.
- `group` (InvoiceLineItemGroup, optional, nullable) — Charge presentation group, or null for ungrouped charges.

### InvoicePeriod

Inclusive start and exclusive end of the billing period, in UTC.

- `end` (string, required) — Exclusive end of the billing period, in UTC.
- `start` (string, required) — Inclusive start of the billing period, in UTC.

### InvoiceLineItemGroup

Charge presentation group; ungrouped charges have a null group.

- `model` (string, required) — Model associated with the charge.

## Examples

**Response**

```json
{
  "data": [
    {
      "adjustments": [
        {
          "amount_cents": 1.1,
          "description": "string"
        }
      ],
      "credits": [
        {
          "amount_cents": 1.1,
          "description": "string",
          "id": "string",
          "type": "promotional"
        }
      ],
      "credits_applied_cents": 1.1,
      "currency": "string",
      "line_items": [
        {
          "amount_cents": 1.1,
          "credits": [
            {
              "amount_cents": 1.1,
              "description": "string",
              "id": "string",
              "type": "promotional"
            }
          ],
          "description": "string",
          "id": "string",
          "net_amount_cents": 1.1,
          "quantity": 1.1,
          "unit_price_cents": 1.1,
          "group": {
            "model": "string"
          }
        }
      ],
      "period": {
        "end": "string",
        "start": "string"
      },
      "subtotal_cents": 1.1,
      "total_cents": 1.1,
      "id": "string"
    }
  ]
}
```

**SDK Code**

```python
import requests

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

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/invoices/current';
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/invoices/current"

	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/invoices/current")

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/invoices/current")
  .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/invoices/current', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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