# Lease Compliance Checker API

## Overview

The Lease Compliance Checker API analyzes lease agreements and insurance policies to determine if the insurance coverage meets the lease requirements. It extracts key data from both documents and provides a detailed compliance comparison.

## Base URL

```
https://api.insurgrid.com/api
```

## Authentication

All API requests require an API key passed in the request header.

| Header      | Value        |
| ----------- | ------------ |
| `X-API-Key` | Your API key |

Example:

```
X-API-Key: ig_live_abc123xyz789
```

### API Key Format

* Production keys: `ig_live_` prefix
* Test keys: `ig_test_` prefix

## Endpoints

### Analyze Lease & Insurance Compliance

Compares a lease document against an insurance policy to identify coverage gaps.

```
POST /analyze
```

Request

Content-Type: `multipart/form-data`

| Field       | Type | Required | Description                 |
| ----------- | ---- | -------- | --------------------------- |
| `lease`     | file | Yes      | Lease agreement PDF         |
| `insurance` | file | Yes      | Insurance policy/binder PDF |

cURL Example

{% code title="cURL" %}

```bash
curl --location 'https://api.insurgrid.com/api/analyze' \
  --header 'X-API-Key: ig_live_abc123xyz789' \
  --form 'lease=@"lease_agreement.pdf"' \
  --form 'insurance=@"insurance_policy.pdf"'
```

{% endcode %}

JavaScript Example

{% code title="JavaScript (fetch)" %}

```javascript
const formData = new FormData();
formData.append('lease', leaseFile);
formData.append('insurance', insuranceFile);

const response = await fetch('https://api.insurgrid.com/api/analyze', {
  method: 'POST',
  headers: {
    'X-API-Key': 'ig_live_abc123xyz789'
  },
  body: formData
});

const result = await response.json();
```

{% endcode %}

Python Example

{% code title="Python (requests)" %}

```python
import requests

url = "https://api.insurgrid.com/api/analyze"
headers = {"X-API-Key": "ig_live_abc123xyz789"}

files = {
    "lease": open("lease_agreement.pdf", "rb"),
    "insurance": open("insurance_policy.pdf", "rb")
}

response = requests.post(url, headers=headers, files=files)
result = response.json()
```

{% endcode %}

## Response Schema

Success Response (200 OK)

```json
{
  "lease": { ... },
  "insurance": { ... },
  "comparison": [ ... ],
  "summary": { ... },
  "recommendations": [ ... ],
  "extractionNotes": [ ... ],
  "_raw": { ... }
}
```

### `lease` Object

Extracted information from the lease document.

| Field                  | Type    | Description                             |
| ---------------------- | ------- | --------------------------------------- |
| `propertyAddress`      | string  | Full property address                   |
| `propertyAddress_page` | integer | Page number where found                 |
| `landlord`             | string  | Landlord or management company name     |
| `landlord_page`        | integer | Page number where found                 |
| `tenant`               | string  | Tenant name(s)                          |
| `tenant_page`          | integer | Page number where found                 |
| `leaseStart`           | string  | Lease start date (e.g., "Sep 10, 2024") |
| `leaseStart_page`      | integer | Page number where found                 |
| `leaseEnd`             | string  | Lease end date (e.g., "Sep 30, 2025")   |
| `leaseEnd_page`        | integer | Page number where found                 |

Example:

```json
{
  "propertyAddress": "742 Evergreen Terrace, Unit 4B, Austin, TX 78701",
  "propertyAddress_page": 1,
  "landlord": "Sunrise Property Management LLC",
  "landlord_page": 1,
  "tenant": "John A. Smith, Sarah M. Smith",
  "tenant_page": 1,
  "leaseStart": "Jan 01, 2025",
  "leaseStart_page": 1,
  "leaseEnd": "Dec 31, 2025",
  "leaseEnd_page": 1
}
```

### `insurance` Object

Extracted information from the insurance document.

| Field                 | Type            | Description                |
| --------------------- | --------------- | -------------------------- |
| `carrier`             | string          | Insurance company name     |
| `carrier_page`        | integer         | Page number where found    |
| `policyNumber`        | string          | Policy number              |
| `policyNumber_page`   | integer         | Page number where found    |
| `insured`             | string          | Name(s) of insured parties |
| `insured_page`        | integer         | Page number where found    |
| `effectiveDate`       | string          | Policy effective date      |
| `effectiveDate_page`  | integer         | Page number where found    |
| `expirationDate`      | string \| null  | Policy expiration date     |
| `expirationDate_page` | integer \| null | Page number where found    |

Example:

