API Access
Legible provides a REST API for programmatic access to query generation and execution. You can manage API keys, view request history, and monitor usage from the API Management section.
API Keys
Generate API keys to authenticate programmatic requests:
- Go to Settings → API Keys
- Click Generate New Key
- Copy the key — it won't be shown again
- Use it in the
Authorization: Bearer <key>header
API History
The API History page shows a log of all API calls, including:
- Request timestamp
- API type (query, validation, etc.)
- Input question or SQL
- Response status and execution time
- Generated SQL
Use the filters to narrow results by API type or date range. You can also export the history for analysis.
API Reference
For the full endpoint reference — including request/response schemas, streaming, knowledge management, and code examples — see the API Reference section.
Quick links:
- SQL Endpoints — Generate SQL, execute queries
- AI Analysis — Ask, summaries, charts
- Streaming — Server-Sent Events for real-time UIs
- Models & Schema — Retrieve deployed models, generate descriptions
- Knowledge Base — Manage instructions and SQL pairs
Query Usage
Monitor API usage from the Query Usage dashboard, which shows:
- Total queries this month
- Queries by source (UI, API, MCP)
- Daily usage trends
- Cost breakdown (if billing is enabled)