# Export Project

## Export Project Files

<mark style="color:green;">`POST`</mark> `https://api.annolab.ai/v1/export/project`

Export requested project details. Each element of the project will have its own "json lines" file and be included in a zip file package.

#### Headers

| Name          | Type   | Description                                                                                                                                                         |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Where you put your api key. Exporting a project requires a key with "Read" permissions.<br><code>{"Authorization": "Api-Key XXXXXXX-XXXXXXX-XXXXXXX"}</code></p> |

#### Request Body

| Name                                                | Type            | Description                                                                                                              |
| --------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------ |
| includeTextBounds                                   | boolean         | boolean of whether you want x,y text bounds of text of any pdfs in project                                               |
| annotationLayerIds                                  | array           | Array of layer ids that you wish to export. defaults to all layers                                                       |
| includeSources                                      | boolean         | boolean of whether you want source files to be include with the export. defaults to false                                |
| annotationLayerNames                                | array           | Array of strings containing the names of annotation layers you wish to be included in the export. defaults to all layers |
| projectIdentifier<mark style="color:red;">\*</mark> | string\|integer | Identifier for the project that will contain the annotation type. Either the id or the unique name.                      |
| includeAnnotationTypes                              | boolean         | Boolean to include annotation types with export. Defaults to false                                                       |
| sourceIds                                           | array           | array of source ids to export within the project                                                                         |

{% tabs %}
{% tab title="200 Export was generated successfully. content will be a zip file containing up to 6 json lines files and sub folders for each directory (if includeSources=True) |-------- <projectName>.annotations.jsonl|-------- <projectName>.atntypes.jsonl|-------- <projectName>.layers.jsonl|-------- <projectname>.relations.jsonl|-------- <projectName>.sources.jsonl" %}

```
{
    headers: {
        'Content-Type': 'application/zip',
        'Content-Disposition': `attachment; filename=New Ner Project.zip`
    }
    content: <byte-stream>
}
```

{% endtab %}
{% endtabs %}

This code shows how to request a project export

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

```python
import requests

ANNO_LAB_API_KEY = 'XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX'

exportRequestBody = {
  'projectIdentifier': 'New NER Project',
  'includeSources': True,
  'includeAnnotationTypes': True,
  'includeTestBounds': False
}

headers = {
  'Authorization': 'Api-Key '+ANNO_LAB_API_KEY,
}

url = 'https://api.annolab.ai/v1/export/project'

response = requests.post(url, headers=headers, json=exportRequestBody, stream=True)

if r.status_code == 200:
  d = r.headers['content-disposition']
  fileName = re.findall("filename=(.+)", d)[0]
  with open(fileName, 'wb') as f:
    for chunk in r.iter_content(1024):
      f.write(chunk)
```

{% endtab %}
{% endtabs %}
