> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Cancel a task

PATCH https://nlp.emtelligent.com/emtellipro/cancel/{taskId}

Cancel a running or completed task.

Reference: https://docs.emtelligent.com/nlp/api/tasks/cancel-a-task

## Authentication

- `Authorization` header (required) — This API uses [our API key HMAC authentication](/nlp/reference/hmac-authentication), with empty credential scope. Access keys and secret access keys will be provided by Emtelligent; contact us for key management. Keys will consist of only printable ASCII characters, and leading and trailing whitespace is insignificant.
- `x-api-key` header (required) — API keys will be provided by Emtelligent; contact us for key management. Keys will consist of only printable ASCII characters, and leading and trailing whitespace is insignificant.

## Request

### Path parameters

- `taskId` (string, required) — ID of task to cancel.

### Headers

- `Authorization` (string, required) — Authentication information.
- `Host` (string, required) — Host of server.
- `X-Auth-Date` (string, required) — Date and time of request.

## Response

### 200

Successful.

## Errors

### 401 Unauthorized Error

Authentication information is missing or invalid.

- `any`

### 404 Not Found Error

Task not found. Tasks not owned by the user will be treated as not found, and tasks may take a little time after submission to become visible.

- `any`

### 500 Internal Server Error

Internal server error.

- `any`

## Examples

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657"

headers = {
    "Authorization": "<apiKey>",
    "Host": "nlp.emtelligent.com",
    "X-Auth-Date": "20171225T031510Z"
}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657';
const options = {
  method: 'PATCH',
  headers: {
    Authorization: '<apiKey>',
    Host: 'nlp.emtelligent.com',
    'X-Auth-Date': '20171225T031510Z'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Host", "nlp.emtelligent.com")
	req.Header.Add("X-Auth-Date", "20171225T031510Z")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<apiKey>'
request["Host"] = 'nlp.emtelligent.com'
request["X-Auth-Date"] = '20171225T031510Z'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657")
  .header("Authorization", "<apiKey>")
  .header("Host", "nlp.emtelligent.com")
  .header("X-Auth-Date", "20171225T031510Z")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657', [
  'headers' => [
    'Authorization' => '<apiKey>',
    'Host' => 'nlp.emtelligent.com',
    'X-Auth-Date' => '20171225T031510Z',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Host", "nlp.emtelligent.com");
request.AddHeader("X-Auth-Date", "20171225T031510Z");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Host": "nlp.emtelligent.com",
  "X-Auth-Date": "20171225T031510Z"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://nlp.emtelligent.com/emtellipro/cancel/2b871be2-f8d2-44d2-b5bd-e184fb317657")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```