> For a complete page index, fetch https://developer.close.com/llms.txt

# Update a task

PUT https://api.close.com/api/v1/task/{id}/
Content-Type: application/json

The `assigned_to`, `date` (either a date or a date-time), and `is_complete` fields may be updated on all tasks. If the task type is `lead`, the `text` field may also be modified.

Reference: https://developer.close.com/api/resources/tasks/update

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required)

## Request

### Path parameters

- `id` (string, required)

### Query parameters

- `_fields` (string, optional) — Comma-separated list of fields to include in the response.

### Body (application/json)

- `agent_config_id` (string, optional, nullable)
- `assigned_to` (string, optional)
- `contact_id` (string, optional, nullable)
- `created_by` (string, optional)
- `date` (datetime or date, optional)
- `due_date` (datetime or date, optional)
- `is_complete` (boolean, optional)
- `is_dateless` (boolean, optional)
- `lead_id` (string, optional)
- `organization_id` (string, optional)
- `priority` (enum, optional)
  - Allowed values: `high`, `medium`
- `resolution` (enum, optional, nullable)
  - Allowed values: `abandoned`, `skipped`
- `text` (string, optional)

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "is_complete": false
}
```

**Response**

```json
{
  "_type": "lead",
  "assigned_to": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "assigned_to_name": "John Doe",
  "contact_id": null,
  "contact_name": null,
  "created_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "created_by_name": "John Doe",
  "date": "2013-02-06",
  "date_created": "2015-02-08T20:30:54.314000+00:00",
  "date_updated": "2015-02-26T19:11:36.128000+00:00",
  "id": "task_aRUZXCm9lMb2LwipTPhfFoFbCsUnaoQh1ncQ7WLnjlI",
  "is_complete": true,
  "is_dateless": false,
  "lead_id": "lead_5LmpOyrMQdJSUlbNGBSGfK5XzcioIm7aC94PSQamQJc",
  "lead_name": "Close",
  "object_id": null,
  "object_type": null,
  "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH",
  "text": "Connect with Account Manager",
  "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "updated_by_name": "John Doe"
}
```

**SDK Code**

```python tasks_update_example
import requests

url = "https://api.close.com/api/v1/task/id/"

payload = { "is_complete": False }
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript tasks_update_example
const url = 'https://api.close.com/api/v1/task/id/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'PUT',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"is_complete":false}'
};

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

```go tasks_update_example
package main

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

func main() {

	url := "https://api.close.com/api/v1/task/id/"

	payload := strings.NewReader("{\n  \"is_complete\": false\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.SetBasicAuth("<CLOSE_API_KEY>", "")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://api.close.com/api/v1/task/id/")

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

request = Net::HTTP::Put.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"is_complete\": false\n}"

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

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

HttpResponse<String> response = Unirest.put("https://api.close.com/api/v1/task/id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"is_complete\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.close.com/api/v1/task/id/', [
  'body' => '{
  "is_complete": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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

```csharp tasks_update_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/task/id/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"is_complete\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```