Attestra

Documentation

Run the API locally, upload policies, process a questionnaire, and export answers.

Quickstart

git clone https://github.com/Nikhil-creat/questionnaire-ai.git
cd questionnaire-ai/apps/api
pip install -r requirements.txt
uvicorn main:app --reload     # http://localhost:8000

Example

TOKEN=$(curl -s -X POST localhost:8000/api/auth/register -H 'Content-Type: application/json'   -d '{"email":"you@company.com","password":"a-long-password","org":"Acme"}' | python -c "import sys,json;print(json.load(sys.stdin)['token'])")
curl -H "Authorization: Bearer $TOKEN" -F file=@policy.md localhost:8000/api/documents
curl -H "Authorization: Bearer $TOKEN" -F file=@questionnaire.xlsx localhost:8000/api/questionnaires

API reference

Method and pathPurpose
POST /api/auth/register and /loginCreate an account or log in; returns a bearer token
POST /api/documentsUpload a policy (pdf, docx, txt, md)
POST /api/questionnairesUpload XLSX; returns drafted, cited answers
GET /api/questionnaires/{id}Fetch a run
POST /api/questionnaires/{id}/items/{n}/approveApprove (optionally edit) an answer; adds it to the library
GET /api/questionnaires/{id}/exportDownload the answered XLSX
GET /api/questionnaires/{id}/gapsWhy answers were escalated
GET /api/stale-documentsPolicies past their review date
GET /api/auditAudit log
GET /healthHealth check

Configuration

VariableMeaning
ANTHROPIC_API_KEYEnables LLM drafting. Without it, offline extractive mode is used.
ANTHROPIC_MODELModel name for drafting
JWT_SECRETRequired in production: 32+ random characters for signing tokens
DATABASE_URLPostgres connection string. Empty means in-memory dev mode
ALLOW_REGISTERSet to 0 to close open registration
RATE_LIMITMax /api requests per minute per client (default 60)

All data is scoped to the tenant inside your login token. Clients cannot choose a tenant.

Limits

Without DATABASE_URL data lives in memory and is lost on restart. Postgres mode is built but should be independently tested before real customer data. See the Security page.