# Export tasks and/or job templates as NDJSON bundle

> Source: https://docs.clonepartner.com/api-reference/export-import/export-bundle/

`GET /api/export`

Streams a newline-delimited JSON bundle. Tasks are emitted before job templates.
Requires admin or superadmin role.

**Operation ID:** `exportBundle`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Query parameters

- `include_tasks` — `boolean`
  Example: `true`
  - Default: `true`
- `include_job_templates` — `boolean`
  Example: `false`
  - Default: `false`
- `task_names` — `string`
  Comma-separated task names to export (legacy; use repeated task_name for names that contain commas)
- `task_name` — `array<string>`
  Exact task name to export. May be repeated.
  - Items:
    - Type: `string`
- `job_template_names` — `string`
  Comma-separated job template names to export (legacy; use repeated job_template_name for names that contain commas)
- `job_template_name` — `array<string>`
  Exact job template name to export. May be repeated.
  - Items:
    - Type: `string`
- `status` — `string`
  Example: `active`
  - Allowed values: `active`, `archived`
  - Default: `active`
- `include_archived` — `boolean`
  Example: `false`
  - Default: `false`
- `include_versions` — `boolean`
  Example: `false`
  - Default: `false`

## Success responses

### 200

NDJSON export stream

**Content type:** `application/x-ndjson`

- Type: `string`

## Examples

### cURL

```bash
curl --request GET \
  --url 'https://your-envoy.example.com/api/export' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/export', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
