# Questions

**Ask Question**

* **Endpoint:** `POST /questions/ask`
* **Description:** Ask a question about a specific document or knowledge base.
* **Request Body:**
  * `query`: The question text.
  * `documentId` or `kb_id`: The ID of the document or knowledge base to query.
* **Response:** Answer object containing the answer to the question.

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

```bash
curl -X POST \
     -H "Authorization: Bearer your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"query": "What is the main conclusion?", "documentId": "abc123"}' \
     https://api.pagepeek.com/v1/questions/ask
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "question": "What is the main conclusion?",
    "answer": "The main conclusion is that...",
    "documentId": "abc123"
}
```

{% endtab %}
{% endtabs %}

**Get Question History**

* **Endpoint:** `GET /questions/history`
* **Description:** Retrieve the history of questions asked by the user.
* **Response:** Array of question objects containing question and answer history.

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

```bash
curl -X GET \
     -H "Authorization: Bearer your_api_key_here" \
     https://api.pagepeek.com/v1/questions/history
```

{% endtab %}

{% tab title="Response" %}

```json
[
    {
        "question": "What is the main conclusion?",
        "answer": "The main conclusion is that...",
        "documentId": "abc123",
        "timestamp": "2023-10-01T12:00:00Z"
    },
    // ...other questions
]
```

{% endtab %}
{% endtabs %}
