# List Disputes

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


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

Lists the disputes raised against the transactions on your site, with the most recently created dispute first.

Use the filter parameters to narrow the list to the disputes you want to act on. For example, filter on `status` to work through the disputes that are still open, or on `customer_id` to review every dispute raised by one customer.

This operation does not support a `sort_by` parameter. The results are always ordered by `created_at` in descending order.

## Sample Request

#### Chargebee CLI

```bash
chargebee dispute list \
    -d limit=2 \
    -d 'status[is]=initiated'
```

#### cURL

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

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Dispute.List()
		.Limit(2)
		.Status().Is(Dispute.StatusEnum.Initiated)
		.Request();

foreach (var listItem in result.List){
  Dispute dispute = listItem.Dispute;
}
```

#### Go

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

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

#### 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 = Dispute.list()
            .limit(2)
            .status().is(Dispute.Status.INITIATED)
            .request();

        for (ListResult.Entry entry : result) {
            Dispute dispute = entry.dispute();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.dispute.Dispute;
import com.chargebee.v4.models.dispute.params.DisputeListParams;
import com.chargebee.v4.models.dispute.responses.DisputeListResponse;
import java.util.List;

public class DisputeList {

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

        DisputeListParams params = DisputeListParams.builder()
            .limit(2)
            .status()
            .is(DisputeListParams.Status.INITIATED)
            .build();

        DisputeListResponse response = client.disputes().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

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

#### Python

```python
import chargebee
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Dispute.list(
    cb_client.Dispute.ListParams(
        limit=2,
        status=Filters.EnumFilter(IS=chargebee.Dispute.Status.INITIATED)
    )
)
for entry in entries.list:
    dispute = entry.dispute
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::Dispute.list({
  :limit => 2,
  "status[is]" => "initiated"
})

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

## Sample Response

```json
{
  "list": [
    {
      "dispute": {
        "id": "dspt___test__KyVnHhSBWmDspt1",
        "customer_id": "__test__KyVnHhSBWlwxY2qJ",
        "transaction_id": "txn___test__KyVnHhSBWlxBX2qV",
        "gateway_account_id": "gw___test__KyVnGlSBWltEk29Z",
        "id_at_gateway": "cb___test__KyVnHhSBWlv4q2pU",
        "currency_code": "USD",
        "amount": 1200,
        "reason": "fraudulent",
        "status": "initiated",
        "type": "chargeback",
        "is_partial_dispute": false,
        "created_at": 1517505929,
        "resource_version": 1517505929000,
        "updated_at": 1517505929,
        "object": "dispute"
      }
    },
    {..}
  ],
  "next_offset": "[\"1517505921000\",\"266000001127\"]"
}
```

## URL Format

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

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

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

- `dispute` (Dispute object)
  Resource object representing dispute
