---
title: "Run a task"
method: POST
path: "/self-hosted/{accountId}/tasks/run"
tags: ["Self-Hosted Runners"]
---

# Run a task

`POST /self-hosted/{accountId}/tasks/run`

Initiates a new task execution (self-hosted)

## Path parameters

- `accountId` string, required

## Request body

- SelfHostedRunTaskRequest
  - `accountId` string — Account ID
  - `type` 'post-plan' | 'post-apply', required — The type of task in the workflow
  - `flow` SubTaskType[], required — Flow of sub-tasks to execute
  - `content` object, required — Map of sub-task types to content (base64-encoded byte arrays)
  - `metadata` TaskMetadata — Metadata for the task
  - `runnerType` string — Type of runner
  - `repo` string — Repository name
  - `workspace` string — Workspace name
  - `availableLogs` string[] — List of available log identifiers
  - `tfWorkingDir` string — Terraform working directory
  - `environment` string — Environment name

## Response `200`

Task initiated successfully

- string — Task ID

## Other responses

- `400` — Bad Request Error
- `401` — Unauthorized Error
- `403` — Insufficient permissions
- `500` — Internal Server Error

---

[API](https://skmtc.net/firefly/apis/api-gateway.md) · [All operations](https://skmtc.net/firefly/apis/api-gateway/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/firefly/api-gateway/revisions/eea119b4113f/schema)
