Complete reference for the TengineAI REST API.
https://app.tengine.ai/api/v1
All API requests require authentication using your API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://app.tengine.ai/api/v1/projects
GET /projects
Response:
{
"data": [
{
"id": "proj_123",
"name": "My Project",
"description": "A sample project",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 1
}
}
POST /projects
Request Body:
{
"name": "New Project",
"description": "Project description"
}
Response:
{
"id": "proj_456",
"name": "New Project",
"description": "Project description",
"created_at": "2024-01-01T00:00:00Z"
}
GET /projects/{project_id}/api-keys
POST /projects/{project_id}/api-keys
Request Body:
{
"name": "My API Key",
"permissions": ["read", "write"],
"expires_at": "2024-12-31T23:59:59Z"
}
GET /projects/{project_id}/analytics
Query Parameters:
start_date: Start date (ISO 8601)end_date: End date (ISO 8601)granularity: hour, day, week, monthAll errors follow this format:
{
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid",
"details": {
"field": "authorization",
"value": "invalid_key"
}
}
}
INVALID_API_KEY: API key is invalid or expiredRATE_LIMIT_EXCEEDED: Rate limit exceededPROJECT_NOT_FOUND: Project doesn't existINSUFFICIENT_PERMISSIONS: API key lacks required permissionsVALIDATION_ERROR: Request validation failednpm install @tengineai/sdk
import { TengineAI } from '@tengineai/sdk';
const client = new TengineAI({
apiKey: 'your-api-key'
});
// Create a project
const project = await client.projects.create({
name: 'My Project',
description: 'A sample project'
});
pip install tengineai
from tengineai import TengineAI
client = TengineAI(api_key='your-api-key')
# Create a project
project = client.projects.create(
name='My Project',
description='A sample project'
)
POST /projects/{project_id}/webhooks
Request Body:
{
"url": "https://your-app.com/webhook",
"events": ["project.created", "api_key.created"],
"secret": "webhook_secret"
}
project.created: New project createdproject.updated: Project updatedapi_key.created: New API key generatedapi_key.revoked: API key revokedintegration.connected: OAuth integration connected{
"id": "evt_123",
"type": "project.created",
"data": {
"id": "proj_123",
"name": "My Project"
},
"created_at": "2024-01-01T00:00:00Z"
}
// 1. Create project
const project = await client.projects.create({
name: 'My App',
description: 'A sample application'
});
// 2. Generate API key
const apiKey = await client.apiKeys.create(project.id, {
name: 'Production Key',
permissions: ['read', 'write']
});
// 3. Set up webhook
const webhook = await client.webhooks.create(project.id, {
url: 'https://myapp.com/webhook',
events: ['api_key.created']
});