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

# Quickstart

> Send your first generation request to the Vigen API and fetch the result in three steps.

What you need: one [API key](https://docs.vidgen.id/en/register.md) starting with `vg_` and either an active credit balance or an active Unlimited package.

**1. Create a job**

`POST /api/v1/generate` accepts a prompt, a model name, and a few parameters. The answer is `202 Accepted` — the job is queued, not finished.

> [tab] cURL
>
> ```bash theme={null} theme={null}
> curl -X POST https://vigen.id/api/v1/generate \
>   -H "Authorization: Bearer vg_GANTI_DENGAN_KEY_KAMU" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "seedance-2-5-flash",
>     "prompt": "Seekor rubah melintasi salju tipis di pagi buta, kamera steadicam mengikuti dari samping",
>     "parameters": {
>       "duration": "5",
>       "ratio": "16:9",
>       "resolution": "720p"
>     }
>   }'
> ```

> [tab] Node.js
>
> ```js theme={null} theme={null}
> const res = await fetch("https://vigen.id/api/v1/generate", {
>   method: "POST",
>   headers: {
>     Authorization: `Bearer ${process.env.VIGEN_API_KEY}`,
>     "Content-Type": "application/json",
>   },
>   body: JSON.stringify({
>     model: "seedance-2-5-flash",
>     prompt: "Seekor rubah melintasi salju tipis di pagi buta, kamera steadicam mengikuti dari samping",
>     parameters: { duration: "5", ratio: "16:9", resolution: "720p" },
>   }),
> });
>
> const { job } = await res.json();
> console.log(job.id, job.status);
> ```

> [tab] Python
>
> ```python theme={null} theme={null}
> import os
> import requests
>
> res = requests.post(
>     "https://vigen.id/api/v1/generate",
>     headers={"Authorization": f"Bearer {os.environ['VIGEN_API_KEY']}"},
>     json={
>         "model": "seedance-2-5-flash",
>         "prompt": "Seekor rubah melintasi salju tipis di pagi buta, kamera steadicam mengikuti dari samping",
>         "parameters": {"duration": "5", "ratio": "16:9", "resolution": "720p"},
>     },
> )
>
> job = res.json()["job"]
> print(job["id"], job["status"])
> ```

**2. Read the response**

The structure is always the same:

```json theme={null} theme={null}
{
  "success": true,
  "job": {
    "id": "9f2c1d34-a8b7-4e0f-9a1b-2c3d4e5f6a7b",
    "status": "queued",
    "model": "seedance-2-5-flash",
    "category": "Video",
    "prompt": "Seekor rubah melintasi salju tipis di pagi buta...",
    "creditsCharged": 3,
    "createdAt": "2026-11-04T09:12:44.000Z"
  },
  "queue": {
    "position": 2,
    "status": "queued"
  }
}
```

Store `job.id`. Everything that happens next is read through that id.

> [!WARNING]
>
> `creditsCharged` was already deducted at this step. If the job eventually fails, the credits are refunded automatically — but if you resend the same prompt without an `idempotencyKey`, you will pay twice.

**3. Poll until it finishes**

`GET /api/v1/jobs/{jobId}` returns the latest status. Check every 5 seconds; short clips usually finish within a few minutes, but queue length plays a part.

```bash theme={null} theme={null}
curl https://vigen.id/api/v1/jobs/9f2c1d34-a8b7-4e0f-9a1b-2c3d4e5f6a7b \
  -H "Authorization: Bearer vg_GANTI_DENGAN_KEY_KAMU"
```

```json theme={null} theme={null}
{
  "success": true,
  "job": {
    "id": "9f2c1d34-a8b7-4e0f-9a1b-2c3d4e5f6a7b",
    "status": "succeeded",
    "model": "seedance-2-5-flash",
    "category": "Video",
    "queuePosition": null,
    "result": {
      "url": "https://vigen.id/api/media-proxy?token=...",
      "duration": 5,
      "width": 1280,
      "height": 720
    },
    "errorMessage": null,
    "creditsCharged": 3,
    "createdAt": "2026-11-04T09:12:44.000Z",
    "updatedAt": "2026-11-04T09:15:02.000Z"
  }
}
```

Possible statuses: `queued`, `dispatching`, `processing`, `succeeded`, `failed`, `cancelled`. Until the status is `succeeded`, the `result` field is `null`.

**4. Download and store it**

`result.url` is guaranteed to be publicly accessible for **24 hours**. After that the link stops working.

```bash theme={null} theme={null}
curl -L -o video.mp4 "https://vigen.id/api/media-proxy?token=..."
```

Save the file to your own storage (S3, R2, disk) as soon as the status is `succeeded`. Do not keep the URL as your archive.

## Common next steps

* [Choose a model and parameters](https://docs.vidgen.id/en/concepts/models.md) — the catalog can be read at runtime through `GET /api/v1/models`.
* [Send reference images/video](https://docs.vidgen.id/en/concepts/reference-media.md) — for face-lock, products, or motion control.
* [Safe retries with idempotencyKey](https://docs.vidgen.id/en/concepts/idempotency.md).
* [Error code table](https://docs.vidgen.id/en/troubleshooting/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.