# Media job status, results and errors

Source: https://docs.sociaro.com/media/results/

Poll the job on the route that accepted it, using the same API key. Read the status in the response body. A successful HTTP response can describe a failed generation.

## Polling

For the Alibaba example, set `JOB_ID` to the `job_id` from your [submit response](https://docs.sociaro.com/media/submit/#submitting):

cURL

```bash
curl "https://api.sociaro.com/v1/alibaba/generations/$JOB_ID" \
  -H "Authorization: Bearer $SOCIARO_API_KEY"
```

Python

```python
# Requires Python 3 and requests (pip install requests).
import os
import requests

response = requests.get(
    'https://api.sociaro.com/v1/alibaba/generations/' + os.environ['JOB_ID'],
    headers={
        'Authorization': 'Bearer ' + os.environ['SOCIARO_API_KEY'],
    },
    timeout=120,
)
response.raise_for_status()
print(response.text)
```

JavaScript

```javascript
// Run as an .mjs file with Node.js 22 or later.

const response = await fetch("https://api.sociaro.com/v1/alibaba/generations/" + process.env.JOB_ID, {
  headers: {
    "Authorization": "Bearer " + process.env.SOCIARO_API_KEY,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());
```

| Alibaba status | Next step |
| --- | --- |
| `submitted` | Save the ID returned on submit. |
| `processing` | Poll again in a few seconds. Video jobs can take minutes. |
| `completed` | Download `media_url`. For multiple images, read `media_urls`. |
| `failed` | Read `error.code` and `error.message`. |

Other native routes can use different fields. For example, BytePlus Seedance returns `id` on submit and uses native task statuses such as `succeeded`. See the [Generations API guide](https://docs.sociaro.com/generations-api/index.md) for its result fields. The [Jobs API](https://docs.sociaro.com/jobs/index.md) returns files in `outputs[].url`.

## Results

For a native `/v1` result with a Sociaro `/v1/media/…` URL, anyone holding the link can download the file until the link expires. Keep the URL private and download the file within an hour. For a video, set `MEDIA_URL` to the returned URL and run:

cURL

```bash
curl -fL "$MEDIA_URL" -o result.mp4
```

Python

```python
# Requires Python 3 and requests (pip install requests).
from pathlib import Path
import os
import requests

response = requests.get(
    os.environ['MEDIA_URL'],
    timeout=120,
)
response.raise_for_status()
Path('result.mp4').write_bytes(response.content)
```

JavaScript

```javascript
// Run as an .mjs file with Node.js 22 or later.
import { writeFile } from "node:fs/promises";

const response = await fetch(process.env.MEDIA_URL);
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
await writeFile("result.mp4", new Uint8Array(await response.arrayBuffer()));
```

**Multiple images.** On Alibaba image models, `media_urls` contains every delivered image in generator order and `media_url` is the first. Each link has its own expiry. Billing uses the generated image count, capped at the number of delivered links. Extra links are returned. If any image cannot be delivered, the job fails without a charge.

Kling’s `kling/kling-v3`, `kling/kling-v3-omni` and `kling/kling-4.0-image` also return the first link in `media_url` and the list in `media_urls`. The charge is per delivered image and cannot exceed the requested `n` or `series_amount`.

**Vector files.** Ideogram and Recraft vector models return SVG (`image/svg+xml`). The native `/v1` link serves it with a sandboxing Content Security Policy. Opening a `/v2` SVG result directly downloads the file, and it can also be used as an HTML image source.

## Failed jobs and retries

Open the request in Logs to see the reason and charge. Failed generations normally carry no charge. Ideogram bills for generated images even when its safety check withholds them all. Recraft can accept a submit and then report a generator refusal, a busy generator or a processing failure when you poll. These Recraft failures are uncharged.

Retry a temporary poll failure with the same ID. A `502` or a lost connection during submit can mean the generator already accepted the job. Repeating that submit can create another billable job. See [Errors](https://docs.sociaro.com/errors/index.md) for status codes and retry guidance.
