---
title: "Permanently delete a script and all associated data."
method: DELETE
path: "/api/v1/script/{script}"
---

# Permanently delete a script and all associated data.

`DELETE /api/v1/script/{script}`

**Authentication**: JWT token required
**Authorization**: Admin access required (ADMIN or SUPERADMIN)
**Warning**: This action is irreversible and deletes all associated data

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

**Deletion Process**:
- Cancels any running executions using this script
- Deletes all execution history and logs for this script
- Removes script files and dependencies from storage
- Deletes script metadata and configuration
- Removes access control settings
- Cleans up any associated resources

**Success Response Schema**:
```json
{
  "data": {
    "id": "script-123",
    "slug": "vegetation-analysis",
    "name": "Vegetation Change Analysis",
    "description": "Analyzes vegetation changes using satellite imagery",
    "status": "DELETED",
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T12:00:00Z",
    "user_id": "user-456",
    "cpu": 2,
    "memory": 4096,
    "logs": false
  }
}
```

**Impact**:
- All executions using this script will be cancelled
- Historical execution data is permanently lost
- Script cannot be recovered after deletion
- Users lose access to download script files

**Security Considerations**:
- Only admin users can delete scripts
- Action is logged for audit purposes
- Confirmation should be required in client applications

**Error Responses**:
- `401 Unauthorized`: JWT token required
- `403 Forbidden`: Admin access required
- `404 Not Found`: Script does not exist
- `500 Internal Server Error`: Deletion failed

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