# List orders

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


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

This API is used to retrieve a list of all the available orders.

## Sample Request

#### cURL

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

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Order.List()
		.Limit(3)
		.Status().Is(Order.StatusEnum.Queued)
		.Request();

foreach (var listItem in result.List){
  Order order = listItem.Order;
}
```

#### Go

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

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

#### 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 = Order.list()
            .limit(3)
            .status().is(Order.Status.QUEUED)
            .request();

        for (ListResult.Entry entry : result) {
            Order order = entry.order();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.order.Order;
import com.chargebee.v4.models.order.params.OrderListParams;
import com.chargebee.v4.models.order.responses.OrderListResponse;
import java.util.List;

public class OrderList {

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

        OrderListParams params = OrderListParams.builder()
            .limit(3)
            .status()
            .is(OrderListParams.Status.QUEUED)
            .build();

        OrderListResponse response = client.orders().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

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

#### Python

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

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Order.list(
    cb_client.Order.ListParams(
        limit=3,
        status=Filters.EnumFilter(IS=chargebee.Order.Status.QUEUED)
    )
)
for entry in entries.list:
    order = entry.order
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::Order.list({
  :limit => 3,
  "status[is]" => "queued"
})

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

## Sample Response

```json
{
  "list": [
    {
      "order": {
        "amount_adjusted": 0,
        "amount_paid": 40000,
        "base_currency_code": "USD",
        "created_at": 1517505898,
        "created_by": "Auto generated by system",
        "currency_code": "USD",
        "customer_id": "__test__KyVnHhSBWloVR2mr",
        "deleted": false,
        "discount": 0,
        "document_number": "1",
        "exchange_rate": 1,
        "id": "1",
        "invoice_id": "__demo_inv__1",
        "is_gifted": false,
        "linked_credit_notes": {},
        "object": "order",
        "order_date": 1517505897,
        "order_line_items": [
          {
            "amount": 40000,
            "amount_adjusted": 0,
            "amount_paid": 40000,
            "description": "MB1S1P",
            "discount_amount": 0,
            "entity_id": "MB1S1P",
            "entity_type": "plan",
            "fulfillment_amount": 40000,
            "fulfillment_quantity": 1,
            "id": "o_li__test__KyVnGlSBWloic26i",
            "invoice_id": "__demo_inv__1",
            "invoice_line_item_id": "li___test__KyVnHhSBWloWi2mt",
            "is_shippable": true,
            "item_level_discount_amount": 0,
            "object": "order_line_item",
            "refundable_credits": 40000,
            "refundable_credits_issued": 0,
            "status": "queued",
            "tax_amount": 0,
            "unit_price": 40000
          },
          {..}
        ],
        "order_type": "system_generated",
        "paid_on": 1517505897,
        "payment_status": "paid",
        "price_type": "tax_exclusive",
        "refundable_credits": 40000,
        "refundable_credits_issued": 0,
        "resource_version": 1517505898000,
        "rounding_adjustement": 0,
        "shipping_date": 1517505897,
        "status": "queued",
        "sub_total": 40000,
        "subscription_id": "__test__KyVnHhSBWloVR2mr",
        "tax": 0,
        "total": 40000,
        "updated_at": 1517505898
      }
    },
    {..}
  ]
}
```

## URL Format

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

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

- `exclude_deleted_credit_notes` (optional, boolean)
  Flag to indicate whether deleted credit notes should be passed or not.

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

- `order` (Order object)
  Resource object representing order
