---
title: "Execute a script with provided parameters."
method: POST
path: "/api/v1/script/{script}/run"
---

# Execute a script with provided parameters.

`POST /api/v1/script/{script}/run`

**Rate Limited**: Subject to execution limits (configurable per minute/hour)
**Authentication**: JWT token required
**Access**: Script must be published and user must have execution permissions

**Request Schema**:
```json
{
  "param1": "value1",
  "param2": 123,
  "param3": true,
  "nested_param": {
    "sub_param": "nested_value"
  }
}
```

**Path Parameters**:
- `script`: Script identifier/name to execute

**Request Body**: JSON object containing script parameters
- Parameters vary by script - see individual script documentation
- Can include nested objects and arrays
- Boolean, string, and numeric values supported

**Success Response Schema**:
```json
{
  "data": {
    "id": "exec_123456",
    "script_id": "my-script",
    "status": "PENDING",
    "params": {
      "param1": "value1",
      "param2": 123
    },
    "user_id": "user_789",
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:30:00Z",
    "start_time": null,
    "end_time": null,
    "results": null
  }
}
```

**Execution States**:
- `PENDING`: Execution queued, waiting to start
- `RUNNING`: Currently executing
- `SUCCESS`: Completed successfully
- `FAILED`: Execution failed with error
- `CANCELLED`: Execution was cancelled

**Error Responses**:
- `400 Bad Request`: Invalid parameters or script not in valid state
- `401 Unauthorized`: JWT token required
- `404 Not Found`: Script does not exist
- `429 Too Many Requests`: Execution rate limit exceeded
- `500 Internal Server Error`: Execution creation failed

## Path parameters

- `script` string, required

## Request body

- object

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