---
title: "Destroy workspace infrastructure resources"
method: POST
path: "/runners/workspaces/{workspaceId}/tasks/destroy"
tags: ["Runners Workspaces"]
---

# Destroy workspace infrastructure resources

`POST /runners/workspaces/{workspaceId}/tasks/destroy`

Initiates a destroy task to clean up cloud infrastructure resources managed by this workspace. This does not delete the workspace entity itself.

## Path parameters

- `workspaceId` string, required

## Request body

- RunTaskRequest — Request to run a task on workspace infrastructure
  - `description` string — Optional description for the task
  - `vcs` TaskVcs, required — VCS configuration for the task
    - `reference` string, required — Git reference (branch, tag, or commit)
    - `type` 'branch' | 'tag' | 'commit', required — Type of VCS reference
  - `trigger` RunTaskRequestTrigger, required — Trigger information for the task
    - `type` 'manual' | 'pull_request' | 'push' | 'schedule', required — Type of trigger
    - `source` 'Firefly' | 'VCS', required — Source of the trigger
  - `taskId` string — Optional ID of the task to run
  - `cmdArguments` string — Optional command line arguments for the task

## Response `200`

Destroy task initiated successfully

- TaskResponse — Response from task initiation
  - `accountId` string — ID of the account
  - `id` string, required — ID of the created task
  - `status` 'pending' | 'running' | 'success' | 'failed' | 'canceled', required — Current status of the task
  - `error` TaskError — Error information if the task failed
    - `type` 'UNEXPECTED' — Type of error
    - `description` string — Error description
  - `currentStep` 'plan' | 'post_plan' | 'apply' | 'post_apply' — Current step in the task execution
  - `workspaceId` string, required — ID of the workspace the task is running on
  - `vcs` TaskVcs — VCS configuration for the task
    - `reference` string, required — Git reference (branch, tag, or commit)
    - `type` 'branch' | 'tag' | 'commit', required — Type of VCS reference
  - `trigger` TaskTrigger — Trigger information for the completed task
    - `type` 'manual' | 'pull_request' | 'push' | 'scheduled' — Type of trigger
  - `type` 'plan' | 'apply' | 'destroy', required — Type of task that was executed
  - `cmdArguments` string — Command line arguments used for the task
  - `createdAt` string, date-time — When the task was created
  - `updatedAt` string, date-time — When the task was last updated

## Other responses

- `400` — Bad Request Error
- `401` — Unauthorized Error
- `403` — Insufficient permissions
- `404` — Not Found Error
- `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)
