## Download a file

`$client->assets->download(string url): AssetDownloadResponse`

**post** `/v1/assets/download`

Download a file from an mxc:// or localmxc:// URL to the device running the Beeper Client API and return the local file URL.

### Parameters

- `url: string`

  Beeper media URL (mxc:// or localmxc://) for the file to download.

### Returns

- `AssetDownloadResponse`

  - `?string error`

    Error message if the download failed.

  - `?string srcURL`

    Local file URL to the downloaded file.

### Example

```php
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(accessToken: 'My Access Token');

$response = $client->assets->download(
  url: 'mxc://example.org/Q4x9CqGz1pB3Oa6XgJ'
);

var_dump($response);
```

#### Response

```json
{
  "error": "error",
  "srcURL": "srcURL"
}
```
