Skip to Content
Helm

REST Endpoints

Endpoints exposed by the Hono adapter.

The Hono adapter exposes the default service endpoints:

MethodPathBodySuccessPurpose
GET/healthNone200Health check.
GET/definitionNone200Active model definition.
GET/questionsNone200Active questionnaire only.
POST/definitions/validateJSON definition200Validate a custom definition.
POST/evaluateJSON evaluation input200Evaluate one applicant.
POST/evaluate/batchJSON batch envelope200Evaluate a JSON batch.
POST/evaluate/batch/csvRaw CSV text200Evaluate a raw CSV batch and return JSON.

See the REST API guide for setup and example payloads.

The default maximum batch size is 100. Hosts can change it when creating the Hono service or route app.

Responses

GET /health

{
  "status": "ok"
}

GET /definition

Returns the active RiskProfileDefinition. See Definition Schema.

GET /questions

Returns definition.questions for the active model.

Request Bodies

POST /evaluate

{
  "applicantId": "APP-001",
  "answers": {
    "investmentHorizonYears": 10,
    "riskAttitude": "hold",
    "investmentObjective": "balanced_growth",
    "annualIncome": 95000,
    "dtiRatio": 22,
    "liquidityMonths": 4,
    "investmentExperience": "intermediate"
  }
}

POST /evaluate/batch

Body must be an object with an items array:

{
  "items": [
    {
      "applicantId": "APP-001",
      "answers": {
        "investmentHorizonYears": 10,
        "riskAttitude": "hold",
        "investmentObjective": "balanced_growth",
        "annualIncome": 95000,
        "dtiRatio": 22,
        "liquidityMonths": 4,
        "investmentExperience": "intermediate"
      }
    }
  ]
}

POST /evaluate/batch/csv

Body is plain CSV text. The header must use active definition question IDs. applicantId is treated as metadata when present.

applicantId,investmentHorizonYears,riskAttitude,investmentObjective,annualIncome,dtiRatio,liquidityMonths,investmentExperience
APP-001,10,hold,balanced_growth,95000,22,4,intermediate

POST /definitions/validate

Pass a full risk-profile definition JSON object. A valid response returns the parsed definition, including defaulted fields such as omitted question required flags or omitted overrides:

{
  "valid": true,
  "definition": {}
}

Invalid definitions return 422 with structured Zod validation details.

Error Envelope

All adapter errors use this shape:

{
  "error": {
    "code": "validation_error",
    "message": "Invalid evaluation input.",
    "details": {
      "formErrors": [],
      "fieldErrors": {}
    }
  }
}
CodeTypical statusMeaning
invalid_json400JSON body could not be parsed.
invalid_text400Text body could not be read.
validation_error400 or 422Request shape, definition, CSV, or batch limits failed validation.
evaluation_error500Runtime evaluation failed unexpectedly.

Validation details use Zod's flattened shape when the failure comes from schema validation:

{
  "formErrors": [],
  "fieldErrors": {
    "items": ["Too small: expected array to have >=1 items"]
  }
}

Status Codes

StatusUsed when
200Request succeeded. Batch responses may still include rejected items.
400Body parsing failed or CSV text could not be parsed.
422JSON shape, definition, evaluation input, empty CSV batch, or batch size validation failed.
500Evaluation raised an unexpected runtime error.

Last updated on

On this page