# Video

> Turns an image into a short video.

## Tasks

- [Make a video from an image](https://docs.refabric.com/task-api-reference/video.generate) — `video.generate`: Turn a finished image into a short video, describing the movement you want while everything keeps the look it already has. Delivered as one `video/mp4` file.

## Quick start (`video.generate`)

```python
import os
import time
import requests

headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}

job = requests.post(
    "https://api.refabric.com/v1/tasks/video.generate",
    headers=headers,
    json={
        "image": "art:9f2c01",
        "prompt": "she turns towards the camera and smiles",
    },
).json()
print(job["job_id"])

while True:
    status = requests.get(job["status_url"], headers=headers).json()
    if status["lifecycle"] == "terminal":
        break
    time.sleep(5)

print(requests.get(job["result_url"], headers=headers).json())
```

```javascript
const headers = {
  Authorization: `Key ${process.env.REFABRIC_API_KEY}`,
  "Content-Type": "application/json",
};

const job = await fetch("https://api.refabric.com/v1/tasks/video.generate", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "image": "art:9f2c01",
    "prompt": "she turns towards the camera and smiles"
  }),
}).then((r) => r.json());
console.log(job.job_id);

let status = job;
while (status.lifecycle !== "terminal") {
  await new Promise((r) => setTimeout(r, 5000));
  status = await fetch(job.status_url, { headers }).then((r) => r.json());
}

console.log(await fetch(job.result_url, { headers }).then((r) => r.json()));
```

```bash
curl -X POST "https://api.refabric.com/v1/tasks/video.generate" \
  -H "Authorization: Key $REFABRIC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=60" \
  -d '{"image":"art:9f2c01","prompt":"she turns towards the camera and smiles"}'
```
