> 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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /task/{id}/:
    put:
      operationId: update
      summary: Update a task
      description: >-
        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.
      tags:
        - subpackage_tasks
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: _fields
          in: query
          description: Comma-separated list of fields to include in the response.
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use your API key as the username and leave the password empty.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tasks_update_Response_200'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateNotification'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    UpdateNotificationDate:
      oneOf:
        - type: string
          format: date-time
        - type: string
          format: date
      title: UpdateNotificationDate
    UpdateNotificationDueDate:
      oneOf:
        - type: string
          format: date-time
        - type: string
          format: date
      title: UpdateNotificationDueDate
    TaskPriority:
      type: string
      enum:
        - high
        - medium
      title: TaskPriority
    NotificationResolution:
      type: string
      enum:
        - abandoned
        - skipped
      title: NotificationResolution
    UpdateNotification:
      type: object
      properties:
        agent_config_id:
          type:
            - string
            - 'null'
        assigned_to:
          type: string
        contact_id:
          type:
            - string
            - 'null'
        created_by:
          type: string
        date:
          $ref: '#/components/schemas/UpdateNotificationDate'
        due_date:
          $ref: '#/components/schemas/UpdateNotificationDueDate'
        is_complete:
          type: boolean
        is_dateless:
          type: boolean
        lead_id:
          type: string
        organization_id:
          type: string
        priority:
          $ref: '#/components/schemas/TaskPriority'
        resolution:
          oneOf:
            - $ref: '#/components/schemas/NotificationResolution'
            - type: 'null'
        text:
          type: string
      title: UpdateNotification
    tasks_update_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: tasks_update_Response_200
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
      description: Use your API key as the username and leave the password empty.
    OAuth2:
      type: http
      scheme: bearer

```

## SDK Code Examples

```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);
```