# List unbilled charges

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


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

This endpoint lists all the unbilled charges.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/unbilled_charges \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=2 \
     --data-urlencode "customer_id[is]"="__test__8aszcSOcqy1i6F"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = UnbilledCharge.List()
		.Limit(2)
		.CustomerId().Is("__test__8aszcSOcqy1i6F")
		.Request();

foreach (var listItem in result.List){
  UnbilledCharge unbilledCharge = listItem.UnbilledCharge;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    unbilledchargeAction "github.com/chargebee/chargebee-go/v3/actions/unbilledcharge"
    "github.com/chargebee/chargebee-go/v3/models/unbilledcharge"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := unbilledchargeAction.List(&unbilledcharge.ListRequestParams{
        Limit : chargebee.Int32(2),
        CustomerId : &filter.StringFilter{
            Is : "__test__8aszcSOcqy1i6F",
        },
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            UnbilledCharge := res.List[idx].UnbilledCharge
        }
    }
}
```

#### 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.UnbilledChargeListRequest{
    Limit : chargebee.Int32(2),
    CustomerId : &chargebee.StringFilter{
        Is : "__test__8aszcSOcqy1i6F",
    },
}
  res, err := client.UnbilledCharge.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            UnbilledCharge := res.List[idx].UnbilledCharge
        }
    }
}
```

#### 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 = UnbilledCharge.list()
            .limit(2)
            .customerId().is("__test__8aszcSOcqy1i6F")
            .request();

        for (ListResult.Entry entry : result) {
            UnbilledCharge unbilledCharge = entry.unbilledCharge();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.unbilledCharge.UnbilledCharge;
import com.chargebee.v4.models.unbilledCharge.params.UnbilledChargeListParams;
import com.chargebee.v4.models.unbilledCharge.responses.UnbilledChargeListResponse;
import java.util.List;

public class UnbilledChargeList {

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

        UnbilledChargeListParams params = UnbilledChargeListParams.builder()
            .limit(2)
            .customerId()
            .is("__test__8aszcSOcqy1i6F")
            .build();

        UnbilledChargeListResponse response = client.unbilledCharges().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.unbilledCharge.list({
        limit: 2,
        customer_id: {
            is: "__test__8aszcSOcqy1i6F"
        }
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const unbilledCharge = entry.unbilled_charge;
    });
} 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->unbilledCharge()->all([
    "limit" => 2,
    "customer_id" => [
        "is" => "__test__8aszcSOcqy1i6F"
    ]
]);
foreach($result->list as $entry) {
    $unbilledCharge = $entry->unbilled_charge;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.UnbilledCharge.list(
    cb_client.UnbilledCharge.ListParams(
        limit=2,
        customer_id=Filters.StringFilter(IS="__test__8aszcSOcqy1i6F")
    )
)
for entry in entries.list:
    unbilled_charge = entry.unbilled_charge
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::UnbilledCharge.list({
  :limit => 2,
  "customer_id[is]" => "__test__8aszcSOcqy1i6F"
})

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

## Sample Response

```json
{
  "list": [
    {
      "unbilled_charge": {
        "id": "li___dev__XpbJ77CVDP3zcg3B",
        "customer_id": "_cb_test_demo_",
        "subscription_id": "__dev__XpbJ77CVDP3zQI38",
        "date_from": 1773087389,
        "date_to": 1775765789,
        "unit_amount": 4200,
        "pricing_model": "per_unit",
        "quantity": 1,
        "amount": 4200,
        "discount_amount": 0,
        "description": "Data Compliance Add-on Monthly",
        "entity_id": "cbdemo_data-compliance-addon-monthly",
        "is_voided": false,
        "created_at": 1773087390,
        "updated_at": 1773087390,
        "deleted": false,
        "object": "unbilled_charge",
        "entity_type": "addon_item_price",
        "currency_code": "USD"
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/unbilled_charges

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

- `include_deleted` (optional, boolean, default=false)
  If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '.

- `is_voided` (optional, boolean, default=false)
  Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration.

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

- `unbilled_charge` (Unbilled charge object)
  Resource object representing unbilled\_charge
