> ## Documentation Index
> Fetch the complete documentation index at: https://guide.chatwize.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create chatbot

In this guide, we will walk through the process of creating a chatbot using an API.

## Prerequisites

Before you begin, make sure you have the following:

1. An API key for accessing the Chatwize API.
2. A development environment or tool for making HTTP requests, such as Curl or a programming language like Python.

## API Endpoint

The API endpoint for creating a chatbot is:

```
https://app.chatwize.ai/api/v1/chatbot/create
```

## Request Body

To create a chatbot, you need to send a POST request to the API endpoint with a JSON request body. Here's an example request body:

```json
{
  "model": "gpt-3.5-turbo",
  "name": "Your Chatbot's Name",
  "prompt": "A sample prompt for your chatbot.",
  "rate_limit": [
    20,
    240
  ],
  "rate_limit_message": "Too many messages",
  "show_citations": false,
  "temperature": 0,
  "visibility": "private"
}
```

* model (string, optional): Specify the model you want to use. In this example, we're using <code>gpt-3.5-turbo</code>.

  Options available <code>gpt-3.5-turbo</code>, <code>gpt-3.5-turbo-16k</code>, <code>gpt-4</code>

* name (string, required): Provide a name for your chatbot.

* prompt (string, optional): You can provide an initial prompt for your chatbot.

* rate\_limit (array, optional): Set the rate limit for the chatbot in messages per minute. It's an array with two values: \[20, 240].

  First number: amount of messages. Min <code>1</code> - Max <code>100</code>
  Second number: amount of seconds. Min <code>1</code> - Max <code>360</code>

* rate\_limit\_message (string, optional): Define a message to display when the rate limit is exceeded.

* show\_citations (boolean, optional): Set to true if you want the chatbot to show citations for its responses.

* temperature (float, optional): You can adjust the temperature parameter for response randomness. A value of 0 makes responses deterministic, while higher values increase randomness.

  Options are values as a float between <code>0</code> and <code>1</code>

* visibility (string, optional): Set the visibility of your chatbot. Options are "private" or "public."

  Options available <code>private</code>, <code>public</code>, <code>hybrid</code>

## Example Request

Here're example command sto create a chatbot using the Chatwize API:

<Warning>Replace **token** with your actual API key.</Warning>

<CodeGroup>
  ```bash Curl
  curl --location --request POST 'https://app.chatwize.ai/api/v1/chatbot/create' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data-raw '{
      "model": "gpt-3.5-turbo",
      "name": "Your Chatbot Name",
      "prompt": "A sample prompt for your chatbot.",
      "rate_limit": [
          20,
          240
      ],
      "rate_limit_message": "Too many messages",
      "show_citations": false,
      "temperature": 0,
      "visibility": "private"
  }'
  ```

  ```py Python
  import requests

  url = 'https://app.chatwize.ai/api/v1/chatbot/create'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer <token>'
  }

  data = {
      "model": "gpt-3.5-turbo",
      "name": "Your Chatbot Name",
      "prompt": "A sample prompt for your chatbot.",
      "rate_limit": [
          20,
          240
      ],
      "rate_limit_message": "Too many messages",
      "show_citations": false,
      "temperature": 0,
      "visibility": "private"
  }

  response = requests.post(url, headers=headers, json=data)

  if response.status_code == 200:
      print("Request successful!")
      print(response.json())
  else:
      print("Request failed with status code:", response.status_code)
      print(response.text)
  ```

  ```ts JavaScript
  const axios = require('axios');

  const url = 'https://app.chatwize.ai/api/v1/chatbot/create';
  const headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer <token>'
  };

  const data = {
      "model": "gpt-3.5-turbo",
      "name": "Your Chatbot Name",
      "prompt": "A sample prompt for your chatbot.",
      "rate_limit": [
          20,
          240
      ],
      "rate_limit_message": "Too many messages",
      "show_citations": false,
      "temperature": 0,
      "visibility": "private"
  };

  axios.post(url, data, { headers })
      .then(response => {
          console.log('Request successful!');
          console.log(response.data);
      })
      .catch(error => {
          console.error('Request failed:', error);
      });
  ```
</CodeGroup>

That's it! You've now learned how to create your own chatbot using the Chatwize API.
