Schema Overview
Data Schemas
Section titled âData SchemasâThe Quickli Public API uses comprehensive, validated schemas for all requests and responses. All schemas are defined using Zod and automatically generate TypeScript types and OpenAPI documentation.
Available Schemas
Section titled âAvailable SchemasâCore Schemas
Section titled âCore Schemasâ- Scenario Schema - Complete mortgage scenario structure including households, income, securities, loans, liabilities, and expenses
- Servicing Result Schema - Detailed servicing calculation results including borrowing capacity, validations, and rate breakdowns
- Product Schema - Lender product information with rate tables and product features
- Policy Schema - Lending policy documents with triggers and content
Schema Validation
Section titled âSchema ValidationâAll API requests are validated against Zod schemas before processing. If validation fails, youâll receive a 422 Validation Error with detailed information about what went wrong.
Example Validation Error
Section titled âExample Validation Errorâ{ "error": { "code": "VALIDATION_ERROR", "message": "Validation failed", "details": { "issues": [ { "path": ["scenario", "households", 0, "postcode"], "message": "Expected number, received string" } ] }, "timestamp": "2025-11-03T10:30:00.000Z" }}Field Conventions
Section titled âField ConventionsâRequired vs Optional
Section titled âRequired vs Optionalâ- Required fields: Must be provided in every request
- Optional fields: Can be omitted; sensible defaults will be applied
Fields marked as optional in the schema will have TypeScript type T | undefined.
Data Types
Section titled âData Typesâ| Type | Description | Example |
|---|---|---|
string | Text value | "hello" |
number | Numeric value (integer or float) | 123, 45.67 |
boolean | True or false | true, false |
array | List of values | [1, 2, 3] |
object | Nested structure | { "key": "value" } |
enum | One of a fixed set of values | "owner_occupied", "investment" |
union | One of multiple types | string | number |
ObjectIds
Section titled âObjectIdsâMongoDB ObjectIds are represented as 24-character hexadecimal strings:
"507f1f77bcf86cd799439011"Valid format: Exactly 24 characters, hexadecimal (0-9, a-f)
Dates and Timestamps
Section titled âDates and TimestampsâAll dates and timestamps use ISO 8601 format:
"2025-11-03T10:30:00.000Z"Using Schemas in Your Code
Section titled âUsing Schemas in Your CodeâTypeScript
Section titled âTypeScriptâThe API provides TypeScript types that match the Zod schemas:
import type { SaveableScenario, ServicingResult, LenderProduct, Policy} from '@quickli/validation';
// Type-safe scenario creationconst scenario: SaveableScenario = { households: [{ id: 'household-1', status: 'single', num_adults: 1, num_dependants: 0, postcode: 2000, shared_with_households: [] }], income: [], securities: [], home_loans: [], liabilities: [], living_expenses: [], // ... other fields};JavaScript
Section titled âJavaScriptâFor plain JavaScript, follow the schema structure:
const scenario = { households: [{ id: 'household-1', status: 'single', num_adults: 1, num_dependants: 0, postcode: 2000, shared_with_households: [] }], income: [], securities: [], // ... other fields};from typing import TypedDict, List, Optional
class Household(TypedDict): id: str status: str # 'single' | 'couple' | ... num_adults: int num_dependants: int postcode: int shared_with_households: List[str]
class Scenario(TypedDict): households: List[Household] income: List[dict] securities: List[dict] # ... other fieldsSchema Defaults
Section titled âSchema DefaultsâMany fields have sensible defaults that are applied when not provided:
Scenario Defaults
Section titled âScenario Defaultsâ- Empty arrays for all list fields (
households,income,securities, etc.) - Default configuration objects for
additional_info - Standard calculation settings
Example: Minimal Scenario
Section titled âExample: Minimal ScenarioâThis minimal scenario will have defaults applied:
{ "scenario": {}}Becomes:
{ "scenario": { "households": [], "income": [], "securities": [], "home_loans": [], "liabilities": [], "living_expenses": [], "rental_income": [], "self_employed_income": [], "home_loan_security_links": [], "additional_info": { "useDependantAges": false // ... other defaults } }}Enum Values
Section titled âEnum ValuesâMany fields use enums to restrict values to a specific set. Here are the most common:
Household Status
Section titled âHousehold Statusâ'single' | 'couple' | 'de_facto' | 'divorced' | 'separated' | 'widowed'Property Transaction Type
Section titled âProperty Transaction Typeâ'purchasing' | 'refinancing' | 'owned'Property Type
Section titled âProperty Typeâ'house' | 'unit' | 'townhouse' | 'apartment' | 'land' | 'rural' | 'commercial' | 'industrial'Property Purpose
Section titled âProperty Purposeâ'owner_occupied' | 'investment'Loan Type
Section titled âLoan Typeâ'owner_occupied' | 'investment'Product Type
Section titled âProduct Typeâ'variable_package' | 'variable_basic' | 'fixed' | 'line_of_credit' | 'construction'Existing or Proposed
Section titled âExisting or Proposedâ'existing' | 'proposed'Liability Type
Section titled âLiability Typeâ'credit_card' | 'personal_loan' | 'car_loan' | 'student_loan' | 'other_liability'Validation Rules
Section titled âValidation RulesâCommon Validations
Section titled âCommon Validationsâ- Positive numbers: Values like loan amounts must be
> 0 - Percentages: Values like LVR must be
0-100 - Postal codes: Australian postal codes (1000-9999)
- Email format: Must be valid email address
- ObjectId format: Must be 24-character hex string
- Array minimums: Some arrays require at least 1 item
Example: Scenario Validation
Section titled âExample: Scenario Validationâ{ households: z.array(HouseholdSchema).min(0), // 0 or more households income: z.array(IncomeSchema).min(0), // 0 or more income sources securities: z.array(SecuritySchema).min(0), // 0 or more properties // ... more fields}OpenAPI Schema
Section titled âOpenAPI SchemaâThe complete OpenAPI 3.0 schema is available at:
https://api.quickli.com/api/v1/openapi.jsonYou can use this to:
- Generate client libraries in any language
- Validate requests/responses in your tests
- Import into API development tools (Postman, Insomnia, etc.)
Next Steps
Section titled âNext Stepsâ- Browse scenario schema - Learn about the mortgage scenario structure
- Review servicing results - Understand calculation outputs
- Explore endpoints - See how schemas are used in API calls
Last updated: 2025-11-03