# Download an agent's source as a tarball

Source: https://docs.vlayers.ai/reference/hosting/download-agent-source

`GET /v1/agents/{id}/source/archive` · scope `workspace:read`

Downloads the working copy, or the snapshot you name, as one gzip-compressed tar archive (`.tar.gz`). Paths are relative to the project root.

Requires an API key with the `workspace:read` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The agent id. Example: `"0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78"` |
| `snapshotId` | query | string | no | Download this snapshot instead of the working copy. Example: `"0192f5c1-5e6f-7a8b-9c0d-1e2f3a4b5c67"` |

## Request

cURL:

```bash
curl "https://api.vlayers.ai/v1/agents/$AGENT_ID/source/archive" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY"
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

await voicelayer.hosting.downloadAgentSource('<agent-id>');
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

vl.hosting.download_agent_source("<agent-id>")
```

## Response `200`

```json
"<binary .tar.gz>"
```
