> ## Documentation Index
> Fetch the complete documentation index at: https://openlinear.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Execution API

> Start, cancel, and monitor single task executions.

## Start Execution

```
POST /api/tasks/:id/execute
```

Auth: `optionalAuth`. Starts the execution lifecycle for a task.

Returns `{ message: "Task execution started" }` on success.

Possible errors:

* `Task is already running`
* `Parallel limit reached (N tasks max)`
* `No active project selected`
* `userId is required for execution`

***

## Check Running Status

```
GET /api/tasks/:id/running
```

Returns: `{ running: true }` or `{ running: false }`

***

## Get Execution Logs

```
GET /api/tasks/:id/logs
```

Returns live logs from an active execution, or persisted logs from the database for completed tasks.

```json theme={null}
{
  "logs": [
    {"type": "info", "message": "Repository cloned successfully", "timestamp": "..."},
    {"type": "info", "message": "Branch created: openlinear/abc12345", "timestamp": "..."},
    {"type": "agent", "message": "Analyzing codebase...", "timestamp": "..."}
  ]
}
```

***

## Cancel Execution

```
POST /api/tasks/:id/cancel
```

Aborts the OpenCode session, persists logs, and updates the task status to `cancelled`.

Returns `{ message: "Task cancelled" }`.

***

## Permissions

### Get Pending Permissions

```
GET /api/tasks/:id/permissions
```

Returns permission requests from the AI agent that need user approval.

```json theme={null}
{
  "permissions": [
    {"id": "perm-uuid", "type": "shell", "command": "npm install", "...": "..."}
  ]
}
```

### Respond to Permission

```
POST /api/tasks/:id/permissions/:permissionId/respond
```

| Field | Type | Required | Description |
| - | - | - | - |
| `response` | string | Yes | `once`, `always`, or `reject` |

Broadcasts: `permission:resolved`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.