# StopTask

## General

### URL

https://{host}/attunityenterprisemanager/api/v1/servers/{ServerName}/tasks/{TaskName}?action=stop&timeout={timeout}

### Description

Stop the selected task.

### HTTP method

POST

### Required user role

See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/May2026/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Request parameters

Request parameters

| Location | Name | Required | Description/Example |
| --- | --- | --- | --- |
| URL | host [string] | Yes | computer.network.net |
| URL | ServerName [string] | Yes | myrepsrv1 |
| URL | TaskName [string] | Yes | <ul> <li><span><span>Replicate</span>:</span> - The name of the task.</li> <li> <p><span><span>Compose</span>: </span>- The name of the task or workflow appended with a double underscore and the project name.</p> <p><span><span>Example: </span></span>&nbsp;</p> <p><span>mytask__myproject</span> </p> </li> </ul> |
| URL | Timeout [int32] | Optional (default is 60 seconds) | 60 (seconds) |
| Header | EnterpriseManager.APISessionID [string] | Yes | wCo0\_KvjEUFROvfHF5KGrw |
| Header | Content-Length | Yes | Content-Length: 0<br><br>Note that the Content-Length value must be "0". |

## Response body

`{
`

`"state":"{enum task_state}", 
`

`"error_message":""
`

`}
`

## Response parameters

Response parameters

| Name | Description |
| --- | --- |
| [state](https://help.qlik.com/en-US/enterprise-manager/May2026/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#state) [enum task\_state] | The current state of the task. |
| error\_message | The description of the error. |

## cURL example

### Request

`curl -i -k -X POST --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Length: 0" https:// computer.network.net/attunityenterprisemanager/api/v1/servers/myrepsrv1/tasks/SalesDBBackup/?action=stop`

### Response

`Header:`

`HTTP/1.1 200 OK`

`Cache-Control: no-cache, no-store`

`Content-Length: 38`

`Content-Type: application/json; charset=utf-8`

`Server: Microsoft-HTTPAPI/2.0`

`Date: Mon, 26 Dec 2016 16:31:01 GMT`

### Payload

`{`

"` state":"STOPPED",  `

`"error_message":""
`

`}
`

## Error response

Error responses

| HTTP Code | Enterprise Manager Code | Text | Description |
| --- | --- | --- | --- |
| 500 | AEM\_TASK\_ALREADY\_STOPPED | Replicate task {task} on server {server} is already stopped. | Cannot stop a task that is in Stopped state. |
| 500 | AEM\_STOP\_TASK\_INNER\_ERR | Failed to stop Replicate task {0} on server {1}: &lt;{2}&gt; | An error occurred while trying to stop the task. |
| 500 | AEM\_STOP\_TASK\_TIMEOUT | A timeout occurred when trying to stop Replicate task {0} on server {1} | A timeout occurred while trying to stop the task. |