# Get a generation job

`GET https://api.vidmoat.com/v1/ai/jobs/{id}`

- Scope: `ai.video`
- Cost: Free

Poll a video generation job until it is COMPLETED or FAILED. Images, speech and stickers answer synchronously and have no job. A job that fails is refunded.

### Path parameters

- `id` (string, required): The `id` from Generate a video.

## Response

Returns `200`.

### Response fields

- `job` (object): The job.
  - `id` (string): Job id.
  - `status` (enum): Where it is. One of `PROCESSING`, `COMPLETED`, `FAILED`.
  - `kind` (string): `video`.
  - `outputUrl` (string or null): The clip, once `COMPLETED`.
  - `error` (string or null): Why it failed.
  - `durationSec` (integer): Seconds generated, once finished.
  - `credits` (object): Once finished: `{ charged, refunded }`.
  - `warning` (string): Present when the provider could not be checked this time; poll again.
- `hint` (string): Present on completion.

## Errors

Besides the errors any request can get ([authentication](https://developer.vidmoat.com/developer/docs/authentication#when-a-request-is-refused), [rate limits](https://developer.vidmoat.com/developer/docs/rate-limits)):

| Status | Code | When |
| --- | --- | --- |
| 404 | [`not_found`](https://developer.vidmoat.com/developer/docs/errors#not_found) | No such video job on your projects. |

## Request examples

```bash curl
curl https://api.vidmoat.com/v1/ai/jobs/$JOB_ID \
  -H "Authorization: Bearer $VIDMOAT_KEY"
```

```js Node
const JOB_ID = 'YOUR_JOB_ID';

const res = await fetch(`https://api.vidmoat.com/v1/ai/jobs/${JOB_ID}`, {
  headers: {
    Authorization: `Bearer ${process.env.VIDMOAT_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? `HTTP ${res.status}`);
console.log(data);
```

```python Python
import os
import requests

JOB_ID = "YOUR_JOB_ID"

res = requests.get(
    f"https://api.vidmoat.com/v1/ai/jobs/{JOB_ID}",
    headers={"Authorization": f"Bearer {os.environ['VIDMOAT_KEY']}"},
    timeout=60,
)
res.raise_for_status()
print(res.json())
```

## Example response

```json
{
  "job": {
    "id": "cm_job_1",
    "status": "COMPLETED",
    "kind": "video",
    "outputUrl": "https://api.vidmoat.com/uploads/ai-video-1.mp4",
    "error": null,
    "durationSec": 5,
    "credits": { "charged": 400, "refunded": false }
  },
  "hint": "Use `outputUrl` as an addClip `src` with type: \"video\"."
}
```

---

Source: https://developer.vidmoat.com/developer/docs/api/generation/get-generation-job
Previous: [Generate a video](https://developer.vidmoat.com/developer/docs/api/generation/create-video.md)
Next: [Run the editing agent](https://developer.vidmoat.com/developer/docs/api/generation/run-agent.md)
All documentation: https://developer.vidmoat.com/llms-full.txt
