# Task

## Module endpoints

* [`DELETE /tasks/:id`](#delete-tasks-id)​
* ​[`GET /tasks`](#get-invites)​
* ​[`GET /tasks/:id`](#get-tasks-id)​
* ​[`PATCH /tasks/:id`](#patch-tasks-id)​
* ​[`POST /tasks`](#post-tasks)​
* [`POST /tasks/:id/complete`](#post-tasks-id-complete)
* ​[`POST /tasks/:id/reorder`](#post-tasks-id-reorder)

### `DELETE /tasks/:id`

> `DELETE` <http://api.slyk.i&#x6F;**/tasks/:id>\*\*

Deletes the `task` with given `id`.

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `GET /tasks` <a href="#get-invites" id="get-invites"></a>

> `GET` <https://api.slyk.i&#x6F;**/tasks>\*\*

Returns a paginated list of `tasks`.

{% tabs %}
{% tab title="Available Filters" %}

| Name         |      Type      | Example                                           |
| ------------ | :------------: | ------------------------------------------------- |
| **enabled**  |    `boolean`   | `filter[enabled]=true`                            |
| **featured** |    `boolean`   | `filter[featured]=false`                          |
| **id**       | `=` `in` `nin` | `filter[id]=7938e446-1c77-4513-8cb0-8b1f2e9f47b9` |
| **name**     | `=` `in` `nin` | `filter[name]=foo`                                |
| **order**    |   `gte` `lte`  | `filter[order]=gte:0.5`                           |
| **type**     | `=` `in` `nin` | `filter[type]=true`                               |
| {% endtab %} |                |                                                   |

{% tab title="Available Sorts" %}

| Name          | Example                                                                                  |
| ------------- | ---------------------------------------------------------------------------------------- |
| **amount**    | <p><code>sort=amount</code><br><code>sort=-amount</code></p>                             |
| **createdAt** | <p><del><code>sort=createdAt</code></del><br><del><code>sort=-createdAt</code></del></p> |
| **enabled**   | <p><code>sort=enabled</code><br><code>sort=-enabled</code></p>                           |
| **featured**  | <p><code>sort=featured</code><br><code>sort=-featured</code></p>                         |
| **name**      | <p><code>sort=name</code><br><code>sort=-name</code></p>                                 |
| **order**     | <p><code>sort=order</code><br><code>sort=-order</code></p>                               |
| **type**      | <p><code>sort=type</code><br><code>sort=-type</code></p>                                 |
| {% endtab %}  |                                                                                          |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "amount": "1.00000000",
      "available": true,
      "buttonLabel": "waldo",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Facebook bonus task",
      "enabled": true,
      "featured": true,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
      "imageUrl": "http://slyk-io/fb-image.png",
      "metadata": {
        "buttonLabel": "waldo",
        "surveyUrl": "http://survey.com"
      },
      "name": "Share your link on Facebook",
      "surveyUrl": "http://survey.com",
      "thumbnailUrl": "http://slyk-io/fb-thumbnail.png",
      "type": "system",
      "updatedAt": "2020-08-10T10:00:00.000Z"
    },
    {
      "amount": "2.00000000",
      "available": true,
      "buttonLabel": "fred",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Twitter bonus task",
      "enabled": true,
      "featured": false,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "imageUrl": "http://slyk-io/twitter-image.png",
      "metadata": {
        "buttonLabel": "fred",
        "surveyUrl": "http://survey.com"
      },
      "name": "Share your link on Twitter",
      "surveyUrl": "http://survey.com",
      "thumbnailUrl": "http://slyk-io/twitter-thumbnail.png",
      "type": "system",
      "updatedAt": "2020-08-10T10:00:00.000Z"
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /tasks/:id`

> `GET` <https://api.slyk.i&#x6F;**/tasks/:id**‌>

Gets the task details of the given `id`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "1.00000000",
    "available": true,
    "buttonLabel": "waldo",
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "description": "Facebook bonus task",
    "enabled": true,
    "featured": true,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "imageUrl": "http://slyk-io/fb-image.png",
    "metadata": {
      "buttonLabel": "waldo",
      "surveyUrl": "http://survey.com"
    },
    "name": "Share your link on Facebook",
    "surveyUrl": "http://survey.com",
    "thumbnailUrl": "http://slyk-io/fb-thumbnail.png",
    "type": "system",
    "updatedAt": "2020-08-10T10:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `PATCH /tasks/:id`

> `PATCH` <https://api.slyk.i&#x6F;**/tasks/:id>\*\*

Patches the `task` details of the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field           |    Type   | Required | Description                                          |
| --------------- | :-------: | :------: | ---------------------------------------------------- |
| **amount**      |  `string` |  `false` | Task amount value.                                   |
| **buttonLabel** |  `string` |  `false` | Task button label.                                   |
| **customData**  |  `object` |  `false` | Can store any additional information about the task. |
| **description** |  `string` |  `false` | Task description.                                    |
| **enabled**     | `boolean` |  `false` | Task enable indicator.                               |
| **featured**    | `boolean` |  `false` | Task featuring indicator.                            |
| **image**       |  `string` |  `false` | Task image.                                          |
| **name**        |  `string` |  `false` | Task name.                                           |
| **order**       |  `string` |  `false` | Task order value.                                    |
| **surveyUrl**   |  `string` |  `false` | Task survey URL.                                     |
| **thumbnail**   |  `string` |  `false` | Task thumbnail URL.                                  |
| **type**        |  `string` |  `false` | Task type.                                           |
| {% endtab %}    |           |          |                                                      |

{% tab title="Request" %}

```javascript
{
  "buttonLabel": "waldo",
  "description": "Facebook bonus task",
  "image": "fb-image.png",
  "name": "Share your link on Facebook",
  "surveyUrl": "http://survey.com",
  "thumbnail": "http://slyk.io/fb-thumbnail.png"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "1.00000000",
    "available": true,
    "buttonLabel": "waldo",
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "description": "Facebook bonus task",
    "enabled": true,
    "featured": true,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "imageUrl": "http://slyk-io/fb-image.png",
    "metadata": {
      "buttonLabel": "waldo",
      "surveyUrl": "http://survey.com"
    },
    "name": "Share your link on Facebook",
    "surveyUrl": "http://survey.com",
    "thumbnailUrl": "http://slyk-io/fb-thumbnail.png",
    "type": "system",
    "updatedAt": "2020-08-10T10:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /tasks`

> `POST` <https://api.slyk.i&#x6F;**/tasks>\*\*

Creates a new `task`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field           |    Type   | Required | Description                                          |
| --------------- | :-------: | :------: | ---------------------------------------------------- |
| **amount**      |  `string` |  `true`  | Task amount value.                                   |
| **buttonLabel** |  `string` |  `false` | Task button label.                                   |
| **customData**  |  `object` |  `false` | Can store any additional information about the task. |
| **description** |  `string` |  `true`  | Task description.                                    |
| **enabled**     | `boolean` |  `false` | Task enable indicator.                               |
| **featured**    | `boolean` |  `false` | Task featuring indicator.                            |
| **image**       |  `string` |  `false` | Task image.                                          |
| **name**        |  `string` |  `true`  | Task name.                                           |
| **order**       |  `string` |  `false` | Task order value.                                    |
| **surveyUrl**   |  `string` |  `false` | Task survey URL.                                     |
| **thumbnail**   |  `string` |  `false` | Task thumbnail URL.                                  |
| **type**        |  `string` |  `true`  | Task type.                                           |
| {% endtab %}    |           |          |                                                      |

{% tab title="Request" %}

```javascript
{
  "amount": "1.00000000",
  "buttonLabel": "waldo",
  "description": "Facebook bonus task",
  "image": "fb-image.png",
  "name": "Share your link on Facebook",
  "surveyUrl": "http://survey.com",
  "thumbnail": "http://slyk.io/fb-thumbnail.png"
  "type": "system"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "1.00000000",
    "available": true,
    "buttonLabel": "waldo",
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "description": "Facebook bonus task",
    "enabled": true,
    "featured": true,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "imageUrl": "http://slyk-io/fb-image.png",
    "metadata": {
      "buttonLabel": "waldo",
      "surveyUrl": "http://survey.com"
    },
    "name": "Share your link on Facebook",
    "surveyUrl": "http://survey.com",
    "thumbnailUrl": "http://slyk-io/fb-thumbnail.png",
    "type": "system",
    "updatedAt": "2020-08-10T10:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /tasks/:id/complete`

> `POST` <http://api.slyk.i&#x6F;**/tasks/:id/complete>\*\*

Completes the `task` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field        |   Type   | Required | Description                              |
| ------------ | :------: | :------: | ---------------------------------------- |
| **userId**   | `string` |  `true`  | User identifier that completed the task. |
| {% endtab %} |          |          |                                          |

{% tab title="Request" %}

```javascript
{
  "userId": "174c3e0d-226f-443a-a010-12b2140de03c"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `POST /tasks/:id/reorder`

> `POST` <http://api.slyk.i&#x6F;**/tasks/:id/reorder>\*\*

Reorders the `task` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field            |   Type   | Required | Description                 |
| ---------------- | :------: | :------: | --------------------------- |
| **subsequentId** | `string` |  `false` | Subsequent task identifier. |
| {% endtab %}     |          |          |                             |

{% tab title="Request" %}

```javascript
{
  "subsequentId": "174c3e0d-226f-443a-a010-12b2140de03c"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}


---

# Agent Instructions: 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://developers.slyk.io/slyk/reference/endpoints/task.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.
