# 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.


---

# 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://docs.lingoblocks.com/docs/api/endpoints.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.
