Developers

API Integration Guide

Integrate Dragon's neural RAG capabilities directly into your own applications using our public API.

Core Requirements

  1. API Key: Generate a secure key from your Developer Settings.
  2. Project Context: Know the project name you want to query against.
  3. Endpoint: All requests should be sent to: https://www.dragonai.systems/api/v1/chat

Integration Steps

1. Generate your Token

Navigate to the API Keys tab in your profile. Create a new token and copy it immediately.

2. Prepare the Request

Send a POST request with the following headers:

  • Dragon-API-Key: Your secret token.
  • Content-Type: application/json.

3. Handle the Response

The API returns a JSON response containing the message from the assistant and the sources retrieved from your project.

Code Examples

Python (Requests)

python
import requests

url = "https://www.dragonai.systems/api/v1/chat"
headers = {
    "Dragon-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "message": "What is the summary of project X?",
    "stream": False
}

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

Node.js (Fetch)

javascript
const fetch = require('node-fetch');

async function askDragon() {
  const response = await fetch('https://www.dragonai.systems/api/v1/chat', {
    method: 'POST',
    headers: {
      'Dragon-API-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      message: 'Explain the new system architecture.',
      stream: false
    })
  });

  const data = await response.json();
  console.log(data);
}

JavaScript (Browser)

javascript
async function askDragon() {
  try {
    const response = await fetch('https://www.dragonai.systems/api/v1/chat', {
      method: 'POST',
      headers: {
        'Dragon-API-Key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        message: 'Explain the new system architecture.',
        stream: false
      })
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(errorData.error || 'API Failed');
    }

    const data = await response.json();
    console.log("AI Response:", data);
  } catch (error) {
    console.error("Error asking Dragon AI:", error);
  }
}

askDragon();

cURL

bash
curl -X POST https://www.dragonai.systems/api/v1/chat \
  -H "Dragon-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Hello Dragon!",
    "stream": false
  }'