---
title: "Download a script's source code and files as a compressed archive."
method: GET
path: "/api/v1/script/{script}/download"
---

# Download a script's source code and files as a compressed archive.

`GET /api/v1/script/{script}/download`

**Authentication**: JWT token required
**Access**: Script must be accessible to current user based on permissions
**Format**: Returns compressed tar.gz archive containing script files

**Path Parameters**:
- `script`: Script identifier/slug or numeric ID

**Response**: Binary file download (tar.gz archive)
- **Content-Type**: `application/gzip`
- **Content-Disposition**: `attachment; filename=script-name.tar.gz`

**Archive Contents**:
- Main script file(s) (Python, R, or other supported languages)
- Configuration files (script metadata, requirements)
- Dependencies and libraries (if included)
- Documentation and README files
- Supporting data files (if any)

**Usage Examples**:
```bash
# Download script archive
curl -H "Authorization: Bearer your_jwt_token"          -o vegetation-analysis.tar.gz          "https://api.trends.earth/api/v1/script/vegetation-analysis/download"

# Extract downloaded archive
tar -xzf vegetation-analysis.tar.gz
```

**Access Control**:
- Users can download scripts they have execution access to
- Admin users can download any script
- Private scripts require explicit permission

**Error Responses**:
- `401 Unauthorized`: JWT token required
- `403 Forbidden`: No access to download this script
- `404 Not Found`: Script does not exist
- `500 Internal Server Error`: Download failed or file unavailable

## Path parameters

- `script` string, required

## Response `200`

Success

- object

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.dev/trends/apis/trends-earth-api.md) · [All operations](https://skmtc.dev/trends/apis/trends-earth-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/trends/trends-earth-api/revisions/6bdbc0b84666/schema)
