API Overview
API Overview
The AI for Database REST API lets applications and AI agents integrate natural-language querying, raw database results, dashboards, complete workflow automation, webhook subscriptions, usage, and API-key management. An agent can inspect sanitized connection metadata and schema, run raw SQL, create an encrypted outbound credential, build and revise a paused workflow draft, preview its query results without delivery, test one real action, inspect sanitized delivery attempts, and explicitly publish the workflow without using the browser UI.
Base URL
https://app.aifordatabase.com/api/v1For self-hosted deployments, the base URL is your instance's address followed by /api/v1.
Live API Reference
An interactive, always-current API reference is served by the app itself:
- Browsable docs: app.aifordatabase.com/api/v1/docs
- OpenAPI 3.1 spec: app.aifordatabase.com/api/v1/openapi.json
If anything on this page ever disagrees with the OpenAPI spec, the spec wins. AI agents integrating with the API should fetch the OpenAPI spec directly.
Versioning
The API is versioned using URL path prefixes (/v1). We guarantee backward compatibility within a major version. Breaking changes will be released under a new version prefix with a migration guide.
Authentication
All API requests require authentication via a Bearer token in the Authorization header. API keys start with afd_:
curl -H "Authorization: Bearer afd_your_api_key" \
https://app.aifordatabase.com/api/v1/connectionsGenerate API keys in Settings > API Keys. Each key is scoped to specific permission areas (see Authentication) and has an optional expiration date.
Response Format
All responses are JSON with a consistent envelope — data and error are mutually exclusive:
{
"data": { ... },
"error": null,
"meta": {
"requestId": "8d6eb159-9896-4274-94c7-fab3f95ae1c6",
"timestamp": "2026-01-15T10:30:00Z"
}
}Error responses:
{
"data": null,
"error": {
"code": "VALIDATION_ERROR",
"message": "name is required",
"details": { ... }
},
"meta": {
"requestId": "8d6eb159-9896-4274-94c7-fab3f95ae1c6",
"timestamp": "2026-01-15T10:30:00Z"
}
}Rate Limits
Limits are applied per organization, per minute:
| Plan | General requests/min | Chat requests/min |
|---|---|---|
| Free | 60 | 20 |
| Pro / Max | 300 | 100 |
| Enterprise | 1,000 | 500 |
Exceeding a limit returns HTTP 429 with a RATE_LIMITED error code.
Pagination
List endpoints support page-based pagination:
GET /api/v1/connections?page=1&pageSize=20The response meta.pagination object contains total, page, pageSize, and totalPages.
Ready to try this on your own database?
Connect in minutes and ask your first question — no SQL required.
Start freeFree plan · No credit card required