---
title: "Retrieve all scripts with flexible filtering, sorting, and pagination."
method: GET
path: "/api/v1/script"
---

# Retrieve all scripts with flexible filtering, sorting, and pagination.

`GET /api/v1/script`

**Authentication**: JWT token required
**Access**: Returns scripts visible to the current user based on permissions

**Query Parameters**:
- `include`: Comma-separated list of additional fields to include in response
- `exclude`: Comma-separated list of fields to exclude from response
- `filter`: Search/filter scripts by name, description, or other attributes
- `sort`: Sort field (prefix with '-' for descending, e.g., '-created_at')
- `page`: Page number for pagination (triggers pagination when provided)
- `per_page`: Items per page (1-100, default: 20, max without pagination: 2000)

**Response Schema (without pagination)**:
```json
{
  "data": [
    {
      "id": "script-123",
      "slug": "my-analysis-script",
      "name": "Land Use Analysis",
      "description": "Analyzes land use changes over time",
      "status": "PUBLISHED",
      "created_at": "2025-01-15T10:30:00Z",
      "updated_at": "2025-01-15T10:30:00Z",
      "user_id": "user-456",
      "cpu": 2,
      "memory": 4096,
      "logs": false
    }
  ]
}
```

**Response Schema (with pagination)**:
```json
{
  "data": [...],
  "page": 1,
  "per_page": 20,
  "total": 150
}
```

**Script Status Values**:
- `UPLOADED`: Script uploaded but not yet published
- `PUBLISHED`: Script is available for execution
- `UNPUBLISHED`: Script was published but later unpublished
- `FAILED`: Script validation or processing failed

**Filtering Examples**:
- `?filter=land` - Find scripts with "land" in name or description
- `?filter=status:PUBLISHED` - Find only published scripts
- `?filter=user:john@example.com` - Find scripts by specific user

**Sorting Examples**:
- `?sort=name` - Sort by name ascending
- `?sort=-created_at` - Sort by creation date descending
- `?sort=status` - Sort by status

**Field Control Examples**:
- `?include=logs` - Include execution logs
- `?include=user` - Include user information
- `?exclude=description,logs` - Exclude verbose fields

**Pagination Control**:
- Without pagination: Returns up to 2000 scripts in single response
- With pagination: `?page=1&per_page=20` - Returns paginated results

**Error Responses**:
- `401 Unauthorized`: JWT token required
- `500 Internal Server Error`: Failed to retrieve scripts

## 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)
