# Download the approved film file

`GET https://api.cream-ai.de/api/v1/films/{id}/file`

Downloads the approved file of a film ordered through the API (only the approved original version; format and language versions are not part of v1). The response is the file as `video/mp4` with a strong `ETag` (the SHA-256 of the file, the same as `approval.sha256` of the current approval). Compare it with the SHA-256 of the downloaded bytes. Resume an interrupted download with `Range: bytes=<from>-` and `If-Range: <ETag>`: `206` with the rest, or `200` with the whole file if the approval changed. A single range is supported; several ranges or an invalid one return the whole file. A range behind the end returns `416 range_not_satisfiable`. With `If-None-Match: <ETag>` the response is `304` without a body when the approval is unchanged. `HEAD` returns the headers only. The download always returns the approval that is active now. If an event is older than the current approval, the `ETag` differs from `data.approval.sha256` of the event; then the `ETag` counts. `404 not_approved`: the film has no active approval (never approved or revoked). `409 file_unavailable`: the file is missing or does not match the approval; mint is informed, retry later. `503` with `Retry-After`: mint is checking the file or is briefly unavailable, retry after the given seconds. At most a few downloads per company run at the same time (`429 rate_limited` with `details.reason` `parallel_downloads` and `Retry-After`). Downloads are free of credits.

Scopes: `files:read`

## Parameters

- `id` (path, required): Id of the film (id from POST /films, GET /films or film_id of an event).
- `Range` (header): One byte range, e.g. bytes=33554432-.
- `If-Range` (header): The ETag of the first response; the range only applies if it still matches.
- `If-None-Match` (header): The ETag you already have; 304 if unchanged.

## Returns

- 200: The whole approved file.
- 206: The requested part of the approved file.
- 304: Unchanged (the ETag from If-None-Match still matches).

## Errors

- 401: Missing, malformed, revoked or expired API key (unauthorized).
- 403: Not allowed (forbidden_scope, ip_not_allowed, company_inactive, api_not_enabled).
- 404: Not found (not_found) or not approved (not_approved).
- 409: The approved file is not available (file_unavailable). mint is informed; retry later.
- 416: The range is behind the end of the file (range_not_satisfiable).
- 429: Too many requests (rate_limited).
- 500: Internal error (internal). Quote the request id when you contact support.
- 503: Temporarily unavailable (service_unavailable). Retry later (after Retry-After seconds, if sent).

## Example request

```sh
curl "https://api.cream-ai.de/api/v1/films/k7m2xq9v4t8n1b5r3c6d0wza/file" \
  -H "Authorization: Bearer $MINT_API_KEY" \
  -o film.mp4
```

## Example response (200)

```http
HTTP/1.1 200 OK
Content-Type: video/mp4
X-Request-Id: req_5b2e8f1a4c7d0e3b6a9f2c5d8e1b4a7c
ETag: "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b"
Accept-Ranges: bytes
Content-Length: 48213377
Content-Disposition: attachment; filename="k7m2xq9v4t8n1b5r3c6d0wza_r2.mp4"
Cache-Control: no-store, no-transform

<binary MP4 data>
```
