# Download a file

`GET /businesses/{bid}/files/{id}`

Requires the `export` scope.

Streams the stored bytes: export zips, backups, receipts. Issued document PDFs are served by `prints` instead, so the once-only origin rule is enforced.

## Path parameters

| Name | Type | | Description |
|---|---|---|---|
| `bid` | string | **required** | Business id, from `POST /businesses`. |
| `id` | string | **required** | File id. |

## Response

`200`: `{ "ok": true, … }`

Errors: `401`, `403`, `404`, `429`. Every failure answers `{ "error": …, "reason": … }`. Branch on `reason`.

## Examples

### cURL

```bash
curl -X GET "$BASE/businesses/$BID/files/$DOC_ID" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/files/${DOC_ID}`, {
  method: 'GET',
  headers: {
    'X-Api-Key': KEY,
  },
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.get(
    f"{BASE}/businesses/{BID}/files/{DOC_ID}",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```