Quick Start

Get your API keys

Your API requests are authenticated using the API access-token. Any request that doesn't include an API key will return an error.

To obtain you API key, log into your account on app.knowbase.ai. Click on Account -> Manage Account and click Generate API key from which you will be able to copy your API Key.

You can also generate an API key using Swagger /api/v1/token endpoint at any time.

Before being able to use this endpoint you have to previously log in to knowbase.ai web app and have paid subscribtion plan.

Rate Limit

The API is limited to 10 requests per minute to ensure fair usage and system stability.

Make your first request

To make your first request, send an authenticated request to the /api/v1/upload endpoint with your file. This will create a file ID file_id for your file with which you can chat.

Upload the file

To get the `file_id` for the uploaded document

POST https://api.knowbase.ai/api/v1/upload


Request Body

  "message": "string",
  "file_id": "string"

Example usage

import requests

# The URL for the upload endpoint
url = 'http://api.knowbase.ai/api/v1/upload'

# Replace 'your_access_token_here' with the actual access token you received from the API
headers = {
    'access-token': 'your_access_token_here'

# Replace 'path_to_your_file' with the actual file path on your system
files = {
    'file': ('filename.pdf', open('path_to_your_file', 'rb'), 'application/pdf')

# Make the POST request to upload the file
response = requests.post(url, headers=headers, files=files)

# Check the response
if response.status_code == 200:
    print("File uploaded successfully.")
    print(response.json())  # This will print the response which includes the 'file_id'
    print("Failed to upload file.")
    print(response.json())  # This will print the error message

# Don't forget to close the file if you're not using a context manager

Last updated