# Export orders

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


[Idempotency Supported](/docs/api/idempotency)

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

This API triggers export of order data. The exported zip file contains CSV files with order-related data.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/exports/orders \
     -u {site_api_key}:\
     -d "order[status][is]"="SHIPPED" \
     -d "order[amount_paid][is]"="1000"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Export.Orders()
		.OrderStatus().Is(Order.StatusEnum.Shipped)
		.OrderAmountPaid().Is(1000)
		.Request();

Export export = result.Export;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    exportAction "github.com/chargebee/chargebee-go/v3/actions/export"
    "github.com/chargebee/chargebee-go/v3/models/export"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := exportAction.Orders(&export.OrdersRequestParams{
        Order : &export.OrdersOrderParams{
            Status : &filter.EnumFilter{
                Is : "shipped",
            },
            AmountPaid : &filter.NumberFilter{
                Is : 1000,
            },
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Export := res.Export
    }
}
```

#### 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.ExportOrdersRequest{
    Order : &chargebee.ExportOrdersOrder{
        Status : &chargebee.EnumFilter{
            Is : "shipped",
        },
        AmountPaid : &chargebee.NumberFilter{
            Is : 1000,
        },
    },
}
  res, err := client.Export.Orders(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Export := res.Export
    }
}
```

#### Java

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

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Export.orders().orderStatus().is(Order.Status.SHIPPED).orderAmountPaid().is(1000L).request();

        Export export = result.export();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.export.Export;
import com.chargebee.v4.models.export.params.ExportOrdersParams;
import com.chargebee.v4.models.export.responses.ExportOrdersResponse;

public class ExportOrders {

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

        ExportOrdersParams.OrderParams order =
            ExportOrdersParams.OrderParams.builder()
                .status()
                .is(ExportOrdersParams.OrderParams.Status.SHIPPED)
                .amountPaid()
                .is(1000L)
                .build();

        ExportOrdersParams params = ExportOrdersParams.builder()
            .order(order)
            .build();

        ExportOrdersResponse response = client.exports().orders(params);

        Export export = response.getExport();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.export.orders({
        order: {
            status: {
                is: "shipped"
            },
            amount_paid: {
                is: 1000
            }
        }
    });

    console.log(result);
    const export_response = result.export;
} 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->export()->orders([
    "order" => [
        "status" => [
            "is" => "shipped"
        ],
        "amount_paid" => [
            "is" => 1000
        ]
    ]
]);
$export = $result->export;
```

#### Python

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

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Export.orders(
    cb_client.Export.OrdersParams(
        order=cb_client.Export.OrdersOrderParams(
            status=Filters.EnumFilter(IS=chargebee.Order.Status.SHIPPED),
            amount_paid=Filters.NumberFilter(IS="1000")
        )
    )
)
export = response.export
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Export.orders({
  "order[status][is]" => "shipped",
  "order[amount_paid][is]" => 1000
})

export = result.export
```

## Sample Response

```json
{
  "export": {
    "created_at": 1527791400,
    "id": "__test__KyVnHhSBWTDEb8r",
    "mime_type": "zip",
    "object": "export",
    "operation_type": "Orders",
    "status": "in_process"
  }
}
```

## URL Format

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

## Input Parameters

- `total` (optional, number)
  optional, in cents filter
  
  Total amount charged for the order. **Supported operators :** is, is\_not, lt, lte, gt, gte, between
  
  **Example →** _total\[is\] = "1394532759"_

- `order` (optional, string)
  Parameters for order
  - `id` (optional, string)
    Uniquely identifies the order. It is the api identifier for the order
  - `subscription_id` (optional, string)
    To filter based on subscription\_id.
  - `customer_id` (optional, string)
    The customer for which the order is created
  - `status` (optional, enumerated string)
    The status of this order.
  - `price_type` (optional, enumerated string)
    The price type of the order
  - `amount_paid` (optional, number)
    Total amount paid for the order.
  - `refundable_credits` (optional, number)
    The total amount that can be issued as credits for this order.
  - `refundable_credits_issued` (optional, number)
    The total amount issued as credits on behalf of this order.
  - `resent_status` (optional, enumerated string)
    Resent order status.
  - `is_resent` (optional, enumerated string)
    Order is resent order or not.
  - `original_order_id` (optional, string)
    If resent order what is the parent order id.
  - `order_date` (optional, timestamp(UTC) in seconds)
    The date on which the order will start getting processed.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `shipping_date` (optional, timestamp(UTC) in seconds)
    This is the date on which the order will be delivered to the customer.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `shipped_at` (optional, timestamp(UTC) in seconds)
    The time at which the order was shipped.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `delivered_at` (optional, timestamp(UTC) in seconds)
    The time at which the order was delivered
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `cancelled_at` (optional, timestamp(UTC) in seconds)
    The time at which the order was cancelled.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)
  - `updated_at` (optional, timestamp(UTC) in seconds)
    Filter based on the time at which order has been updated.
    - `after` (optional, timestamp(UTC) in seconds)
    - `before` (optional, timestamp(UTC) in seconds)
    - `on` (optional, timestamp(UTC) in seconds)

## Returns

- `export` (Export object)
  Resource object representing export
