Elegia Documentation
Get up to speed with our API, tools, and systems. Comprehensive guides for developers.
Getting Started
-
1
Install Elegia CLI:
npm install -g elegia
-
2
Initialize project:
elegia init my-project
-
3
Run the dev server:
cd my-project && elegia dev
API Reference
Authentication
POST /auth
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"action": "authorize",
"scope": "read:write"
}
Data Query
GET /api/data?query=SELECT+*+FROM+users
Authorization: Bearer YOUR_ACCESS_TOKEN
Examples
Basic Integration
import Elegia from 'elegia-sdk';
const client = new Elegia({
apiKey: 'YOUR_API_KEY',
environment: 'production'
});
async function fetchUsers() {
const response = await client.query({
query: 'SELECT * FROM users LIMIT 10'
});
console.log('Users:', response.data);
}
fetchUsers();
Webhooks
// server.js
const express = require('express');
const { verifyWebhook } = require('elegia-sdk');
const app = express();
app.post('/webhook', express.json(), (req, res) => {
if (verifyWebhook(req)) {
console.log('Received webhook:', req.body);
res.status(200).send('Event received');
} else {
res.status(401).send('Unauthorized');
}
});
app.listen(3000);
FAQ
Can I use Elegia without API keys?
Our free tier allows 1000 API calls/month without authentication. Create a free account to get higher limits.
Where can I find my API key?
Log into your dashboard at developer.elegia.com and check the "API" tab in your profile settings.
How do I get production support?
Contact our enterprise team at enterprise@elegia.com for dedicated support and premium features.