API Documentation Endpoints
A deployed Kirak application automatically describes its HTTP API surface through two complementary endpoints:
| Endpoint | Target Audience | Format | Description |
|---|---|---|---|
GET /docs |
AI coding agents & human developers | Markdown | Single comprehensive Markdown document |
GET /openapi.json |
API clients, SDK generators, API gateways | OpenAPI 3.1 | Complete OpenAPI machine-readable schema |
Both endpoints are synthesized dynamically from the active runtime configuration and loaded models – they reflect the exact models, fields, and access rules currently running.
[!NOTE] Kirak does not serve heavy browser UI assets (Swagger UI / ReDoc) by default. For interactive testing, import
/openapi.jsoninto Postman, Insomnia, Bruno, or VS Code REST Client.
What /docs Contains
Section titled “What /docs Contains”The /docs Markdown document provides complete context for an AI coding agent or API caller:
- Quick Reference: Base URLs, CRUD and GraphQL paths, authentication headers, active modules, and links to SDKs.
- Not Supported: Clear boundaries on features Kirak does not support (e.g. whole-table updates without filters, GraphQL introspection).
- Authentication: Exact token schemas, Bearer header requirements, refresh lifecycle, and session flows.
- Response Envelope: Success and error envelope specifications with stable machine error codes.
- CRUD Operations: Detailed endpoint tables per model, query filter syntax, pagination shapes, and model-specific request examples.
- Models: Full field dictionary with types, constraints (
unique,searchable,read-only), access rules, and field-level permissions. - GraphQL: Supported queries, relationship joins, aggregates, and multi-root atomic mutation specifications.
- Modules: Configured module endpoints, active provider instances, and body parameters.
- MCP Servers: Registered tools, schemas, and confirmation requirements.
[!NOTE] Models marked
"internal": trueare completely excluded from/docsand/openapi.json.
Filtered Documentation Views
Section titled “Filtered Documentation Views”Filter parameters allow clients and agents to request concise, targeted subsets of the full API surface:
- Role-Scoped View:
GET /docs?role=user– renders only the models, fields, and operations accessible to that role. - Model-Scoped View:
GET /docs?models=posts,comments– isolates documentation to the specified models. - Combined Filters:
GET /docs?role=user&models=posts
Every response includes an ETag header; clients can pass If-None-Match to receive 304 Not Modified when documentation has not changed.
OpenAPI 3.1 Schema (/openapi.json)
Section titled “OpenAPI 3.1 Schema (/openapi.json)”The /openapi.json document replaces generic wildcard paths with concrete, model-specific route definitions (/posts/fetch, /posts/create), and attaches custom Kirak extension metadata:
| Extension | Target | Content |
|---|---|---|
x-kirak-access |
CRUD operations | Role permissions and row-level condition rules |
x-kirak-rate-limit |
Operations with rate limits | max_requests, window_seconds, and scope |
x-kirak-filter-operators |
Read endpoints & /graphql |
Supported filter operator suffixes |
x-kirak-searchable |
Search operations | Array of searchable field names |
x-kirak-soft-delete |
Model tag | Indicates if soft delete is active |
x-kirak-relationship |
Foreign key properties | Name and key of the related model |
x-kirak-field-access |
Record schemas | Field-level read and write permission arrays |
Configuration Settings
Section titled “Configuration Settings”Configure endpoint visibility in kirak.json:
{ "docs": { "enabled": true, "path": "/docs", "public": true }, "openapi": { "enabled": true, "public": true }}docs.enabled: false– Disables the/docsroute entirely (404 NOT_FOUND).docs.public: false– Requires authentication to view/docs(401 MISSING_TOKENfor guests).openapi.enabled: false– Disables/openapi.json(404 NOT_FOUND).openapi.public: false– Requires authentication to view/openapi.json.
[!SECURITY] For production deployments where the API structure should not be publicly discoverable, set both
docs.publicandopenapi.publictofalseinkirak.json.
Writing Well-Documented Custom Routes
Section titled “Writing Well-Documented Custom Routes”Custom FastAPI routes mounted in Kirak automatically populate into /docs and /openapi.json:
@app.get("/reports/monthly", summary="Monthly sales breakdown", tags=["Reports"])async def monthly_report(month: str): """ Generate aggregate sales figures per product category for the given month.
- **month**: Format YYYY-MM """ ...summary: Brief one-line description displayed in API tables.- Docstring: Detailed documentation displayed in the route description block.
tags: Groups the endpoint under the corresponding category heading.include_in_schema=False: Completely hides internal or debug endpoints from both documentation endpoints.