Use cases

Six typical broker tasks, from one payslip to a full financing case.

Each task on this page is one POST /v1/analyses request. Only the spec changes between tasks. The spec is the part of the request that says what to look for. The tasks follow a mortgage broker's work, from one payslip to a complete financing case.

Before you start

Install the SDK and set up your key as in the quickstart. Every example then follows the same steps:

  1. Upload the documents with POST /v1/files.
  2. Send a request to POST /v1/analyses with the IDs of the uploads in files, and wait for the result as in the quickstart.
  3. Print the part of the result the task is about.

Where a case has many files, the cURL example shows one upload. Repeat it for every file. Then put the IDs from the upload responses into files, in place of the sample IDs.

The SDKs send a new Idempotency-Key with every request. In production, store the key and send it again when you retry. A retry after a lost response then returns the first analysis instead of creating a second one. Use case 6 passes its own key, and Analyses explains how retries work.

With a test key, every example runs for free and returns sample values instead of what the documents say (Test mode). The results on this page show what a live key returns.

1. Read the income from a payslip

An applicant sends one payslip. You need the net and gross salary, the employer and the start date. The request asks for four builtin fields and nothing else.

// Reads the income facts from one payslip.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const payslip = await client.createFile("payslip.pdf");

// Ask for four builtin fields, each under its own key.
const created = await client.createAnalysis(
  {
    files: [payslip.id],
    language: "en",
    spec: {
      fields: {
        net_salary: { builtin: "net_salary" },
        gross_salary: { builtin: "gross_salary" },
        employer: { builtin: "employer" },
        employed_since: { builtin: "employed_since" },
      },
    },
  },
  { wait: 30 },
);
const analysis = await client.waitForAnalysis(created.id);

// Each field carries its status, its typed value and the citations it was read from.
if (analysis.status === "succeeded") {
  console.log(analysis.result.fields);
}

The keys under fields are your own names for the results. Here they match the builtin keys. Any other name works too, such as net_income in the quickstart. The complete response:

{
  "id": "ana_income",
  "mode": "live",
  "status": "succeeded",
  "catalog_version": "sha256:235de54bf23a933aa613918eecfcd9e08da12d48ffdb98f80f77bda29cb5590e",
  "reference_date": "2026-10-09",
  "engine_revision": "api-2026.10.1",
  "expires_at": "2026-11-08T10:00:00Z",
  "result": {
    "files": [
      {
        "file_id": "file_payslip",
        "pages": 1,
        "readability": { "status": "succeeded", "readable": true }
      }
    ],
    "documents": [
      {
        "file_id": "file_payslip",
        "pages": { "start": 1, "end": 1 },
        "period": { "start": "2026-09", "end": "2026-09" },
        "classification": "matched",
        "document_type": { "builtin": "gehaltsabrechnung" },
        "confidence": 0.97,
        "alternatives": [],
        "requirements": {}
      }
    ],
    "fields": {
      "net_salary": {
        "type": "money",
        "status": "found",
        "value": 3250,
        "currency": "EUR",
        "confidence": 0.95,
        "citations": [
          {
            "file_id": "file_payslip",
            "quote": "Netto 3.250,00",
            "pages": [
              {
                "page": 1,
                "polygons": [
                  [
                    { "x": 0.612, "y": 0.418 },
                    { "x": 0.731, "y": 0.418 },
                    { "x": 0.731, "y": 0.436 },
                    { "x": 0.612, "y": 0.436 }
                  ]
                ],
                "bounding_box": { "left": 0.612, "top": 0.418, "width": 0.119, "height": 0.018 }
              }
            ]
          }
        ]
      },
      "gross_salary": {
        "type": "money",
        "status": "found",
        "value": 4980,
        "currency": "EUR",
        "confidence": 0.95
      },
      "employer": {
        "type": "string",
        "status": "found",
        "value": "Muster GmbH",
        "confidence": 0.99
      },
      "employed_since": {
        "type": "date",
        "status": "found",
        "value": "2019-04-01",
        "confidence": 0.9
      }
    },
    "checks": {},
    "collection": {}
  },
  "usage": { "pages": 1, "fields": 4, "checks": 0 }
}