```json
{
  "carrier": "Acme Insurance Company",
  "carrier_page": 1,
  "policyNumber": "HO-2025-78432",
  "policyNumber_page": 1,
  "insured": "JOHN A SMITH SARAH M SMITH",
  "insured_page": 1,
  "effectiveDate": "Jan 15, 2025",
  "effectiveDate_page": 1,
  "expirationDate": "Jan 15, 2026",
  "expirationDate_page": 1
}
```

### `comparison` Array

Array of compliance check results for each coverage type.

| Field                    | Type            | Description                                               |
| ------------------------ | --------------- | --------------------------------------------------------- |
| `field`                  | string          | Coverage type being compared                              |
| `leaseRequired`          | string          | What the lease requires                                   |
| `leaseRequired_page`     | integer \| null | Page in lease document                                    |
| `insuranceCoverage`      | string          | What the policy provides                                  |
| `insuranceCoverage_page` | integer \| null | Page in insurance document                                |
| `status`                 | string          | Compliance status: `pass`, `fail`, or `warning`           |
| `gap`                    | string \| null  | Description of the gap (if status is `fail` or `warning`) |

Status Values

| Status    | Meaning                                                     |
| --------- | ----------------------------------------------------------- |
| `pass`    | Insurance meets or exceeds lease requirement                |
| `fail`    | Insurance does not meet lease requirement - action required |
| `warning` | Potential issue that needs manual verification              |

Coverage Fields Checked

| Field Name                   | Description                               |
| ---------------------------- | ----------------------------------------- |
| `Renters Insurance Required` | Whether any renters insurance is required |
| `General Liability`          | Personal liability coverage amount        |
| `Property Damage`            | Property damage liability coverage        |
| `Workers Compensation`       | Workers comp (commercial leases)          |
| `Umbrella/Excess Liability`  | Additional liability coverage             |
| `Auto Liability`             | Vehicle liability coverage                |
| `Professional Liability`     | E\&O or professional coverage             |
| `Additional Insured`         | Landlord listed as additional insured     |
| `Interested Party`           | Landlord listed as interested party       |
| `Certificate Holder`         | Landlord as certificate holder            |
| `Waiver of Subrogation`      | Waiver of subrogation endorsement         |
| `Primary & Non-Contributory` | Primary coverage endorsement              |
| `Property Address`           | Address matches leased property           |
| `Policy Period`              | Policy dates cover lease term             |
| `Policy Status`              | Policy is currently active                |

Example (pass):

```json
{
  "field": "General Liability",
  "leaseRequired": "$100,000",
  "leaseRequired_page": 5,
  "insuranceCoverage": "$500,000",
  "insuranceCoverage_page": 1,
  "status": "pass",
  "gap": null
}
```

Example (with gap):

```json
{
  "field": "Interested Party",
  "leaseRequired": "Sunrise Property Management LLC",
  "leaseRequired_page": 1,
  "insuranceCoverage": "Not listed on policy",
  "insuranceCoverage_page": null,
  "status": "fail",
  "gap": "Landlord/property management must be listed as Interested Party on the insurance policy"
}
```

### `recommendations` Array

Array of actionable recommendations based on the compliance analysis.

Type: `string[]`

Example:

```json
[
  "Add Sunrise Property Management LLC as Interested Party on the policy",
  "Ensure policy effective date covers from lease start (Jan 01, 2025)",
  "Ensure policy covers entire lease term through Dec 31, 2025",
  "Verify the insurance policy covers the property at 742 Evergreen Terrace, Unit 4B, Austin, TX 78701"
]
```

### `extractionNotes` Array

Additional context about the documents that may affect compliance interpretation.

Type: `string[]`

Example:

```json
[
  "Lease requires tenant to maintain coverage for the entire lease term",
  "No specific limits for personal property coverage stated in lease",
  "Document type: Renters Policy Declaration Page",
  "Policy includes automatic renewal clause"
]
```

### `_raw` Object

Contains the complete extracted data from both documents including all coverage details. Useful for debugging or building custom comparison logic.

Full Response Example

{% code title="Full response example (JSON)" %}

