---
title: "Create a new Task."
method: POST
path: "/tasks"
tags: ["Tasks"]
---

# Create a new Task.

`POST /tasks`

## Request body

- CreateServerTaskCommand
  - `Arguments` object
  - `Description` string, required
  - `Name` string, required
  - `QueueTime` string, date-time
  - `QueueTimeExpiry` string, date-time
  - `SpaceId` string
  - `Weight` number

## Response `201`

Created

- TaskResource
  - `Arguments` object — Gets or sets any arguments to the task.
  - `CanRerun` boolean — If true, then the task can be used as the basis for a new task with the same effect.
  - `Completed` string — Gets or sets a value indicating the completion status of the task. May be "Timed out", "Queued...", "Executing...", or the time at which the task completed for completed tasks.
  - `CompletedTime` string, date-time — Gets or sets the date/time that the task completed. Will be null if the task has not yet completed.
  - `Description` string — Gets or sets a short, human-understandable description of this task. An example might be "Manual database backup". This is the name that will be shown in the task list.
  - `Duration` string — Gets or sets a string indicating how long the task took to run.
  - `ErrorMessage` string — Gets or sets a short summary of the errors encountered when the task ran (if any).
  - `EstimatedRemainingQueueDurationSeconds` integer
  - `FinishedSuccessfully` boolean — Gets or sets a value indicating whether the task ran to completion successfully.
  - `HasBeenPickedUpByProcessor` boolean — Gets or sets a boolean value indicating whether the Octopus Server is processing this task.
  - `HasPendingInterruptions` boolean — True if the task has any pending interruptions.
  - `HasPendingPreconditions` boolean — True if the task has any pending preconditions.
  - `HasWarningsOrErrors` boolean — True if any warnings or non-fatal errors were recorded in the task log during execution.
  - `Id` string — Gets or sets a unique identifier for this resource.
  - `IsCompleted` boolean — Gets or sets a value indicating whether the task has completed (that is, not queued, not running, and not paused; may have finished successfully or failed).
  - `LastModifiedBy` string — Gets or sets the username of the user who last modified this resource.
  - `LastModifiedOn` string, date-time — Gets or sets the date/time that this resource was last modified.
  - `LastUpdatedTime` string, date-time — Gets or sets the time that the Octopus server last updated the status of this task. For a running task this should happen at least every couple of minutes.
  - `Links` object — Gets or sets a dictionary of links to other related resources. These links can be used to navigate the resources on the server.
  - `Name` string — Gets or sets the name of the task to create. This name must be one of the list of possible names documented in the create API operation documentation.
  - `PendingInterruptionTypes` string[] — Contains a list of the types of any pending interruptions
  - `PendingPreconditionTypes` string[] — Contains a list of the types of any pending preconditions
  - `ProjectId` string — If the task belongs to a project (e.g. a deployment), the ID of the project it belongs to
  - `QueueTime` string, date-time — Gets or sets the time at which the task was queued.
  - `QueueTimeExpiry` string, date-time — Gets or sets the time at which the task will timeout if it has not started executing.
  - `ServerNode` string — Gets the ID of the Octopus server that created and will control this task.
  - `SpaceId` string
  - `StartTime` string, date-time — Gets or sets the time at which the task started executing.
  - `State` 'Queued' | 'Executing' | 'Failed' | 'Canceled' | 'TimedOut' | 'Success' | 'Cancelling' — Gets or sets the current state of the task.

## Other responses

- `400` — Bad request. Either the payload was not structurally valid or business rules did not permit the operation.
- `404` — Not found. One or more of the entities involved in the operation was not found.

---

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