# List invoices

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Eventually Consistent](/docs/api/v1/read-consistency)

Lists all the Invoices.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v1/invoices \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=3
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Invoice.List()
		.Limit(3)
		.Request();

foreach (var listItem in result.List){
  Invoice invoice = listItem.Invoice;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    invoiceAction "github.com/chargebee/chargebee-go/v3/actions/invoice"
    "github.com/chargebee/chargebee-go/v3/models/invoice"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := invoiceAction.List(&invoice.ListRequestParams{
        Limit : chargebee.Int32(3),
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Invoice := res.List[idx].Invoice
        }
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.InvoiceListRequest{
    Limit : chargebee.Int32(3),
}
  res, err := client.Invoice.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Invoice := res.List[idx].Invoice
        }
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.util.List;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        ListResult result = Invoice.list()
            .limit(3)
            .request();

        for (ListResult.Entry entry : result) {
            Invoice invoice = entry.invoice();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.invoice.Invoice;
import com.chargebee.v4.models.invoice.params.InvoiceListParams;
import com.chargebee.v4.models.invoice.responses.InvoiceListResponse;
import java.util.List;

public class InvoiceList {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        InvoiceListParams params = InvoiceListParams.builder()
            .limit(3)
            .build();

        InvoiceListResponse response = client.invoices().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.invoice.list({
        limit: 3
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const invoice = entry.invoice;
    });
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->invoice()->all([
    "limit" => 3
]);
foreach($result->list as $entry) {
    $invoice = $entry->invoice;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Invoice.list(
    cb_client.Invoice.ListParams(
        limit=3
    )
)
for entry in entries.list:
    invoice = entry.invoice
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

list = ChargeBee::Invoice.list({
  :limit => 3
})

list.each do |entry|
  invoice = entry.invoice
end
```

## Sample Response

```json
{
  "list": [
    {
      "invoice": {
        "amount": 895,
        "amount_adjusted": 0,
        "amount_due": 0,
        "amount_paid": 895,
        "billing_address": {
          "first_name": "Rachel",
          "last_name": "Green",
          "object": "billing_address"
        },
        "credits_applied": 0,
        "currency_code": "USD",
        "customer_id": "__test__3Nl7oZlRNQya2D1h",
        "dunning_status": "stopped",
        "end_date": 1554824039,
        "first_invoice": false,
        "id": "__demo_inv__12",
        "line_items": [
          {
            "amount": 895,
            "date_from": 1554824039,
            "date_to": 1557416039,
            "description": "No Trial",
            "entity_id": "no_trial",
            "entity_type": "plan",
            "is_taxed": false,
            "object": "line_item",
            "quantity": 1,
            "tax": 0,
            "type": "charge",
            "unit_amount": 895
          },
          {..}
        ],
        "linked_orders": {},
        "linked_transactions": [
          {
            "applied_amount": 895,
            "applied_at": 1517492040,
            "txn_amount": 895,
            "txn_date": 1517492040,
            "txn_id": "txn___test__3Nl7obaRNQyaUq1O",
            "txn_status": "success",
            "txn_type": "payment"
          },
          {..}
        ],
        "object": "invoice",
        "paid_on": 1517492040,
        "price_type": "tax_exclusive",
        "recurring": true,
        "start_date": 1554730438,
        "status": "paid",
        "sub_total": 895,
        "subscription_id": "__test__3Nl7oZlRNQya2D1h",
        "tax": 0
      }
    },
    {..}
  ],
  "next_offset": "[\"1554730442000\",\"192000000084\"]"
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v1/invoices

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  The number of resources to be returned.

- `offset` (optional, string, max chars=1000)
  Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call.

- `paid_on_after` (optional, timestamp(UTC) in seconds)
  Returns only the invoices that got paid at/after this time. Invoices list will be sorted by 'paid\_on' in ascending order.

## Returns

- `next_offset` (optional, string, max chars=1000)
  This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.

- `invoice` (Invoice object)
  Resource object representing invoice