How to read a field:

  • status is found when the document states the value. The value is then in value.
  • status is not_found when the document does not state it. value is then null, never a guessed number.
  • An amount of money is a number in value. The currency is in a separate currency field.
  • citations lists the passages the value was read from. Citations shows how to highlight them on the page.

The catalog lists every builtin field you can request.

2. Screen bank statements for red flags

You want to know whether a bank statement shows gambling, debt collection, returned direct debits or a growing overdraft. You also want to know whether the salary arrives as the payslip states. Builtin checks answer these questions. The request asks for no fields. AirCredit still extracts the values the checks need, such as the net salary, but does not return them.

// Screens a bank statement with builtin checks.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const statement = await client.createFile("bank-statement.pdf");
const payslip = await client.createFile("payslip.pdf");

// Five builtin checks, each under your own key.
const created = await client.createAnalysis(
  {
    files: [statement.id, payslip.id],
    language: "en",
    spec: {
      checks: {
        gambling: { builtin: "bank.gambling_trigger_debits" },
        debt_collection: { builtin: "bank.collection_bailiff_debits" },
        returned_debits: { builtin: "bank.chargebacks_direct_debit_returns" },
        overdraft: { builtin: "bank.overdraft_balance_trend" },
        salary_credited: { builtin: "bank.salary_matches_payslip" },
      },
    },
  },
  { wait: 30 },
);
const analysis = await client.waitForAnalysis(created.id);

// A succeeded check has a verdict. A failed one says why it could not be evaluated.
if (analysis.status === "succeeded") {
  for (const [key, check] of Object.entries(analysis.result.checks)) {
    console.log(
      key,
      check.status === "succeeded" ? check.verdict : check.error.message,
    );
  }
}

The result contains one entry per check under result.checks:

{
  "gambling": {
    "status": "succeeded",
    "verdict": "fulfilled",
    "confidence": 0.93,
    "citations": []
  },
  "debt_collection": {
    "status": "succeeded",
    "verdict": "fulfilled",
    "confidence": 0.91,
    "citations": []
  },
  "returned_debits": {
    "status": "succeeded",
    "verdict": "critical",
    "confidence": 0.88,
    "citations": [
      {
        "file_id": "file_statement",
        "quote": "Rücklastschrift Stadtwerke 84,20",
        "pages": [{ "page": 2, "polygons": [] }]
      }
    ]
  },
  "overdraft": { "status": "succeeded", "verdict": "open", "confidence": 0.71, "citations": [] },
  "salary_credited": {
    "status": "succeeded",
    "verdict": "fulfilled",
    "confidence": 0.9,
    "citations": [
      {
        "file_id": "file_statement",
        "quote": "Gehalt Muster GmbH 3.250,00",
        "pages": [{ "page": 1, "polygons": [] }]
      },
      {
        "file_id": "file_payslip",
        "quote": "Netto 3.250,00",
        "pages": [{ "page": 1, "polygons": [] }]
      }
    ]
  }
}
verdictMeaning
fulfilledThe finding is favorable.
criticalThe finding is adverse.
openThe question is unresolved, or a person needs to confirm the answer.
not_applicableThe question does not apply to these documents.

Show critical and open checks to a person, together with their citations.

A check can also be failed inside an analysis that succeeded. It then has an error instead of a verdict. Fields and checks describes how to handle it.

3. Check that a case is complete

Before you send a case to a lender, you want to know whether it contains payslips for the last three months, a bank statement and an ID document. A collection requirement answers this. It states what the files must contain together, and counts documents and months across all of them. default_requirements also applies the catalog's rules to each single document.

The applicant has sent two payslips, a bank statement and an ID card. The example uploads all four:

// Checks that a document set is complete, both per document and as a whole.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const files = [];
for (const path of [
  "payslip-2026-08.pdf",
  "payslip-2026-09.pdf",
  "bank-statement.pdf",
  "id-card.jpg",
]) {
  files.push((await client.createFile(path)).id);
}

// Payslips for the last three months, one bank statement and one ID document.
const created = await client.createAnalysis(
  {
    files,
    language: "en",
    reference_date: "2026-10-09",
    spec: {
      documents: { default_requirements: true },
      collection_requirements: {
        payslips: {
          document_type: { builtin: "gehaltsabrechnung" },
          periods: { count: 3, unit: "month", ending: "previous_month" },
        },
        statement: { document_type: { builtin: "kontoauszug" }, count: 1 },
        identity: { document_type: { builtin: "ausweis" }, count: 1 },
      },
    },
  },
  { wait: 30 },
);
const analysis = await client.waitForAnalysis(created.id);

