> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Task

> Update Task

Update Task

```http theme={null}
PUT https://services.leadconnectorhq.com/contacts/{contactId}/tasks/{taskId}
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="contactId" type="string" required default="sx6wyHhbFdRXh302LLNR">
  Contact Id
</ParamField>

<ParamField path="taskId" type="string" required default="ocQHyuzHvysMo5N5VsXc">
  Task Id
</ParamField>

## Body

<ParamField body="title" type="string" default="First Task" />

<ParamField body="body" type="string" default="loram ipsum" />

<ParamField body="dueDate" type="string" default="2020-10-25T11:00:00Z" />

<ParamField body="completed" type="boolean" default="True" />

<ParamField body="assignedTo" type="string" default="hxHGVRb1YJUscrCB8eXK" />

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="task" type="object">
    <Expandable title="propiedades">
      <ResponseField name="id" type="string" default="lJpzYrWdpkC2hX6t2yue" />

      <ResponseField name="title" type="string" default="test" />

      <ResponseField name="body" type="string" default="testing" />

      <ResponseField name="assignedTo" type="string" default="tesTUcmRxWrjqzJS8EjkxNKting" />

      <ResponseField name="dueDate" type="string" default="2021-07-08T02:30:00.000Z" />

      <ResponseField name="completed" type="boolean" default="True" />

      <ResponseField name="contactId" type="string" default="lJpzYrWdpkC2hX6t2yue" />
    </Expandable>
  </ResponseField>

  ```json theme={null}
  {
    "task": {
      "id": "lJpzYrWdpkC2hX6t2yue",
      "title": "test",
      "body": "testing",
      "assignedTo": "tesTUcmRxWrjqzJS8EjkxNKting",
      "dueDate": "2021-07-08T02:30:00.000Z",
      "completed": true,
      "contactId": "lJpzYrWdpkC2hX6t2yue"
    }
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT 'https://services.leadconnectorhq.com/contacts/YOUR_contactId/tasks/YOUR_taskId' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "title": "First Task",
    "body": "loram ipsum",
    "dueDate": "2020-10-25T11:00:00Z",
    "completed": true,
    "assignedTo": "hxHGVRb1YJUscrCB8eXK"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/contacts/YOUR_contactId/tasks/YOUR_taskId', {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"title": "First Task", "body": "loram ipsum", "dueDate": "2020-10-25T11:00:00Z", "completed": true, "assignedTo": "hxHGVRb1YJUscrCB8eXK"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'PUT',
      'https://services.leadconnectorhq.com/contacts/YOUR_contactId/tasks/YOUR_taskId',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"title": "First Task", "body": "loram ipsum", "dueDate": "2020-10-25T11:00:00Z", "completed": true, "assignedTo": "hxHGVRb1YJUscrCB8eXK"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/contacts/YOUR_contactId/tasks/YOUR_taskId');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'PUT',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'title': 'First Task', 'body': 'loram ipsum', 'dueDate': '2020-10-25T11:00:00Z', 'completed': true, 'assignedTo': 'hxHGVRb1YJUscrCB8eXK'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
