# Data API

Frontnow Advisor's Data API allows you to add documents to the dataset, which can be used to train Frontnow Advisor's AI model. A document can contain a title, text, short description, preview URL, and corresponding website URL.

1. Authentication: To use the Data API, you need to authenticate with an API key. You can obtain an API key from the Frontnow Advisor dashboard.
2. API Endpoint: The API endpoint for adding documents is `https://api.frontnow.com/data/documents`.
3. Request Body: The request body for adding a document is a JSON object that contains the following fields:

## Add Document

<mark style="color:green;">`POST`</mark> `https://api.frontnow.com/data/documents.`

Adding Documents to the Dataset for Training the AI Model

#### Headers

| Name                                       | Type   | Description                              |
| ------------------------------------------ | ------ | ---------------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | String | Frontnow API Key to access the REST API. |

#### Request Body

| Name                                    | Type   | Description                                              |
| --------------------------------------- | ------ | -------------------------------------------------------- |
| title<mark style="color:red;">\*</mark> | String | The title of the document.                               |
| metadata                                | JSON   | A JSON object containing metadata for the document.      |
| website\_url                            | String | The URL of the website that the document corresponds to. |
| preview\_url                            | String | A preview URL for the document.                          |
| description                             | String | A short description of the document.                     |
| text<mark style="color:red;">\*</mark>  | String | The unstructured text of the document.                   |

{% tabs %}
{% tab title="200: OK Successfully added document to dataset" %}

```javascript
{
    "id": "1234567890",
    "status": "success",
    "message": "Document added to the dataset"
}
```

{% endtab %}
{% endtabs %}

Here's an example request body:

```json
{
    "title": "How to Use Frontnow Advisor",
    "text": "Frontnow Advisor is a powerful tool for answering customer questions. To use it...",
    "description": "Learn how to use Frontnow Advisor",
    "preview_url": "https://example.com/preview",
    "website_url": "https://example.com",
    "metadata": {
        "author": "John Doe",
        "category": "Productivity"
    }
}
```

4. Response Body: The response body for adding a document is a JSON object that contains the following fields:

* `status`: The status of the request. Possible values are `success` and `failure`.
* `message`: A message indicating whether the request was successful or not.

5. Training the AI Model: Once the document has been added to the dataset, it can be used to train Frontnow Advisor's AI model. The more documents added to the dataset, the better the AI model will be at generating relevant and accurate answers to customer questions.

By using the Data API to add documents to the dataset for training the Frontnow Advisor's AI model, you can provide the best possible answers to customer questions that are tailored to your brand, products, or services. If you have any questions or need assistance, please don't hesitate to contact us.
