# Export

Once enhancement is complete, the project is ready to export. Export renders the final video file and makes it available as a downloadable MP4 and an MPEG-DASH streaming manifest.

## Triggering export

If you did not set `toAutoExport: true` when creating the project, trigger export manually:

```bash
curl -X POST "https://api.shuffll.com/api/v1/auth/project/6947b539cc95ea68854bb523/edit/export" \
  -H "x-api-key: YOUR_API_KEY"
```

**Response:**

```json
{ "projectId": "6947b539cc95ea68854bb523" }
```

**Prerequisite:** Enhancement must be complete before exporting. Check `GET /auth/project/{projectId}/edit/status/enhance` first.

## Polling export status

A `202` response means rendering is still in progress. A `200` response with `isDone: true` means the video is ready.

```bash
curl "https://api.shuffll.com/api/v1/auth/project/6947b539cc95ea68854bb523/edit/status/export" \
  -H "x-api-key: YOUR_API_KEY"
```

**In progress (HTTP 202):**

```json
{ "isDone": false }
```

**Complete (HTTP 200):**

```json
{
  "isDone": true,
  "urls": {
    "uploadPath": "https://cdn.shuffll.com/.../video.mp4",
    "dashPath": "https://cdn.shuffll.com/.../manifest.mpd"
  }
}
```

| URL field | Format | Use case |
|  --- | --- | --- |
| `uploadPath` | MP4 | Direct download, email links, storage |
| `dashPath` | MPEG-DASH manifest | Adaptive streaming in web players |


Recommended polling interval: every 5–10 seconds.

## Receiving export results via webhook

Set a `webhook` URL when creating the project to receive an automatic `POST` when export completes — no polling needed.

```json
{
  "type": "export",
  "payload": {
    "projectId": "6947b539cc95ea68854bb523",
    "projectName": "Why our SaaS product saves marketing teams 10 hours a week",
    "urls": {
      "uploadPath": "https://cdn.shuffll.com/.../video.mp4",
      "dashPath": "https://cdn.shuffll.com/.../manifest.mpd"
    },
    "additionalParams": { "userId": "usr_123" }
  }
}
```

The `additionalParams` value is whatever you passed in the original create request — useful for correlating the webhook event back to a user or job in your system.

## Full automated pipeline

To go from prompt to video with a single API call:

```bash
curl -X POST "https://api.shuffll.com/api/v1/auth/project/create" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Why our SaaS product saves marketing teams 10 hours a week",
    "language": "en",
    "videoLength": "medium",
    "toAutoEnhance": true,
    "toAutoExport": true,
    "webhook": "https://yourserver.com/webhooks/shuffll",
    "additionalParams": { "userId": "usr_123" }
  }'
```

Shuffll handles creation → enhancement → export automatically and sends a single webhook when the video is ready.