Skip to content

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.json into Postman, Insomnia, Bruno, or VS Code REST Client.


The /docs Markdown document provides complete context for an AI coding agent or API caller:

  1. Quick Reference: Base URLs, CRUD and GraphQL paths, authentication headers, active modules, and links to SDKs.
  2. Not Supported: Clear boundaries on features Kirak does not support (e.g. whole-table updates without filters, GraphQL introspection).
  3. Authentication: Exact token schemas, Bearer header requirements, refresh lifecycle, and session flows.
  4. Response Envelope: Success and error envelope specifications with stable machine error codes.
  5. CRUD Operations: Detailed endpoint tables per model, query filter syntax, pagination shapes, and model-specific request examples.
  6. Models: Full field dictionary with types, constraints (unique, searchable, read-only), access rules, and field-level permissions.
  7. GraphQL: Supported queries, relationship joins, aggregates, and multi-root atomic mutation specifications.
  8. Modules: Configured module endpoints, active provider instances, and body parameters.
  9. MCP Servers: Registered tools, schemas, and confirmation requirements.

[!NOTE] Models marked "internal": true are completely excluded from /docs and /openapi.json.


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.


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

Configure endpoint visibility in kirak.json:

{
"docs": {
"enabled": true,
"path": "/docs",
"public": true
},
"openapi": {
"enabled": true,
"public": true
}
}
  • docs.enabled: false – Disables the /docs route entirely (404 NOT_FOUND).
  • docs.public: false – Requires authentication to view /docs (401 MISSING_TOKEN for 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.public and openapi.public to false in kirak.json.


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.