---
title: "API quickstart"
description: "Create a video with the REST API, wait for it, and download it."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.mosio.me/llms.txt
> Use this file to discover all available pages before exploring further.

# API quickstart

## 1. Create an API key

In the dashboard, open **API key** and create a key. It starts with `ms_` and is shown once. Keep it on your server: anyone with the key can spend your workspace's credits.

```sh
export MOSIO_API_KEY=ms_...
```

## 2. Create a video

```sh
curl https://app.mosio.me/v1/videos \
  -H "x-api-key: $MOSIO_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "template": "promo-produk@1",
    "variables": {
      "judul": "Es Kopi Gula Aren",
      "harga": "Rp18.000",
      "harga_coret": "Rp22.000"
    },
    "idempotency_key": "kopi-senja-001"
  }'
```

The response comes back straight away, with `status: "queued"`:

```json
{
  "id": "vid_6f1c2b9e-0c1a-4b7e-9d0e-2f3a4b5c6d7e",
  "status": "queued",
  "template": "promo-produk@1",
  "created_at": "2026-10-20T10:15:01.105Z",
  "finished_at": null,
  "duration_seconds": null,
  "output_url": null,
  "error": null
}
```

Business name, colours, and contact come from your brand kit unless you send them. The variables each template takes are in the [template reference](/reference/templates).

Sending the same `idempotency_key` again returns the same video instead of rendering a second one. Reusing a key with a different body is refused with `409`.

## 3. Wait for it

Poll every few seconds until `status` is `done` (or `failed`):

```sh
curl https://app.mosio.me/v1/videos/vid_6f1c2b9e-0c1a-4b7e-9d0e-2f3a4b5c6d7e \
  -H "x-api-key: $MOSIO_API_KEY"
```

A 15-second video usually finishes in under a minute.

## 4. Download

When `status` is `done`, `output_url` is a short-lived link to the MP4. Download it right away, or fetch the video again later for a fresh link.

```sh
curl -L -o video.mp4 "<output_url>"
```

## Next

- Render your own HTML instead of a template: [Design your own video](/guides/design-your-own).
- Every endpoint, field, and error: [REST API](/api).

Source: https://docs.mosio.me/get-started/api-quickstart/index.mdx
