# Unanswered Questions

Stores questions that did not receive a satisfactory answer from the knowledge base, scoped by project and knowledge base (`namespace`). All routes require authentication; the namespace must belong to the current project.

### Unanswered question object

Defined by the Mongoose schema: `id_project`, `namespace`, and `question` are required; `timestamps: true` adds `createdAt` and `updatedAt`.

| Key          | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| `_id`        | String | Unique identifier of the unanswered question document.   |
| `id_project` | String | Project identifier (set from the authenticated request). |
| `namespace`  | String | Knowledge base identifier (same as KB `id`).             |
| `question`   | String | The user question text.                                  |
| `createdAt`  | String | Creation time (ISO date).                                |
| `updatedAt`  | String | Last update time (ISO date)                              |

## Add an unanswered question

<mark style="color:green;">`POST`</mark> `https://api.tiledesk.com/v3/:project_id/kb/unanswered`

Creates a new unanswered question for the given knowledge base namespace.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The Project Id is a unique code assigned to your project when you create it in Tiledesk. |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Authorization token. Basic Auth or JWT |

#### Request Body

| Name      | Type   | Description                                                                      |
| --------- | ------ | -------------------------------------------------------------------------------- |
| namespace | string | (Required) Knowledge base id the question refers to. Must belong to the project. |
| question  | string | (Required) The question text to store.                                           |

{% tabs %}
{% tab title="200 Created document" %}

```
{
    "_id": "671a1b2c3d4e5f6789012345",
    "id_project": "63ad512e70d5ed0012ad6286",
    "namespace": "66a897133eaa7f0013632c5b",
    "question": "How do I reset my password?",
    "createdAt": "2025-10-24T12:00:00.000Z",
    "updatedAt": "2025-10-24T12:00:00.000Z"
}
```

{% endtab %}

{% tab title="400 Missing `namespace` or `question`" %}

```
{
    "success": false,
    "error": "Missing required parameters: namespace and question"
}
```

{% endtab %}

{% tab title="403 Namespace does not belong to the project" %}

```
{
    "success": false,
    "error": "Not allowed. The namespace does not belong to the current project."
}
```

{% endtab %}

{% tab title="500 Server error" %}

```
{
    "success": false,
    "error": "Error adding unanswered question"
}
```

{% endtab %}
{% endtabs %}

Example

```
curl -v -X POST -u user@example.com:password \
  -H "Content-Type: application/json" \
  -d '{"namespace":"66a897133eaa7f0013632c5b","question":"How do I reset my password?"}' \
  https://api.tiledesk.com/v3/63ad512e70d5ed0012ad6286/kb/unanswered
```

***

## Count unanswered questions

<mark style="color:blue;">`GET`</mark> `https://api.tiledesk.com/v3/:project_id/kb/unanswered/count/:namespace`

Returns the total number of unanswered questions for a namespace. In the API implementation, this route should be registered before the generic list route so that the path segment `count` is not interpreted as a namespace.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The Project Id is a unique code assigned to your project when you create it in Tiledesk. |
| namespace   | string | Knowledge base id.                                                                       |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Authorization token. Basic Auth or JWT |

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

```
{
    "count": 42
}
```

{% endtab %}

{% tab title="400 Missing namespace" %}

```
{
    "success": false,
    "error": "Missing required parameter: namespace"
}
```

{% endtab %}

{% tab title="403 Namespace does not belong to the project" %}

```
{
    "success": false,
    "error": "Not allowed. The namespace does not belong to the current project."
}
```

{% endtab %}

{% tab title="500 Server error" %}

```
{
    "success": false,
    "error": "Error counting unanswered questions"
}
```

{% endtab %}
{% endtabs %}

Example

```
curl -v -X GET -u user@example.com:password \
  https://api.tiledesk.com/v3/63ad512e70d5ed0012ad6286/kb/unanswered/count/66a897133eaa7f0013632c5b
```

***

## List unanswered questions

<mark style="color:blue;">`GET`</mark> `https://api.tiledesk.com/v3/:project_id/kb/unanswered/:namespace`

Returns a paginated list of unanswered questions for a namespace. Default pagination: `page` 0, `limit` 20. Default sort: field `createdAt`, direction `-1` (descending). `direction` is numeric: `-1` for descending, `1` for ascending.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The Project Id is a unique code assigned to your project when you create it in Tiledesk. |
| namespace   | string | Knowledge base id.                                                                       |