// Each requirement says whether it is met, and which months are missing.
if (analysis.status === "succeeded") {
  for (const [key, requirement] of Object.entries(analysis.result.collection)) {
    console.log(key, requirement.verdict, requirement.missing_periods);
  }
}

The request sets reference_date to 9 October 2026. AirCredit measures periods and document ages from this date, so the payslips must cover July, August and September. The July payslip is missing, as result.collection shows:

{
  "payslips": {
    "status": "succeeded",
    "verdict": "not_met",
    "present_periods": ["2026-08", "2026-09"],
    "missing_periods": ["2026-07"],
    "documents": [
      { "file_id": "file_payslip_aug", "pages": { "start": 1, "end": 1 } },
      { "file_id": "file_payslip_sep", "pages": { "start": 1, "end": 1 } }
    ]
  },
  "statement": {
    "status": "succeeded",
    "verdict": "met",
    "documents": [{ "file_id": "file_statement", "pages": { "start": 1, "end": 4 } }]
  },
  "identity": {
    "status": "succeeded",
    "verdict": "met",
    "documents": [{ "file_id": "file_id_card", "pages": { "start": 1, "end": 1 } }]
  }
}

Ask the applicant for the payslip of the month in missing_periods, then run the analysis again with the complete file list.

A collection requirement expects the documents of one person or account. Run one analysis per person, for example one for each borrower's payslips. Documents of several people give unknown.

result.documents gives the type of each file. Per-document requirements currently return not_evaluated, as Analyses explains.

4. Apply your lender's own rules

Your lender has rules that the catalog does not cover. In this example, the contract must be permanent, the probation period must be over, and the employer must not be a temporary staffing agency. Write such rules in plain language as custom fields and checks. This request combines them with the builtin field employer.

// Checks an employment with custom fields and custom checks.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const contract = await client.createFile("employment-contract.pdf");
const payslip = await client.createFile("payslip.pdf");

// Mix a builtin field with three of your own, then ask two questions about them.
const created = await client.createAnalysis(
  {
    files: [contract.id, payslip.id],
    language: "en",
    reference_date: "2026-10-09",
    spec: {
      fields: {
        employer: { builtin: "employer" },
        contract_kind: {
          type: "enum",
          enum_values: ["permanent", "fixed_term", "temporary_agency"],
          instruction:
            "The kind of employment: permanent (no end date), fixed_term (ends on a set date) or temporary_agency (agency work or temporary staffing).",
        },
        probation_end: {
          type: "date",
          instruction: "The date the probation period ends or ended.",
        },
        notice_period: {
          type: "string",
          instruction: "The notice period the employer must give, as written.",
        },
      },
      checks: {
        permanent_after_probation: {
          instruction:
            "The employment is permanent and the probation period has ended by the reference date.",
          uses: ["contract_kind", "probation_end"],
        },
        not_agency: {
          instruction: "The employer is not a temporary staffing agency.",
          uses: ["employer", "contract_kind"],
        },
      },
    },
  },
  { wait: 30 },
);
const analysis = await client.waitForAnalysis(created.id);

if (analysis.status === "succeeded") {
  console.log(analysis.result.fields, analysis.result.checks);
}
  • A custom field needs an instruction and a type. An enum field also lists its enum_values.
  • A custom check lists the fields it relies on under uses. These are your own names or builtin keys.
  • The first check refers to the reference date. The request sets it to 9 October 2026.

The answer, in result.fields and result.checks:

{
  "fields": {
    "employer": { "type": "string", "status": "found", "value": "Muster GmbH", "confidence": 0.99 },
    "contract_kind": {
      "type": "enum",
      "status": "found",
      "value": "permanent",
      "confidence": 0.94
    },
    "probation_end": {
      "type": "date",
      "status": "found",
      "value": "2019-09-30",
      "confidence": 0.9
    },
    "notice_period": { "type": "string", "status": "not_found", "value": null }
  },
  "checks": {
    "permanent_after_probation": {
      "status": "succeeded",
      "verdict": "fulfilled",
      "confidence": 0.9,
      "citations": []
    },
    "not_agency": {
      "status": "succeeded",
      "verdict": "fulfilled",
      "confidence": 0.95,
      "citations": []
    }
  }
}

