Docy

API Documentation

Estimated reading: 2 minutes

You can use the endpoint we created to access Kaila AI directly not through our web. The endpoint is located on https://api.kaila.ai/integrations/direct/answer URL and you can use a number of libraries to access it (in our example we use requests).

Each API key is per agent, so if you want to use multiple agents you will need multiple API keys.

For the endpoint to work you need to send two information:

  1. “question” – the question you want to be answered

  2. “api_key” – your API key

 

Python usage example:

import requests
#API key 
api_key = "YOUR API KEY"

#POST request with data
response_data = {
    "question": "How can Kaila help me with information retrieval in large amount of documents?",
    "api_key": api_key
}
url =  "https://api.kaila.ai/integrations/direct/answer" 
response = requests.post(url, json=response_data)
#Print the recieved response
response_json = response.json()
print(response_json)

JavaScript usage example:

const kailaAPIURL = "https://api.kaila.ai/integrations/direct/answer";
const kailaAPIKey = "You Kaila API Key";
const question = "You question";

fetch(kailaAPIURL, {
  method: "POST",
  body: JSON.stringify({
    question: question,
    api_key: kailaAPIKey
  }),
  headers: {
    "Content-type": "application/json; charset=UTF-8"
  }
})
  .then((response) => response.json())
  .then((json) => console.log(json));

The response will contain the following:

  1. “success” – boolean true if we were successful false if something went wrong

  2. “question” – question that was asked

  3. “response” – response to that question

  4. “remaining_tokens” – remaining tokens that you have left

To obtain an API key, please contact us at info@weboard.me. If you have any further questions, you can also contact us at the email provided. API access is available on request for PRO Plan subscribers only!