First set up your personal API key by going to SettingsApi KeysCreate API Key

image.png

And configure in your terminal the following environment variables:

export BASE_URL="<https://api.stack-ai.com>"
export BEARER_TOKEN=<YOUR_PERSONAL_API_KEY>

You should be ready to use our API

Create Knowledge Base

curl -sS -X POST "$BASE_URL/v1/knowledge-bases" \\
  -H "Authorization: Bearer $BEARER_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{
    "name": "Manual CRUD KB",
    "description": "Knowledge base created from API",
    "indexing_params": {
      "ocr": false,
      "embedding_params": {
        "embedding_model": "openai.text-embedding-3-large",
        "api_key": null
      },
      "chunker_params": {
        "chunk_size": 2500,
        "chunk_overlap": 100,
        "chunker_type": "sentence"
      }
    },
    "org_level_role": null
  }'

You can avoid sending parameters that you want to use the platform’s default values, for example if you don’t want to set your own indexing_params and use our suggested ones.

List Knowledge Bases