#### Query Parameters

| Name      | Type    | Description                                                                           |
| --------- | ------- | ------------------------------------------------------------------------------------- |
| page      | integer | Page index (0-based). Default: `0`.                                                   |
| limit     | integer | Page size. Default: `20`.                                                             |
| sortField | string  | Field to sort by (any field on the document, e.g. `createdAt`). Default: `createdAt`. |
| direction | integer | Sort direction (`-1` or `1`). Default: `-1`.                                          |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Authorization token. Basic Auth or JWT |

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

```
{
    "count": 2,
    "questions": [
        {
            "_id": "671a1b2c3d4e5f6789012345",
            "id_project": "63ad512e70d5ed0012ad6286",
            "namespace": "66a897133eaa7f0013632c5b",
            "question": "How do I reset my password?",
            "createdAt": "2025-10-24T12:00:00.000Z",
            "updatedAt": "2025-10-24T12:00:00.000Z"
        }
    ],
    "query": {
        "page": 0,
        "limit": 20,
        "sortField": "createdAt",
        "direction": -1
    }
}
```

{% endtab %}

{% tab title="400 Missing namespace" %}

```
{
    "success": false,
    "error": "Missing required parameter: namespace"
}
```

{% endtab %}

{% tab title="403 Namespace does not belong to the project" %}

```
{
    "success": false,
    "error": "Not allowed. The namespace does not belong to the current project."
}
```

{% endtab %}

{% tab title="500 Server error" %}

```
{
    "success": false,
    "error": "Error getting unanswered questions"
}
```

{% endtab %}
{% endtabs %}

Example

```
curl -v -X GET -u user@example.com:password \
  "https://api.tiledesk.com/v3/63ad512e70d5ed0012ad6286/kb/unanswered/66a897133eaa7f0013632c5b?page=0&limit=20&sortField=createdAt&direction=-1"
```

***

## Delete an unanswered question

<mark style="color:red;">`DELETE`</mark> `https://api.tiledesk.com/v3/:project_id/kb/unanswered/:id`

Deletes a single unanswered question by its document id. The question must belong to the current project.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The Project Id is a unique code assigned to your project when you create it in Tiledesk. |
| id          | string | The unanswered question document id (`_id`).                                             |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Authorization token. Basic Auth or JWT |

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

```
{
    "success": true,
    "message": "Question deleted successfully"
}
```

{% endtab %}

{% tab title="404 No document for this id and project" %}

```
{
    "success": false,
    "error": "Question not found"
}
```

{% endtab %}

{% tab title="500 Server error" %}

```
{
    "success": false,
    "error": "Error deleting unanswered question"
}
```

{% endtab %}
{% endtabs %}

Example

```
curl -v -X DELETE -u user@example.com:password \
  https://api.tiledesk.com/v3/63ad512e70d5ed0012ad6286/kb/unanswered/671a1b2c3d4e5f6789012345
```

***

## Delete all unanswered questions for a namespace

<mark style="color:red;">`DELETE`</mark> `https://api.tiledesk.com/v3/:project_id/kb/unanswered/namespace/:namespace`

Removes every unanswered question stored for the given knowledge base namespace within the project.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The Project Id is a unique code assigned to your project when you create it in Tiledesk. |
| namespace   | string | Knowledge base id.                                                                       |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Authorization token. Basic Auth or JWT |

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

```
{
    "success": true,
    "count": 15,
    "message": "All questions deleted successfully"
}
```

{% endtab %}

{% tab title="403 Namespace does not belong to the project" %}

```
{
    "success": false,
    "error": "Not allowed. The namespace does not belong to the current project."
}
```

{% endtab %}

{% tab title="500 Server error" %}

```
{
    "success": false,
    "error": "Error deleting unanswered questions"
}
```

{% endtab %}
{% endtabs %}

Example

```
curl -v -X DELETE -u user@example.com:password \
  https://api.tiledesk.com/v3/63ad512e70d5ed0012ad6286/kb/unanswered/namespace/66a897133eaa7f0013632c5b
```

***


---

# 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://developer.tiledesk.com/apis/rest-api/knowledge-bases/unanswered.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.