The contract states no notice period, so notice_period is not_found.

Fields and checks lists every custom type and the limits.

5. Read a couple's household

A couple applies together. Their joint self-disclosure lists their loans, their children and their savings. A car loan contract adds the details of one loan. Builtin household fields return this data as structured values. A structured value is an object, or a list of objects, with fixed subfields.

// Reads a household's structured facts from a self-disclosure and a loan contract.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const disclosure = await client.createFile("self-disclosure.pdf");
const carLoan = await client.createFile("car-loan-contract.pdf");

// Structured builtin fields return lists of records, such as one entry per loan.
const created = await client.createAnalysis(
  {
    files: [disclosure.id, carLoan.id],
    language: "en",
    external_id: "case-1042",
    spec: {
      fields: {
        existing_loans: { builtin: "existing_loans" },
        monthly_loan_instalments: { builtin: "monthly_loan_instalments" },
        children: { builtin: "children" },
        household_assets: { builtin: "household_assets" },
        other_incomes: { builtin: "other_incomes" },
      },
      checks: {
        loan_terms_plausible: {
          builtin: "selfdecl.terms_installments_plausible",
        },
      },
    },
  },
  { wait: 30 },
);
const analysis = await client.waitForAnalysis(created.id);

// Each loan is a typed record. A part the documents do not state is null.
if (analysis.status === "succeeded") {
  const loans = analysis.result.fields.existing_loans;
  if (loans?.type === "existing_loans") {
    for (const loan of loans.value ?? []) {
      console.log(loan.lender, loan.remaining_debt);
    }
  }
  console.log(analysis.result.checks);
}

external_id is your own case reference. AirCredit returns it in the analysis and in its webhook event. The answer, in result.fields and result.checks:

{
  "fields": {
    "existing_loans": {
      "type": "existing_loans",
      "status": "found",
      "value": [
        {
          "lender": "Sparkasse Köln",
          "loan_type": "KFZ",
          "remaining_debt": { "amount": 12500.5, "currency": "EUR" },
          "monthly_instalment": { "amount": 289, "currency": "EUR" },
          "interest_rate": 3.9,
          "fixed_interest_until": null,
          "maturity_date": "2029-06-30",
          "remaining_debt_at_payoff": null,
          "pay_off": false
        },
        {
          "lender": "Muster Bank AG",
          "loan_type": "PRIVATKREDIT",
          "remaining_debt": { "amount": 4200, "currency": "EUR" },
          "monthly_instalment": { "amount": 250, "currency": "EUR" },
          "interest_rate": null,
          "fixed_interest_until": null,
          "maturity_date": null,
          "remaining_debt_at_payoff": null,
          "pay_off": true
        }
      ],
      "confidence": 0.86
    },
    "monthly_loan_instalments": {
      "type": "money",
      "status": "found",
      "value": 539,
      "currency": "EUR",
      "confidence": 0.9
    },
    "children": {
      "type": "children",
      "status": "found",
      "value": [
        {
          "first_name": "Mia",
          "birth_date": "2018-05-14",
          "receives_child_benefit": true,
          "child_support": null
        },
        {
          "first_name": "Leon",
          "birth_date": "2021-11-02",
          "receives_child_benefit": true,
          "child_support": null
        }
      ],
      "confidence": 0.92
    },
    "household_assets": {
      "type": "household_assets",
      "status": "found",
      "value": [
        {
          "asset_type": "BANK_UND_SPARGUTHABEN",
          "amount": { "amount": 24000, "currency": "EUR" },
          "description": "Tagesgeld"
        },
        {
          "asset_type": "BAUSPARVERTRAG",
          "amount": { "amount": 8500, "currency": "EUR" },
          "description": "Bausparvertrag"
        }
      ],
      "confidence": 0.88
    },
    "other_incomes": { "type": "other_incomes", "status": "not_found", "value": null }
  },
  "checks": {
    "loan_terms_plausible": {
      "status": "succeeded",
      "verdict": "fulfilled",
      "confidence": 0.84,
      "citations": []
    }
  }
}

