# Task List

The task list functionality allows you to create customised action items for your users to complete and sync their out of platform actions.

### <mark style="background-color:blue;">The Task Object Array</mark>

The custom task list has the following attributes

<details>

<summary>Task Array</summary>

```javascript
//an array of task objects
{ 
	"tasks" : [{
	    "name" : "Super Details", // Name of the task
	    "instruction": "Upload Super Details", //Instruction to user
	    "id": "super-details", // custom id of task
	    "type": "Template", // type of data
	    "icon" : "money" // icon for task (only available on higher plans)
},
```

**tasks** *<mark style="color:red;">Array</mark>*

An array of objects, each of which represents a task to be completed by the user.

</details>

###

### <mark style="background-color:blue;">Create Custom Task List</mark>

Creating a custom task list for your users to complete is a great way to increase engagement and match user actions to your business objectives.

When you submit a custom task list, it replaces the default one.

#### Code Example

{% tabs %}
{% tab title="Node.js" %}

```javascript
import axios from 'axios'

axios.patch('YOUR_API_URL/v1/company/tasklist',
    headers: {
      'Authorization': 'Bearer API_KEY'
    }, {
      "tasks": [{
        "name": "Super Details",
        "instruction": "Upload Super Details",
        "id": "super-details",
        "type": "Template",
        "icon": "money"
      }, {
        "name": "Insurance Details",
        "instruction": "Upload Insurance Details",
        "id": "insurance-details",
        "type": "Template",
        "icon": "hospital"
      }]
    }.then(res => {
      console.log(res);
    }).catch(err => {
      console.log(err);
    });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'YOUR_API_URL/v1/company/tasklist'
headers = {'Authorization': 'Bearer API_KEY'}
data = {
    "tasks": [{
        "name": "Super Details",
        "instruction": "Upload Super Details",
        "id": "super-details",
        "type": "Template",
        "icon": "money"
    }, {
        "name": "Insurance Details",
        "instruction": "Upload Insurance Details",
        "id": "insurance-details",
        "type": "Template",
        "icon": "hospital"
    }]
}

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

if response.status_code == 200:
    print(response.json())
else:
    print(f'Error: {response.status_code}')

```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X PATCH -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" -d '{
    "tasks": [{
        "name": "Super Details",
        "instruction": "Upload Super Details",
        "id": "super-details",
        "type": "Template",
        "icon": "money"
    }, {
        "name": "Insurance Details",
        "instruction": "Upload Insurance Details",
        "id": "insurance-details",
        "type": "Template",
        "icon": "hospital"
    }]
}' "YOUR_API_URL/v1/company/tasklist"

```

{% endtab %}
{% endtabs %}

#### Request Details

## Creates a custom task list for your company.&#x20;

<mark style="color:purple;">`PATCH`</mark> `YOUR_API_URL/v1/company/tasklist`

If you would like to update an individual task you will need to send the full list with the updated task.

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<API\_KEY> |

#### Request Body

| Name                                    | Type  | Description              |
| --------------------------------------- | ----- | ------------------------ |
| tasks<mark style="color:red;">\*</mark> | Array | An array of task objects |

{% tabs %}
{% tab title="200: OK Should return new custom task list" %}

```javascript
{
	"tasks" : [
		{
			"name" : "Super Details",
			"instruction": "Upload Super Details",
			"id": "super-details",
			"type": "Template",
			"icon" : "money"
		},
		{
			"name" : "Credit Card",
			"instruction": "Enter Credit Card Info",
			"id": "credit-card",
			"type": "Document",
			"icon" : "credit-card"
		}
	]
}
```

{% endtab %}
{% endtabs %}

### <mark style="background-color:blue;">Retrieve Custom Task List</mark>

Retrieve the custom task list for your company.

#### Code Example

{% tabs %}
{% tab title="Node.js" %}

```javascript
import axios from 'axios'

axios.get('YOUR_API_URL/v1/company/tasklist',
headers: {
      'Authorization': 'Bearer API_KEY'
    }).then(res => {
  console.log(res);
}).catch(err => {
  console.log(err);
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'YOUR_API_URL/v1/company/tasklist'
headers = {'Authorization': 'Bearer API_KEY'}

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

if response.status_code == 200:
    print(response.json())
else:
    print(f'Error: {response.status_code}')

```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -H "Authorization: Bearer API_KEY" "YOUR_API_URL/v1/company/tasklist"

```

{% endtab %}
{% endtabs %}

#### Request Details

## Retrieve the custom task list for your company.

<mark style="color:blue;">`GET`</mark> `YOUR_API_URL/v1/company/tasklist`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<API\_KEY> |

{% tabs %}
{% tab title="200: OK Returns custom task list for company in JSON" %}

```javascript
{
	"tasks" : [
		{
			"name" : "Super Details",
			"instruction": "Upload Super Details",
			"id": "super-details",
			"type": "Template",
			"icon" : "money"
		},
		{
			"name" : "Credit Card",
			"instruction": "Enter Credit Card Info",
			"id": "credit-card",
			"type": "Document",
			"icon" : "credit-card"
		}
	]
}
```

{% endtab %}
{% endtabs %}

### <mark style="background-color:blue;">Get Completed/Incomplete Tasks of User</mark>

See which of the internal application tasks the user has completed or not completed.

#### Code Example

{% tabs %}
{% tab title="Node.js" %}

```javascript
import axios from 'axios'

axios.get('YOUR_API_URL/clients/:clientId/tasks?status=complete',
headers: {
      'Authorization': 'Bearer API_KEY'
    }).then(res => {
  console.log(res);
}).catch(err => {
  console.log(err);
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'YOUR_API_URL/clients/:clientId/tasks?status=complete'
headers = {'Authorization': 'Bearer API_KEY'}

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

if response.status_code == 200:
    print(response.json())
else:
    print(f'Error: {response.status_code}')

```

{% endtab %}

{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl -H "Authorization: Bearer API_KEY" "YOUR_API_URL/clients/:clientId/tasks?status=complete"

```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Request Details

## Returns a list of completed/incomplete tasks for a client.

<mark style="color:blue;">`GET`</mark> `YOUR_API_URL/clients/:clientId/tasks?status={taskStatus}`

#### Path Parameters

| Name                                       | Type   | Description                           |
| ------------------------------------------ | ------ | ------------------------------------- |
| clientId<mark style="color:red;">\*</mark> | String | ID associated with the client record. |

#### Query Parameters

| Name       | Type   | Description                                              |
| ---------- | ------ | -------------------------------------------------------- |
| taskStatus | String | Either “complete” or “incomplete”. Defaults to complete. |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<API\_KEY> |

{% tabs %}
{% tab title="200: OK Returns a list of Tasks in the tasks property." %}

```javascript
{
	"tasks" : [
		{
			"name" : "Super Details",
			"instruction": "Upload Super Details",
			"id": "super-details",
			"type": "Template",
			"icon" : "money"
		},
		{
			"name" : "Credit Card",
			"instruction": "Enter Credit Card Info",
			"id": "credit-card",
			"type": "Document",
			"icon" : "credit-card"
		}
	],
	"query": "complete" // returns the taskStatus in the query param
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beprepared.gitbook.io/beprepared/task-list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
