Skip to main content

Getting Started

This guide will walk you through the steps to make a basic API request.

Using Your API Key with Botastico API

In the previous steps, you set up your environment variable for the API key and constructed 'headers' for your request. Now, let's use this information to retrieve some data from the Botastico API.

Making a Simple API Request

Let's start with a simple example of making an API request - in this example we are using an endpoint that scrapes the given URLs and adds them to the knowledge-base. Check out our public repo for more example requests.

## .env file

## In addition to the API key variable, create an environment variable to store the base URL as well
## .js file

## Retrieve the environment variables

## Construct 'headers' for the API requests
const headers = { Authorization: `Bearer ${BOTASTICO_API_KEY}`, "Content-Type": "application/json" };

## Create a function to scrape and add URLs to your knowledge-base
const scrapeKbDocUrls = async (id, urls) => {
const response = await fetch(`${BOTASTICO_API_BASE_URL}/agents/${id}/kb/urls/scrape`, {
method: "POST",
body: JSON.stringify({ urls }),
const data = await response.json();
return data;

(async () => {
try {
const scrapedKbDocUrls = await scrapeKbDocUrls(agents[0].agent_id, [""]);
} catch (error) {
console.log("error: ", error);
## POST request body
"urls": [
"loader_type": "unstructured"
## POST request response data
"data": [
"kbdoc_id": "pyrwfCu7OVxVW36jcq7L",
"message": "",
"status": "success",
"message": "URLs scraped and documents processed"

Now that the URL has been scraped and added to your knowledge base, you can ask the chatbot anything related to the information retrieved from that specific URL. Look at the example below.

What is Next.js?