# export

`imerit_ango.sdk.SDK.`

## export(project\_id, options, zip\_file\_path)

Export data from your project.

### Parameters

* **project\_id:** string
  * The unique identifier for the project. You can find the project ID in [the user interface](https://docs.imerit.net/sdk/sdk-documentation/..#project-ids) or retrieve it using the [`list_projects`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/list_projects) function.
* **options:** ExportOptions, *default ExportOptions()*
  * An instance of the `ExportOptions` class, which defines the configurations for the export operation.
  * **ExportOptions** class
    * **stage:** List\[str], *default \['Complete']*
      * A list of stage IDs to include in the export. Use the [`get_project`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_project) function to retrieve IDs.&#x20;
      * Example: `["Complete", "a0000b0a-1111-0a00-a1a1-a111111111aa"]`
      * **Note:** Use an empty list to get all stages such as `stage = []`&#x20;
      * **Warning:** The IDs of the ***Complete***, ***Start*** and initial ***Label*** stages are identical to their names: **"Complete"**, **"Start"** and **"Label"**, respectively.
    * **batches:** List\[str], *default None*
      * Filter export by specific batch IDs. Use the [`get_batches`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_batches) function to retrieve IDs.
    * **task\_type:** TaskTypes, *default None*
      * Type of the exported data.
      * Options:
        * <kbd>TaskTypes.BENCHMARK</kbd>
        * <kbd>TaskTypes.CONSENSUS</kbd>
        * <kbd>TaskTypes.DEFAULT</kbd>
    * **export\_format:** ExportFormats, *default ExportFormats.JSON*
      * Format of the exported data.
      * **Options:**
        * <kbd>ExportFormats.JSON</kbd>
        * <kbd>ExportFormats.NDJSON</kbd>
    * **export\_type:** ExportTypes, *default ExportTypes.TASK*
      * Type of export.
      * **Options:**
        * <kbd>ExportTypes.TASK</kbd>&#x20;
        * <kbd>ExportTypes.ISSUE</kbd>
    * **include\_key\_frames\_only:** bool, *default False*
      * If True, only exports key frames (for video assets).
    * **send\_email:** bool, *default False*
      * If True, sends a notification email when export completes.
    * **include\_metadata:** bool, *default True*
      * If True, includes metadata with assets.
    * **include\_history:** bool, *default True*
      * If True, includes annotation history.
    * **notify:** bool, *default False*
      * If False, suppresses system notifications.
    * **updated\_at:** TimeFilter, *default None*
      * Filter assets by update timestamp. **Updated At** attribute displays the date and time when the task was last updated, this includes the most recent submission, save, or skip.
    * **created\_at:** TimeFilter, *default None*
      * Filter assets by creation timestamp. **Created At** attribute shows the date and time when the asset was imported into Ango Hub.
  * **TimeFilter** class
    * **from\_date:** datetime, *default None*
      * Start date for filtering.
    * **to\_date:** datetime, *default None*
      * End date for filtering.
* **zip\_file\_path**: string, optional, *default None*
  * If specified, exports are downloaded directly as a .zip file instead of being returned as a Python object. This avoids server-side unzipping and speeds up export.
  * **Example:** `"/Users/username/Downloads/my_export.zip"`

Returns:

* **output:** list
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

{% hint style="warning" %}

> The project must contain annotated assets, and the selected filters should include them; otherwise, the export will return empty.
> {% endhint %}

### Example

Export all assets in the Complete stage:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

export_data = ango_sdk.export(project_id=project_id)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X GET "https://imeritapi.ango.ai/v2/export \
  ?sendEmail=false \
  &includeMetadata=true \
  &includeHistory=true \
  &doNotNotify=true \
  &format=json \
  &type=task \
  &includeOnlyKeyFrames=false \
  &includeIdleBlurDurations=false \
  &stage=[\"Complete\"] \
  &project=$PROJECT_ID" \
  -H "apikey: $ANGO_API_KEY"
```

{% endtab %}
{% endtabs %}

Export assets filtered by created and updated time:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from datetime import datetime, timedelta
from imerit_ango.models.enums import ExportFormats
from imerit_ango.models.export_options import ExportOptions, TimeFilter

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

export_options = ExportOptions(
    export_format=ExportFormats.JSON,
    updated_at=TimeFilter(from_date=datetime.now() - timedelta(days=7), to_date=datetime.now()),
    created_at=TimeFilter(from_date=datetime.now() - timedelta(days=30), to_date=datetime.now()),
    stage=["Complete"]
)

export_data = ango_sdk.export(project_id=project_id, options=export_options)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X GET "https://imeritapi.ango.ai/v2/export \
  ?sendEmail=false \
  &includeMetadata=true \
  &includeHistory=true \
  &doNotNotify=true \
  &format=json \
  &type=task \
  &includeOnlyKeyFrames=false \
  &includeIdleBlurDurations=false \
  &stage=[\"Complete\"] \
  &updatedAt={\"$gt\":\"2020-08-19T07:37:15.000000Z\",\"$lt\":\"2020-08-26T07:37:15.000000Z\"} \
  &createdAt={\"$gt\":\"2020-07-27T07:37:15.000000Z\",\"$lt\":\"2020-08-26T07:37:15.000000Z\"} \
  &project=$PROJECT_ID" \
  -H "apikey: $ANGO_API_KEY"
```

{% endtab %}
{% endtabs %}

Export assets in NDJSON format:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.enums import ExportFormats
from imerit_ango.models.export_options import ExportOptions

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

export_options = ExportOptions(export_format=ExportFormats.NDJSON, stage=["Complete"])
export_generator, num_assets = ango_sdk.export(project_id=project_id, options=export_options)

print(f"Number of exported assets: {num_assets}")

for asset in export_generator:
    print(asset.get("externalId", ""))
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X GET \
  "https://imeritapi.ango.ai/v2/export \
    ?sendEmail=false \
    &includeMetadata=true \
    &includeHistory=true \
    &doNotNotify=true \
    &format=ndjson \
    &type=task \
    &includeOnlyKeyFrames=false \
    &includeIdleBlurDurations=false \
    &stage=[\"Complete\"] \
    &project=&PROJECT_ID" \
  -H "apikey: &ANGO_API_KEY"
```

{% endtab %}
{% endtabs %}

Export benchmark tasks:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.enums import TaskTypes
from imerit_ango.models.export_options import ExportOptions

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

export_options = ExportOptions(task_type=TaskTypes.BENCHMARK)
benchmark_export = ango_sdk.export(project_id=project_id, options=export_options)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**See also**

[get\_assets](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_assets), [get\_tasks](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_tasks)
{% endhint %}
