← All examples

Loan Pre-Qualification

Finance

Determine if an applicant meets the minimum credit, income, and debt-to-income requirements.

Policy rule

A **applicant** qualifies for standard_loan
  if the __credit_score__ of the **applicant** is greater than or equal to 650
  and the __annual_income__ of the **applicant** is greater than 30000
  and the __debt_to_income_ratio__ of the **applicant** is less than 0.43
  and the __employment_status__ of the **applicant** is in ["employed", "self-employed"].

Input schema

{
"properties": {
"applicant": {
"properties": {
"credit_score": {
"type": "number"
},
"annual_income": {
"type": "number"
},
"debt_to_income_ratio": {
"type": "number"
},
"employment_status": {
"type": "string"
}
},
"required": [
"credit_score",
"annual_income",
"debt_to_income_ratio",
"employment_status"
],
"type": "object"
}
},
"required": [
"applicant"
],
"title": "Applicant Model",
"type": "object"
}

Test cases

Qualified applicant

Expect pass
{
"applicant": {
"credit_score": 720,
"annual_income": 65000,
"debt_to_income_ratio": 0.28,
"employment_status": "employed"
}
}

Low credit score

Expect fail
{
"applicant": {
"credit_score": 580,
"annual_income": 65000,
"debt_to_income_ratio": 0.28,
"employment_status": "employed"
}
}

Integration

Execute this policy from your app using one of the official SDKs.

import { ExecutionClient } from "@policies2/sdk";

const client = new ExecutionClient({
	apiKey: process.env.POLICY_API_KEY!,
	transport: { kind: "rest", baseUrl: "https://api.policy2.net" },
});

const result = await client.executePolicy({
	id: "your-policy-id", // replace with your published policy ID
	reference: "base",
	data: {
		"applicant": {
			"credit_score": 720,
			"annual_income": 65000,
			"debt_to_income_ratio": 0.28,
			"employment_status": "employed"
		}
	},
});

if (result.result) {
	console.log("policy matched");
} else {
	console.log("policy did not match");
}

Ready to try this policy?

Open in editor