# List invoices (/docs/api-reference/billing/list-invoices)

The organization's invoices, newest first, without their lines. Pass the last `id` as `after` to get the next page while `has_more` is true.

`GET https://api.coss.com/v1/billing/invoices`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Query parameters

- `status` ("open" | "paid" | "void" | "uncollectible"): Only invoices in this status.
- `after` (string, at most 64 characters): Continue after this id (the last of the previous page).
- `limit` (integer, 1-100): At most this many (default 20).

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.billing.invoices.list();
```

HTTP:

```sh
curl -X GET "https://api.coss.com/v1/billing/invoices" \
  -H "Authorization: Bearer $COSS_API_KEY"
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.billing.invoices.list()
```

Go:

```go
import (
	"context"

	billing "github.com/cosscom/coss-go/billing"
	cossclient "github.com/cosscom/coss-go/client"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &billing.ListInvoicesRequest{}
client.Billing.Invoices.List(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.billing.invoices.list
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\Billing\Invoices\Requests\ListInvoicesRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->billing->invoices->list(
    new ListInvoicesRequest([]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.billing.invoices.requests.ListInvoicesRequest;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.billing().invoices().list(
    ListInvoicesRequest
        .builder()
        .build()
);
```

.NET:

```csharp
using Coss;
using Coss.Billing;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.Billing.Invoices.ListAsync(new ListInvoicesRequest());
```

## Response 200

A page of invoices.

- `object` ("list", required)
- `data` (object[], required)
  - `object` ("invoice", required)
  - `id` (string, required)
  - `number` (string | null, required): The invoice number. `null` until it's finalized.
  - `kind` ("period" | "plan_change" | "one_off" | "final" | "threshold", required): `period`: a billing month. `plan_change`: a change of plan. `one_off`: a single charge. `final`: the last invoice of an account. `threshold`: usage charged early, taken off the month's invoice.
  - `status` ("open" | "paid" | "void" | "uncollectible", required): `open`: not paid yet. `paid`: settled. `void`: canceled. `uncollectible`: written off.
  - `currency` ("usd", required): Always `usd`.
  - `period` (object, required): What period it covers.
    - `start` (string, required, date-time): When the period starts (inclusive).
    - `end` (string, required, date-time): When the period ends (exclusive).
  - `subtotal` (integer, required): An amount in cents (USD).
  - `discount` (integer, required): An amount in cents (USD).
  - `credit` (integer, required): An amount in cents (USD).
  - `tax` (integer, required): An amount in cents (USD).
  - `total` (integer, required): An amount in cents (USD).
  - `amount_paid` (integer, required): An amount in cents (USD).
  - `amount_due` (integer, required): An amount in cents (USD).
  - `collection_method` ("charge_automatically" | "send_invoice", required): `charge_automatically`: charged to the payment method. `send_invoice`: paid by `due_at`.
  - `due_at` (string | null, required, date-time): When payment is due. `null`: not set.
  - `finalized_at` (string | null, required, date-time): When it was finalized. `null`: not yet.
  - `paid_at` (string | null, required, date-time): When it was paid. `null`: not paid.
  - `voided_at` (string | null, required, date-time): When it was voided. `null`: it wasn't.
  - `hosted_url` (string | null, required): A page to view (and pay) the invoice.
  - `pdf_url` (string | null, required): The invoice as a PDF. `null`: not available.
- `has_more` (boolean, required)

Example:

```json
{
  "object": "list",
  "data": [
    {
      "object": "invoice",
      "id": "inv_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "number": "COSS-000042",
      "kind": "period",
      "status": "paid",
      "currency": "usd",
      "period": {
        "start": "2026-10-01T00:00:00.000Z",
        "end": "2026-11-01T00:00:00.000Z"
      },
      "subtotal": 7300,
      "discount": 0,
      "credit": 2500,
      "tax": 0,
      "total": 4800,
      "amount_paid": 4800,
      "amount_due": 0,
      "collection_method": "charge_automatically",
      "due_at": "2026-11-01T00:20:00.000Z",
      "finalized_at": "2026-11-01T00:20:00.000Z",
      "paid_at": "2026-11-01T00:21:00.000Z",
      "voided_at": null,
      "hosted_url": "https://invoice.stripe.com/i/acct_123/test_YWNjdF8x",
      "pdf_url": "https://pay.stripe.com/invoice/acct_123/test_YWNjdF8x/pdf"
    }
  ],
  "has_more": false
}
```

## Errors

- `400`: The `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `422`: A query parameter failed validation (`validation_error`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).