> For the complete documentation index, see [llms.txt](https://docs.datasaur.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasaur.ai/api/get-data/export-team-overview.md).

# Export team overview

## cURL

Use the following cURL command to create a project. You can copy and paste the following template and replace the `access_token`, `teamId`, and `method`.

```
curl --location --request POST 'https://datasaur.ai/graphql' \
--header 'Authorization: Bearer access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "query ExportTeamOverview($input: ExportTeamOverviewInput!) { exportTeamOverview(input:$input) { exportId fileUrl } }",
    "variables": {
        "input": {
	    "teamId": "121",
	    "method": "FILE_STORAGE"
        }
    }
}'
```

* **variables**
  * **input**
    * **teamId**
    * **method:** define how the export result will be delivered. The most used methods are:
      * `EMAIL`
      * `FILE_STORAGE`

## Response

### Email

If the `method` is set as `EMAIL`, the export result will be sent to `access_token` owner's email. Below is a sample response:

```
{
   "data":{
      "exportTeamOverview":{
         "exportId":"ExportQueue:2d1cfa43-c612-45c7-8f91-fbca03932eb9",
         "fileUrl":null
      }
   },
   "extensions":{}
}
```

### File storage

If the `method` is set as `FILE_STORAGE`, the export result will be uploaded to Datasaur's temporary Amazon S3 bucket and the file URL is returned. Below is a sample response:

```
{
   "data":{
      "exportTeamOverview":{
         "exportId":"ExportQueue:09df73b8-c38a-4238-a2d7-bde51dc9d293",
         "fileUrl":"https://vulcan-prod-private.s3.amazonaws.com/export/team-overview/121/1643090963803/Team%20Overview%20-%20Team%20Alvin.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAZ5X7NDLAVQ4BD4EC%2F20220125%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220125T060923Z&X-Amz-Expires=21600&X-Amz-Signature=315b6f89304f57ff47afdf388be5449f592b5be635d6d86e39a126a3ca6d3631&X-Amz-SignedHeaders=host"
      }
   },
   "extensions":{}
}
```

The client can download the file from the URL defined in `fileUrl`.

**Note:** `fileUrl` is returned optimistically. This means the export result may not have been fully uploaded to the Amazon S3 bucket yet, and the file might not be immediately available for download.

To avoid download errors, the client should poll the file URL using a range request and only start downloading the file after receiving an HTTP `206 Partial Content` response.
