Lease Flow: From Pre-Approved → Docs Signed
Use this playbook to complete a Koalafi lease application fully through the API — moving an application from preApproved to docsSigned
Prerequisites
Before running any commands:
Endpoints:
Sandbox: https://application-edge-service.sandbox.koalafi.com/query
Production: https://application-edge-service.koalafi.com/query
Headers (required on every request):
public-dealer-id: <your-public-dealer-id>
private-api-key: <your-private-api-key>
You’ll also need:
- A valid
applicationId(preApproved) - The associated
orderId
Step 1 – Update Order Items
Replaces the customer’s cart with valid items.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "updateOrderItems",
"query": "mutation updateOrderItems($input: UpdateOrderItemsInput!) { updateOrderItems(input: $input) { order { id } orderErrors { __typename message } } }",
"variables": {
"input": {
"orderId": "<order-id>",
"items": [
{
"sku": "item01",
"price": "450.00",
"quantity": 1,
"isLeaseable": true,
"category": "merchandise",
"displayName": "Test Item"
}
],
"shippingAmnt": "0.00"
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": {
"updateOrderItems": {
"order": { "id": "b7e4d87c-1234-4b89-b999-56aa0b9e22f0" },
"orderErrors": []
}
}
}Step 2 – Update Employment
Adds employment information to the lease application.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "updateEmployment",
"query": "mutation updateEmployment($input: UpdateEmploymentInput!) { updateEmployment(input: $input) { updateEmploymentErrors { __typename message } } }",
"variables": {
"input": {
"applicationId": "<lease-app-id>",
"paymentFrequency": "monthly",
"lastPayDate": "2025-01-01"
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": { "updateEmployment": { "updateEmploymentErrors": [] } }
}Step 3 – Update Bank Account
Adds the customer’s primary bank account for payments.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "updateBankAccount",
"query": "mutation updateBankAccount($input: UpdateBankAccountInput!) { updateBankAccount(input: $input) { updateBankAccountErrors { __typename message } } }",
"variables": {
"input": {
"applicationId": "<lease-app-id>",
"bankAccount": {
"accountNumber": "0987654321",
"routingNumber": "011000036"
}
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": { "updateBankAccount": { "updateBankAccountErrors": [] } }
}Step 4 – Update Debit Info
Adds backup debit card information (the app moves to approved on success).
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "updateDebitInfo",
"query": "mutation updateDebitInfo($input: UpdateDebitInfoInput!) { updateDebitInfo(input: $input) { updateDebitInfoErrors { __typename message } } }",
"variables": {
"input": {
"debitDetails": {
"cardholderFirstName": "Wally",
"cardholderLastName": "Koala",
"cardNumber": "4111111111111111",
"expirationDate": "2027-05"
},
"applicationId": "<lease-app-id>"
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": { "updateDebitInfo": { "updateDebitInfoErrors": [] } }
}Step 5 – Generate Lease Contract
Creates the lease documents. The application moves to docsReady.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "generateLeaseContract",
"query": "mutation generateLeaseContract($input: GenerateLeaseContractInput!) { generateLeaseContract(input: $input) { generateContractErrors { __typename message } } }",
"variables": {
"input": {
"orderId": "<order-id>"
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": { "generateLeaseContract": { "generateContractErrors": [] } }
}Step 6 – Sign Lease Agreement
Digitally signs the lease contract. The lease moves to docsSigned.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "signLeaseAgreement",
"query": "mutation signLeaseAgreement($input: SignLeaseAgreementInput!) { signLeaseAgreement(input: $input) { signingErrors { __typename message } } }",
"variables": {
"input": {
"applicationId": "<lease-app-id>",
"isSigned": true
}
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": { "signLeaseAgreement": { "signingErrors": [] } }
}Step 7 – Verify Docs Signed
Confirm that the lease has reached docsSigned status.
$ curl -sS https://application-edge-service.sandbox.koalafi.com/query -H "public-dealer-id: <your-public-dealer-id>" -H "private-api-key: <your-private-api-key>" -H "Content-Type: application/json" -d '{
"operationName": "order",
"query": "query order($id: ID!) { order(id: $id) { id application { lease { id status } } } }",
"variables": {
"id": "<order-id>"
}
}'▶ Run Request
HTTP/1.1 200 OK
{
"data": {
"order": {
"id": "b7e4d87c-1234-4b89-b999-56aa0b9e22f0",
"application": { "lease": { "id": "142645", "status": "docsSigned" } }
}
}
}Summary
| Step | Mutation/Query | Resulting Status |
|---|---|---|
| 1 | updateOrderItems | Order cart updated |
| 2 | updateEmployment | Employment info saved |
| 3 | updateBankAccount | Bank info verified |
| 4 | updateDebitInfo | Moves to approved |
| 5 | generateLeaseContract | Moves to docsReady |
| 6 | signLeaseAgreement | Moves to docsSigned |
| 7 | order query | Confirms app status |
Updated 2 days ago
