> For the complete documentation index, see [llms.txt](https://api-docs.hengelending.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.hengelending.com/api/quickstart.md). Agents can also search and read this documentation through its [MCP server](https://api-docs.hengelending.com/~gitbook/mcp).

# Quickstart

This page takes you from credentials to a started loan application in three calls. The examples use UAT, where you should build; for production, change the base URL and use production credentials.

## Before you start

* **A client id and client secret.** A company admin creates them in Henge under **Company Profile**, **API credentials**, separately in UAT and in production. Give the credential an **acting user**: loans you create are that user's, so pick the loan officer the integration works for. See [API credentials](https://api-docs.hengelending.com/api/guides/api-credentials).
* **The base URL.** UAT is `https://uat-api.hengelending.com/partner`. See [Environments](https://api-docs.hengelending.com/environments).

The examples use `curl` and this shell variable:

```bash
BASE=https://uat-api.hengelending.com/partner
```

Use email addresses you control for test borrowers: creating a loan can email the borrowers and the loan officer, in UAT too.

## Step 1: Get an access token

```bash
curl -X POST "$BASE/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{ "client_id": "<your client id>", "client_secret": "<your client secret>" }'
```

Response:

```json
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.example.signature",
  "scope": "read:loan-applications create:loan-applications update:loan-applications read:pricing",
  "expires_in": 86400,
  "token_type": "Bearer"
}
```

Send the token on every other call:

```http
Authorization: Bearer <access_token>
```

The examples below keep it in a shell variable: `TOKEN=<access_token>`.

* `scope` lists what this credential may call. Each endpoint in the API reference names the scope it needs.
* `expires_in` is the token's lifetime in seconds. Read it from the response; do not hard-code a number.
* Cache the token and reuse it until shortly before it expires, then request a new one. Do not request a token per call: the token endpoint is throttled.
* If a call returns `401`, request one new token and retry the call once. If it fails again, check the credential: it may have been rotated or revoked.

A wrong client id or secret returns `401` with `{ "error": "invalid_client", "error_description": "Client authentication failed." }`. See [Errors](https://api-docs.hengelending.com/api/guides/errors).

## Step 2: Create the loan application

You don't need to create a client first. Name the borrowers on the loan, or point it at a client you already have.

### Option A: name the borrowers

```bash
curl -X POST "$BASE/loan-applications" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "borrowers": [
      { "firstName": "Alex", "lastName": "Sample", "email": "alex.sample@example.com", "phone": "555-010-0142" },
      { "firstName": "Jordan", "lastName": "Sample", "email": "jordan.sample@example.com" }
    ],
    "propertyAddress": {
      "addressLine1": "123 Example Street",
      "city": "Miami",
      "state": "FL",
      "zipCode": "33135"
    }
  }'
```

* Each borrower needs `firstName`, `lastName` and `email`. `phone` is optional.
* Henge reuses a client it already holds for that email, or creates one.
* The first borrower is the primary borrower. Add entries for co-borrowers.
* A borrower entry can carry a `clientId` instead, to use a client you already have.

### Option B: use an existing client

```bash
curl -X POST "$BASE/loan-applications" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "a1d4c6e8-2b3f-4e5a-8c7d-9e0f1a2b3c4d",
    "propertyAddress": {
      "addressLine1": "123 Example Street",
      "city": "Miami",
      "state": "FL",
      "zipCode": "33135"
    }
  }'
```

Get the client id from `POST /clients` or `GET /clients`. This works for every account, with or without the borrower portal. `404 Not Found` means the client does not exist or belongs to another company.

### Either way

* `propertyAddress` is required, and `state` is the two-letter code.
* Send `clientId` or `borrowers`. With neither, the call returns `400 Bad Request`.
* **The loan officer** is your credential's acting user. The request also has a `userId` field, but it is honoured only on a credential Henge has set up as an administrator credential. A credential created under **Company Profile** is never one, so `userId` is ignored and the loan goes to the acting user.
* `403 Forbidden` means the credential lacks the `create:loan-applications` scope.

Response:

```json
{
  "warnings": [],
  "id": "3f2b8c1e-6d4a-4b7e-9a15-0c2d7e4f8a31",
  "type": "Loan",
  "createdTimestamp": "2026-11-20T14:30:00Z",
  "updatedTimestamp": "2026-11-20T14:30:00Z"
}
```

`id` is the **loan application id**. Use it in every call about this loan. `warnings` names anything the create adjusted and still accepted, for example a borrower whose email matched a client the loan officer already had, so the loan uses that client. It is empty when there is nothing to report.

## Step 3: Start the application

```bash
curl -X POST "$BASE/loan-applications/3f2b8c1e-6d4a-4b7e-9a15-0c2d7e4f8a31/start" \
  -H "Authorization: Bearer $TOKEN"
```

Response:

```json
{
  "loanApplicationId": "3f2b8c1e-6d4a-4b7e-9a15-0c2d7e4f8a31",
  "started": true,
  "message": "The loan application was started."
}
```

Starting stores the application form and creates its section sign-off tasks, so the application can be filled in and each section signed off. Starting a loan that is already started changes nothing and returns `"started": false`.

## Next steps

* **Invite the borrower.** If your account uses the borrower portal, send the invitation with `POST /clients/{clientId}/email/invitation`.
* **Submit.** When the application is complete and its sections are signed off, submit it with `POST /loan-applications/{id}/submit`. See [Loan lifecycle](https://api-docs.hengelending.com/api/guides/loan-lifecycle) for what each state allows.
* **Price.** Search products and rates with `POST /pricing/search`. On a broker (TPO) loan, register a program, floating or with a lock request, with `POST /loan-applications/{id}/registration`.
* **Hear about changes.** Set your webhook URL with `PUT /webhook` and subscribe with `POST /webhook/subscriptions`. A webhook is sent once and some changes send none, so also poll. See [Limits and reliability](https://api-docs.hengelending.com/api/guides/limits-and-reliability#webhooks).
* **Look things up.** [Identifiers](https://api-docs.hengelending.com/api/guides/identifiers) explains the loan id, the LOS loan id and the loan number. The [API reference](https://api-docs.hengelending.com/api) lists every endpoint and the scope it needs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://api-docs.hengelending.com/api/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
