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

# Auto Video API (workflow)

> Complete documentation for the auto video generation workflow + status polling

# Auto Video API (workflow)

This API generates a full video automatically from a listing (description + images). The server will:

* pick **up to 5** images (depending on how many you provide)
* generate a short marketing text per selected image
* generate video clips (one per selected image)
* render the final video

The workflow uses **two endpoints**:

* **1) POST** `"/api/video-editor/generate/video/auto"`: starts a generation and returns an `id`
* **2) GET** `"/api/video-editor/generate/video/auto/{id}"`: polls the status (and triggers next server-side steps)

## Authentication

All requests must include:

* `x-api-key: YOUR_API_KEY`

## 1) Start a generation

**POST /api/video-editor/generate/video/auto**

### Headers

**x-api-key** `string` *required*

Your IACrea API key

**Content-Type** `string` *required*

Must be `application/json`

### Request body

**image\_urls** `array` *required*

Array of image URLs. **Minimum 1**.

**description** `string` *required*

Listing description (min 10 chars). Detected language is used for generated
texts.

**format** `string`

Video format: `"landscape" | "portrait" | "square"`. Default: `"landscape"`.

**colors** `array`

Two colors `[background, text]` (e.g. `["#1a1a2e", "#ffffff"]`). Optional.

**font** `string`

Font (e.g. `"Inter"`). Optional.

**music** `string`

Music value (internal identifier / value expected by your setup). Optional.

**displayLogo** `boolean`

Whether to display a logo. Default: `false`.

**logoUrl** `string`

Logo URL (required if `displayLogo=true`). Optional.

**webhookUrl** `string`

Called by IACrea when the video is **DONE** (see Webhook section). Optional.

### Responses

#### 201 — Started

**id** `string`

Auto generation id. Use it with `GET /api/video-editor/generate/video/auto/   {id}`.

**status** `string`

Initial status, typically `"PENDING"`.

**generatedContent** `array`

List of clips/sequences being generated (one per selected image). Each item
contains `id`, `url`, `effect`, `format`, `category`, `text`, `status`.

**analysis** `object`

AI analysis output (selections).

**creditsTotal** `number`

Remaining credits.

**creditsUsed** `number`

Used credits.

#### 400 — Validation error

Returned when the request body is invalid (e.g. empty `image_urls`, invalid URL, description too short, etc.).

#### 401 — Unauthorized

Returned when `x-api-key` is missing or invalid.

#### 500 — Server error

Server-side failure.

### Example (curl)

```bash theme={null}
curl --request POST \
  --url 'https://iacrea.com/api/video-editor/generate/video/auto' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "image_urls": ["https://example.com/1.jpg"],
    "description": "Bright apartment with a terrace, near downtown.",
    "format": "landscape",
    "webhookUrl": "https://your-app.com/webhooks/iacrea/video-auto"
  }'
```

## 2) Poll a generation

**GET /api/video-editor/generate/video/auto/\{id}**

### Headers

**x-api-key** `string` *required*

Your IACrea API key

### Main responses

This endpoint is **idempotent** and can be polled. It returns a JSON object with a `status` field and, depending on the status, additional fields.

#### 200 — `status: "GENERATING_VIDEO"`

Clips are being generated. Also returns credits and `generatedContent`.

#### 200 — `status: "START_RENDERING_VIDEO"`

All sequences are ready; final render starts.

* `progress: 0`

#### 200 — `status: "RENDERING_VIDEO"`

Final render in progress.

* `progress`: a number you can display as-is.

#### 200 — `status: "DONE"`

Final video is ready.

* `url`: video URL
* `generatedContent`
* `creditsTotal`, `creditsUsed`

#### 200 — `status: "PENDING"`

Transient state; may be returned if the server needs to re-generate errored sequences.

#### 4xx/5xx

* `401` if API key is missing/invalid
* `404` if `id` is not found
* `500` on server errors

### Example (curl)

```bash theme={null}
curl --request GET \
  --url 'https://iacrea.com/api/video-editor/generate/video/auto/ID_FROM_POST' \
  --header 'x-api-key: YOUR_API_KEY'
```

## Webhook (optional)

If `webhookUrl` is provided in the `POST`, IACrea will call your endpoint when the final video is ready:

* Method: `POST`
* Header: `Content-Type: application/json`
* Body:

```json theme={null}
{
  "id": "GENERATION_ID",
  "status": "DONE",
  "url": "https://...mp4"
}
```

### Integration recommendations

* **Polling**: call `GET /api/video-editor/generate/video/auto/{id}` every 2–5 seconds until `DONE` (or `ERROR`).
* **Timeout**: implement a client timeout (e.g. 10–20 minutes) depending on render times.
* **Resilience**: if you get `"PENDING"` after `"GENERATING_VIDEO"`, keep polling; the server may retry failed sequences.


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