# Export items

> 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 item data. The exported zip file contains CSV files with item-related data.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/exports/items \
     -u {site_api_key}:\
     -d "item[type][is]"="PLAN" \
     -d "item[status][is]"="ACTIVE"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Export.Items()
		.ItemType().Is(Item.TypeEnum.Plan)
		.ItemStatus().Is(Item.StatusEnum.Active)
		.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.Items(&export.ItemsRequestParams{
        Item : &export.ItemsItemParams{
            Type : &filter.EnumFilter{
                Is : "plan",
            },
            Status : &filter.EnumFilter{
                Is : "active",
            },
        },
    }).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.ExportItemsRequest{
    Item : &chargebee.ExportItemsItem{
        Type : &chargebee.EnumFilter{
            Is : "plan",
        },
        Status : &chargebee.EnumFilter{
            Is : "active",
        },
    },
}
  res, err := client.Export.Items(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.items().itemType().is(Item.Type.PLAN).itemStatus().is(Item.Status.ACTIVE).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.ExportItemsParams;
import com.chargebee.v4.models.export.responses.ExportItemsResponse;

public class ExportItems {

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

        ExportItemsParams.ItemParams item =
            ExportItemsParams.ItemParams.builder()
                .type()
                .is(ExportItemsParams.ItemParams.Type.PLAN)
                .status()
                .is(ExportItemsParams.ItemParams.Status.ACTIVE)
                .build();

        ExportItemsParams params = ExportItemsParams.builder()
            .item(item)
            .build();

        ExportItemsResponse response = client.exports().items(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.items({
        item: {
            type: {
                is: "plan"
            },
            status: {
                is: "active"
            }
        }
    });

    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()->items([
    "item" => [
        "type" => [
            "is" => "plan"
        ],
        "status" => [
            "is" => "active"
        ]
    ]
]);
$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.items(
    cb_client.Export.ItemsParams(
        item=cb_client.Export.ItemsItemParams(
            type=Filters.EnumFilter(IS=chargebee.Item.Type.PLAN),
            status=Filters.EnumFilter(IS=chargebee.Item.Status.ACTIVE)
        )
    )
)
export = response.export
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Export.items({
  "item[type][is]" => "plan",
  "item[status][is]" => "active"
})

export = result.export
```

## Sample Response

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

## URL Format

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

## Input Parameters

- `business_entity_id` (optional, string)
  optional, string filter
  
  The unique ID of the [business entity](/docs/api/business_entities) of this `item`. [Learn more](/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter.
  
  **Supported operators :** is, is\_present
  
  **Example →** _business\_entity\_id\[is\_present\] = "true"_

- `include_site_level_resources` (optional, enumerated string)
  optional, boolean filter
  
  Default value is `true` . To exclude site-level resources in specific cases, set this parameter to `false`. Possible values are : _true, false_
  
  **Supported operators :** is
  
  **Example →** _include\_site\_level\_resources\[is\] = "null"_

- `item` (optional, string)
  Parameters for item
  - `id` (optional, string)
    Filter items based on item id.
  - `item_family_id` (optional, string)
    Filter items based on `item_family_id` .
  - `type` (optional, enumerated string)
    Filter items based on item `type` .
  - `name` (optional, string)
    Filter items based on item `name` .
  - `item_applicability` (optional, enumerated string)
    Filter items based on `item_applicability` .
  - `status` (optional, enumerated string)
    Filter items based on item `status` .
  - `is_giftable` (optional, enumerated string)
    Specifies if gift subscriptions can be created for this item.
  - `enabled_for_checkout` (optional, enumerated string)
    Allow the plan to subscribed to via Checkout. Applies only for plan-items. **Note:** Only the in-app layout of Checkout is supported.
  - `enabled_in_portal` (optional, enumerated string)
    Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription) .
  - `metered` (optional, enumerated string)
    Specifies whether the item undergoes metered billing. When `true`, the quantity is calculated from [usage records](/docs/api/usages). When `false`, the `quantity` is as determined while adding an item price to the subscription. Applicable only for items of `type` `plan` or `addon` and when [Metered Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing) is enabled. The value of this attribute cannot be changed.
  - `usage_calculation` (optional, enumerated string)
    How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is `metered`. This value overrides the one [set at the site level](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) .
  - `channel` (optional, enumerated string)
    The subscription channel this object originated from and is maintained in.
  - `updated_at` (optional, timestamp(UTC) in seconds)
    Filter items based on when the items were last 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
