Developers
API Integration Guide
Integrate Dragon's neural RAG capabilities directly into your own applications using our public API.
Core Requirements
- API Key: Generate a secure key from your Developer Settings.
- Project Context: Know the project name you want to query against.
- 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)
pythonimport 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)
javascriptconst 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)
javascriptasync 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
bashcurl -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 }'