# Export and publishing

> How to render a video through the Slicer API with the file settings you need, download it and publish it to YouTube, Instagram and VK Video.

Source: https://docs.slicer.media/en/api/export/

Export re-renders the video from the current document — with all edits and the chosen style — and saves a file with the settings you specify. Export is free. Right after rendering, Slicer can publish the video to your connected social accounts.

## Start an export

Terminal:

```bash
curl https://api.slicer.media/v1/projects/318/export \
  -H "Authorization: Bearer $SLICER_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"profile":{"resolution":"1080p","fps":30,"quality":"high"}}'
```

The response is the project with the `queued` status: an export is a run just like a montage, with stages and progress from 0 to 100%. Wait for `succeeded` by polling `GET /v1/projects/{id}` or with the `export.succeeded` [webhook](https://docs.slicer.media/en/api/webhooks/).

If an export fails or is stopped, the project stays ready with the previous video — nothing is lost. While rendering is in progress, edits and a new export answer `409 busy`.

For a [project without the AI director](https://docs.slicer.media/en/api/montage/#manual), the first successful export turns the draft (`draft`) into a finished project (`succeeded`); a failed one leaves it a draft. The number of free exports of such projects per day is limited: beyond it the response is `429 daily_export_limit`.

## File settings

`profile` is optional: without it the video gets the **Social** profile. You can pass only some fields — the rest use their defaults.

| Field | Values | Default |
| --- | --- | --- |
| `container` | `mp4`, `mov` | `mp4` |
| `codec` | `h264`, `hevc` | `h264` |
| `resolution` | `720p`, `1080p`, `1440p`, `2160p` — by the short side of the frame | `1080p` |
| `fps` | `24`, `25`, `30` | `30` |
| `quality` | `balanced`, `high`, `max` | `high` |
| `colorDepth` | `8`, `10` — 10-bit only with `hevc` | `8` |
| `audioBitrate` | `128`, `192`, `256`, `320` kbps | `192` |
| `loudness` | `-14` (social), `-16` (podcasts), `-23` (TV), LUFS | `-14` |

Ready-made presets — `GET /v1/export-presets`:

| Preset | Profile |
| --- | --- |
| `social` | MP4, H.264, 1080p, 30 fps, high quality, 8-bit, AAC 192, −14 LUFS |
| `master` | MOV, HEVC, 1080p, 30 fps, maximum quality, 10-bit, AAC 320 |
| `youtube4k` | MP4, H.264, 2160p, 30 fps, high quality, AAC 256 |
| `compact` | MP4, HEVC, 720p, 30 fps, balanced quality, AAC 128 |

More on the settings in the guide [Export: presets and file settings](https://docs.slicer.media/en/guide/publish/export/).

## Download the video and cover

Terminal:

```bash
curl -f -o reel.mp4 "https://api.slicer.media/v1/projects/318/result" \
  -H "Authorization: Bearer $SLICER_TOKEN"

curl -f -o cover.jpg "https://api.slicer.media/v1/projects/318/poster" \
  -H "Authorization: Bearer $SLICER_TOKEN"
```

-   The file type follows the container: `video/mp4` or `video/quicktime`; the extension is in the project's `result.container`.
-   Range requests are supported: downloads can be resumed and the video played with seeking.
-   `?version=902` — the file of a specific version from `GET /v1/projects/{id}/versions`.
-   Parameters of the finished file (frame size, codec, frame rate, bitrate) are in `result.info`.

There are no download links without a token: the file is served only to its owner. To show the video to someone, give them the `appUrl` link — the project opens in the web app after signing in.

## Publishing to social networks

Publishing requires the `publish` scope. The social account must first be connected in the app — **Profile** → **Social accounts**: signing in to a platform needs the owner's browser and can't be done through the API.

### 1. Find the connected accounts

Terminal:

```bash
curl https://api.slicer.media/v1/social/accounts -H "Authorization: Bearer $SLICER_TOKEN"
```

Response:

```json
{
  "ok": true,
  "data": [
    { "id": 41, "platform": "youtube", "name": "Studio Anna", "status": "active", "apiPublishing": true },
    { "id": 42, "platform": "instagram", "name": "anna.studio", "status": "active", "apiPublishing": true },
    { "id": 43, "platform": "tiktok", "name": "anna.studio", "status": "active", "apiPublishing": false }
  ]
}
```

`apiPublishing: false` means you can't publish to this account through the API: access has expired or it's TikTok.

### 2. Export with publishing

Body of POST /v1/projects/318/export:

```json
{
  "profile": { "resolution": "1080p" },
  "publish": [
    {
      "accountId": 41,
      "title": "A reel in 3 minutes",
      "caption": "How to make a reel from a single video #shorts",
      "options": { "youtube": { "privacy": "public", "madeForKids": false } }
    },
    {
      "accountId": 42,
      "caption": "A reel in 3 minutes ✂️ #reels",
      "options": { "instagram": { "shareToFeed": true } }
    }
  ]
}
```

Publishing starts right after rendering. Up to 8 accounts per export.

### 3. Track the publications

`GET /v1/projects/{id}/publications` — the status of each publication: `waiting` (waiting for the render), `queued`, `uploading`, `processing` (the platform is processing it), `published` (`url` links to the video), `failed` (`errorCode` has the reason), `cancelled`. The same events arrive as the `publication.published` and `publication.failed` [webhooks](https://docs.slicer.media/en/api/webhooks/).

Platform settings in `options`:

| Platform | Fields |
| --- | --- |
| YouTube | `youtube.privacy` — `public`, `unlisted`, `private`; `youtube.madeForKids` |
| Instagram | `instagram.shareToFeed` — also show the reel in the feed |
| VK Video | `vk.privacy` — `all`, `friends`, `only_me`; `vk.wallpost` — post to the wall; `vk.groupId` — a community, or `null` (your own page) |
| All | `aiGenerated` — label the video as made with AI |

`title` is the title (YouTube, VK, up to 150 characters), `caption` — the description and hashtags (up to 5000 characters). Slicer takes care of each platform's file requirements: if needed, a separate copy of the file is made for each network.

> **Note.** **TikTok — only from the Slicer app.** TikTok's rules require the creator to choose who can see the video and confirm consent in the interface. Trying to publish to TikTok through the API returns `400 platform_requires_app`. Details — [Publishing to YouTube, Instagram, TikTok, VK](https://docs.slicer.media/en/guide/publish/platforms/).

## What's next

[WebhooksLearn about a finished file and publication without polling.](https://docs.slicer.media/en/api/webhooks/)[Reference: exportExport, publication and account endpoints.](https://docs.slicer.media/en/api/reference/export/)[A reel from a folderRecipe: from files to a published video.](https://docs.slicer.media/en/api/recipes/folder-to-reels/)