```json
{
  "lease": {
    "propertyAddress": "742 Evergreen Terrace, Unit 4B, Austin, TX 78701",
    "propertyAddress_page": 1,
    "landlord": "Sunrise Property Management LLC",
    "landlord_page": 1,
    "tenant": "John A. Smith, Sarah M. Smith",
    "tenant_page": 1,
    "leaseStart": "Jan 01, 2025",
    "leaseStart_page": 1,
    "leaseEnd": "Dec 31, 2025",
    "leaseEnd_page": 1
  },
  "insurance": {
    "carrier": "Acme Insurance Company",
    "carrier_page": 1,
    "policyNumber": "HO-2025-78432",
    "policyNumber_page": 1,
    "insured": "JOHN A SMITH SARAH M SMITH",
    "insured_page": 1,
    "effectiveDate": "Jan 15, 2025",
    "effectiveDate_page": 1,
    "expirationDate": "Jan 15, 2026",
    "expirationDate_page": 1
  },
  "comparison": [
    {
      "field": "Renters Insurance Required",
      "leaseRequired": "Yes - Required",
      "leaseRequired_page": 5,
      "insuranceCoverage": "Yes - Policy exists",
      "insuranceCoverage_page": 1,
      "status": "pass",
      "gap": null
    },
    {
      "field": "General Liability",
      "leaseRequired": "$100,000",
      "leaseRequired_page": 5,
      "insuranceCoverage": "$300,000",
      "insuranceCoverage_page": 1,
      "status": "pass",
      "gap": null
    },
    {
      "field": "Interested Party",
      "leaseRequired": "Sunrise Property Management LLC",
      "leaseRequired_page": 1,
      "insuranceCoverage": "Not listed on policy",
      "insuranceCoverage_page": null,
      "status": "fail",
      "gap": "Landlord/property management must be listed as Interested Party on the insurance policy"
    },
    {
      "field": "Policy Period",
      "leaseRequired": "Jan 01, 2025 - Dec 31, 2025",
      "leaseRequired_page": 1,
      "insuranceCoverage": "Jan 15, 2025 - Jan 15, 2026",
      "insuranceCoverage_page": 1,
      "status": "warning",
      "gap": "Policy effective date (Jan 15, 2025) is after lease start date (Jan 01, 2025). Gap of 14 days without coverage."
    },
    {
      "field": "Property Address",
      "leaseRequired": "742 Evergreen Terrace, Unit 4B, Austin, TX 78701",
      "leaseRequired_page": 1,
      "insuranceCoverage": "742 Evergreen Terrace, Unit 4B, Austin, TX 78701",
      "insuranceCoverage_page": 1,
      "status": "pass",
      "gap": null
    }
  ],
  "summary": {},
  "recommendations": [
    "Add Sunrise Property Management LLC as Interested Party on the policy",
    "Request policy backdated to Jan 01, 2025 or obtain proof of prior coverage",
    "Verify landlord receives certificate of insurance"
  ],
  "extractionNotes": [
    "Lease requires tenant to maintain coverage for the entire lease term",
    "No specific limits for personal property coverage stated in lease",
    "Document type: Renters Policy Declaration Page"
  ]
}
```

{% endcode %}

## Error Responses

<details>

<summary>400 Bad Request</summary>

Missing or invalid files.

```json
{
  "error": "bad_request",
  "message": "Both lease and insurance files are required"
}
```

</details>

<details>

<summary>401 Unauthorized</summary>

Invalid or missing API key.

```json
{
  "error": "unauthorized",
  "message": "Invalid API key"
}
```

</details>

<details>

<summary>413 Payload Too Large</summary>

Files exceed size limit (10MB per file).

```json
{
  "error": "payload_too_large",
  "message": "File size exceeds 10MB limit"
}
```

</details>

<details>

<summary>422 Unprocessable Entity</summary>

Could not extract data from the provided documents.

```json
{
  "error": "extraction_failed",
  "message": "Unable to extract data from lease document",
  "details": "PDF appears to be image-only without extractable text"
}
```

</details>

<details>

<summary>429 Too Many Requests</summary>

Rate limit exceeded.

```json
{
  "error": "rate_limited",
  "message": "Rate limit exceeded. Try again in 60 seconds",
  "retry_after": 60
}
```

</details>

<details>

<summary>500 Internal Server Error</summary>

```json
{
  "error": "internal_error",
  "message": "An unexpected error occurred"
}
```

</details>

## Rate Limits

| Plan       | Requests/minute | Requests/day |
| ---------- | --------------- | ------------ |
| Free       | 5               | 50           |
| Pro        | 30              | 1,000        |
| Enterprise | Custom          | Custom       |

Rate limit headers are included in all responses:

```
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: 1699574400
```

## Supported Document Types

| Type  | Extensions     | Notes                                                    |
| ----- | -------------- | -------------------------------------------------------- |
| PDF   | `.pdf`         | Recommended. Supports text and scanned documents via OCR |
| Image | `.jpg`, `.png` | Single page documents only                               |

## Changelog

| Version | Date    | Changes         |
| ------- | ------- | --------------- |
| 1.0.0   | 2024-11 | Initial release |

## Support

* Email: <support@insurgrid.com>
* Documentation: <https://docs.insurgrid.com>
* Status Page: <https://status.insurgrid.com>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.insurgrid.com/readme/lease-compliance-checker-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
