# Handle Instagram albums

Retrieve every returned image and video instead of just the first file.

## Read the file list

Submit the post URL to `/media/download` as usual. An album can return several files:

```json
{
    "fileId": "fil_first",
    "files": [
        {
            "fileId": "fil_first"
        },
        {
            "fileId": "fil_second"
        }
    ]
}
```

This is the `job.result` portion of a successful response. `fileId` remains an alias for the first file for older clients. Use the full array when present:

```javascript
const files = job.result.files ?? [{ fileId: job.result.fileId }];

for (const { fileId } of files) {
    // Request GET /api/v1/files/:fileId using the same account.
}
```

Do not turn a missing or empty file list into a successful empty download.

Run this only after `job.status` is `completed`. This excerpt assumes a valid result; the [complete example](/docs/en/guides/nodejs) checks for missing files and shows the authenticated lookups.

## Collection behavior

A post is limited to 50 media items. Download byte limits apply to the entire post, not separately to each slide. If a required slide cannot be downloaded, the job fails instead of presenting an incomplete album as complete.

Mixed photo/video posts may be grouped by media type. Do not promise that the returned order matches the original slide order. Query parameters such as `img_index=1` do not mean an integration should discard the remaining results.

## Delivery choices

- For Discord, send files in groups that respect both attachment count and byte limits. Retain already delivered groups if a later upload fails.
- For a website, let the user download the files or create a ZIP in your own client/backend.

The hosted `/batches` endpoint creates separate tracked jobs. It does not create an archive. The standalone worker's batch job is a different interface and can produce a ZIP; see [worker jobs](/docs/en/worker/jobs).
