> For the complete documentation index, see [llms.txt](https://docs.lingoblocks.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lingoblocks.com/docs/api/endpoints.md).

# Endpoints

Always remember to handle and display any error messages to users gracefully, and use the `accessToken` for authenticating subsequent requests to the Chatbot API after the initial authentication.

The **base url** is `https://api.lingoblocks.com`.

### **Authenticate Chatbot User**

Authenticate and obtain an access token to communicate with the chatbot.

* **Endpoint**: `/v1/chatbot/:id/authenticate`
* **Method**: POST
* **Request Body**:
  * `accessToken`: The existing access token for the session (optional).
* **Params**:
  * `id`: Your chatbot's unique ID.
* **Response**:
  * `accessToken`: The generated or verified access token for the session.
  * Note: If an existing `accessToken` is not provided or is invalid, a new `accessToken` will be generated.

### **Send a Message to Chatbot**

Send a message to the chatbot and receive its response.

* **Endpoint**: `/v1/chatbot/:id/message`
* **Method**: POST
* **Headers**:
  * `Content-Type`: application/json
* **Params**:
  * `id`: Your chatbot's unique ID.
* **Request Body**:
  * `text`: The message you want to send to the chatbot.
  * `accessToken`: The access token obtained after authentication.
* **Response**:
  * `response`: The chatbot's reply.
  * `metadata`: Additional data about the chatbot's response.

### **Get Chatbot Widget Settings**

Retrieve the settings for displaying the chatbot widget.

* **Endpoint**: `/v1/chatbot/widget/:id/settings`
* **Method**: GET
* **Headers**:
  * `Content-Type`: application/json
* **Params**:
  * `id`: Your chatbot's unique ID.
* **Query Parameters**:
  * `accessToken`: The access token obtained after authentication.
* **Response**:
  * `settings`: Object containing settings like `name` and `profilePhoto` for the chatbot widget.
