TrainBot

API Keys

Generate an API key so anyone can use your trained bot inside their own app or website. Every key gets full access to the bot's knowledge via a simple REST API.

    Developer Docs — use the bot in any app

    1. Ask the bot a question
    POST https://YOUR-DOMAIN/v1/chat
    Authorization: Bearer tb_your_api_key
    Content-Type: application/json
    
    { "message": "What is machine learning?" }
    Response
    {
      "answer": "Machine learning is a field of study...",
      "source": { "title": "...", "url": "https://..." },
      "confidence": "high",
      "score": 12.4
    }
    2. JavaScript example
    const res = await fetch('https://YOUR-DOMAIN/v1/chat', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer tb_your_api_key',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ message: 'What is machine learning?' })
    });
    const data = await res.json();
    console.log(data.answer);
    3. Python example
    import requests
    r = requests.post('https://YOUR-DOMAIN/v1/chat',
        headers={'Authorization': 'Bearer tb_your_api_key'},
        json={'message': 'What is machine learning?'})
    print(r.json()['answer'])
    Other endpoints
    GET /v1/stats   — bot knowledge statistics (requires Bearer key)