How to read a structured value:

  • Every subfield is always present. It is null when the documents do not state it.
  • A list is never empty. A household without other income gives not_found, not [].
  • An amount inside a structured value is an object with amount and currency.
  • Subfields with a fixed set of values, such as loan_type, use the values listed in the API reference.

Household fields describe the couple together. Each field holds only one value. Read each person's salary in a separate analysis of that person's payslips, as in use case 1. Fields and checks lists every structured type and its subfields.

6. Review a full financing case

The case is complete, and you want a full review of it. A builtin template contains dozens of fields and checks for one financing purpose, so you do not define them yourself. Choose the template for the financing purpose:

PurposeTemplate key
Buying a propertydefault_personal_property_purchase
Buying a new builddefault_personal_new_build_purchase
Refinancingdefault_personal_follow_up_financing
Modernizationdefault_personal_modernization

The catalog lists more templates, for example for apartments or multi-family houses. A large case takes longer than a request should stay open. This request therefore does not wait, and a webhook reports when the review is done. It sends its own Idempotency-Key, derived from the case, so that a retry after a lost response cannot start a second review.

// Reviews a complete financing case with a builtin template and does not wait for it.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const files = [];
for (const path of [
  "payslip-2026-07.pdf",
  "payslip-2026-08.pdf",
  "payslip-2026-09.pdf",
  "bank-statement.pdf",
  "id-card.jpg",
  "purchase-contract.pdf",
  "expose.pdf",
]) {
  files.push((await client.createFile(path)).id);
}

// A template holds the fields and checks of a whole case. A webhook reports when it is done.
// Pass your own key so that a retry after a lost response cannot start a second review.
const analysis = await client.createAnalysis(
  {
    files,
    language: "en",
    reference_date: "2026-10-09",
    external_id: "case-1042",
    spec: { template: { key: "default_personal_property_purchase" } },
  },
  { idempotencyKey: "case-1042-review-1" },
);

// Store the ID with your case.
console.log(`analysis ${analysis.id} is ${analysis.status}`);

The API answers 202 with the queued analysis. Store its ID with your case:

{
  "id": "ana_case1042",
  "mode": "live",
  "status": "queued",
  "external_id": "case-1042",
  "catalog_version": "sha256:235de54bf23a933aa613918eecfcd9e08da12d48ffdb98f80f77bda29cb5590e",
  "reference_date": "2026-10-09",
  "expires_at": "2026-11-08T10:00:00Z"
}

When the analysis finishes, AirCredit sends an event to your webhook. The event names the analysis and your external_id, but carries no result:

{
  "id": "evt_case1042",
  "type": "analysis.succeeded",
  "api_version": "v1",
  "mode": "live",
  "timestamp": "2026-10-09T10:04:12Z",
  "data": { "analysis_id": "ana_case1042", "external_id": "case-1042", "status": "succeeded" }
}

Verify the signature as Webhooks shows, then read the result. This example lists the fields the template returned and the verdict of every check:

// Reads a finished case review once the webhook reported it.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();

// Use the analysis ID the webhook event names.
const analysis = await client.getAnalysis("ana_case1042");
if (analysis.status !== "succeeded") {
  throw new Error(`the review ended as ${analysis.status}`);
}

// List the fields the template returned and the verdict of every check.
console.log("fields:", Object.keys(analysis.result.fields));
for (const [key, check] of Object.entries(analysis.result.checks)) {
  if (check.status === "succeeded") console.log(key, check.verdict);
}

The catalog lists the fields and checks of each template:

// Looks up which fields and checks a builtin template holds.
import { Client } from "@aircredit/sdk/partner/v1";

const client = Client.fromEnv();
const catalog = await client.getCatalog();

// Each template maps your result keys to builtin fields and checks.
const template = catalog.templates.default_personal_property_purchase;
if (template) {
  console.log(template.title);
  console.log("fields:", Object.keys(template.fields));
  console.log("checks:", Object.keys(template.checks));
}

A request uses either a template or its own fields and checks, never both. To add your lender's rules from use case 4, run them as a second analysis with the same external_id.

When the applicant sends a corrected document, upload it and run the review again with the complete new file list. Classifications of unchanged files can be reused, as Analyses explains.

A live review is charged when you create it (Billing).

On this page