> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiinsurance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

## Overview

Welcome to the AI Insurance External API documentation. This API allows you to programmatically manage your insurance operations, including submissions, quotes, policies, and more.

**Current API Resources:**

* **Submissions** - Create and manage insurance submissions
* **Quotes** - Generate and retrieve quote information
* **Notes** - Attach comments and documentation to entities
* **Configuration** - Access your company's rating fields and coverage types

**Coming Soon:**

* Policies
* Events
* Insureds
* Financials

***

## Getting Started

### Base URL

All API endpoints are relative to your AI Insurance instance base URL:

```
https://app.aiinsurance.io
```

### Route Prefix

All legacy API endpoints are served under the `/api/external/` path prefix. V1 API endpoints use a separate `/api/v1/external/` prefix — see the [V1 API Reference](/api-v1-reference/overview).

### Authentication

All API requests require authentication using an API key. Include your API key in the request headers:

```bash theme={null}
Authorization: YOUR-API-KEY
```

<Note>To generate an API key, see [Authentication](/api-legacy-reference/authentication).</Note>

***

## API Resources

### Submissions

Create and manage insurance submissions with complete policy and insured information.

* **[List Submissions](/api-reference/submissions/list-submissions)** - Retrieve submissions for your company
* **[Create Submission](/api-reference/submissions/create-submission)** - Create a new submission
* **[Update Submission](/api-reference/submissions/update-submission)** - Update an existing submission
* **[Overview](/api-legacy-reference/submissions/overview)** - Detailed guide on working with submissions

### Quotes

Generate and retrieve quote information for submissions.

* **List Quotes** (`GET /api/external/companies/{companyId}/quotes`) - Retrieve complete quote details with all nested data
* **List Quote Info** (`GET /api/external/companies/{companyId}/quotes-info`) - Retrieve lightweight quote information (faster)
* **Get Quote** (`GET /api/external/companies/{companyId}/quotes/{quoteId}`) - Get detailed quote information by ID

See the Quotes section in the sidebar for interactive API documentation.

### Configuration

Access your company's configuration including rating fields, coverage types, and entity types.

* **[Get Configuration](/api-legacy-reference/configuration)** - Retrieve company configuration

***

## Reference Documentation

### Data Models

Complete reference for all data structures used in the API:

* **[Submission Object](/api-legacy-reference/data-models#submission-object)** - Submission response structure
* **[Quote Object (Lightweight)](/api-legacy-reference/data-models#quote-object-lightweight)** - Lightweight quote representation
* **[Quote Object (Full)](/api-legacy-reference/data-models#quote-object-full)** - Complete quote structure
* **[ImportPolicy](/api-legacy-reference/data-models#importpolicy-object)** - Policy information for submissions
* **[ImportPolicyCoverage](/api-legacy-reference/data-models#importpolicycoverage-object)** - Coverage data
* **[ImportInsured](/api-legacy-reference/data-models#importinsured-object)** - Insured party information

See [Data Models](/api-legacy-reference/data-models) for complete reference.

***

## Quick Start Example

Here's a simple example to create a submission:

```bash theme={null}
curl -X POST \
  "https://app.aiinsurance.io/api/external/companies/<YOUR-COMPANY-ID>/submissions" \
  -H "Authorization: <YOUR-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Submission",
    "type": "new_business",
    "policy": {
      "policyNumber": "POL-001",
      "policyType": "O",
      "policyStartDate": "2024-01-01",
      "policyEndDate": "2025-01-01"
    }
  }'
```

See the [Submissions Guide](/api-legacy-reference/submissions/overview) for detailed examples and tutorials.

***

## Audit Logging

All external API calls are automatically logged for audit and debugging purposes. The audit log captures request details, response status, and timing information.

### Batch ID for Request Correlation

When making multiple related API calls (e.g., creating several submissions as part of a batch import), you can include an optional `batchId` field in the request body of any mutation endpoint (POST, PUT, PATCH, DELETE). This allows you to correlate and query related requests later.

**Key points:**

* `batchId` is a pass-through field—it's not validated or part of the request schema
* Include it at the root level of your request body
* The value is stored in the `external_api_audit_log` table (indexed for efficient querying)
* Use any string value that helps you identify related requests (e.g., UUID, timestamp, job ID)

### Example: Including batchId

```bash theme={null}
# Create multiple submissions with the same batchId for correlation
BATCH_ID="import-2024-01-15-abc123"

curl -X POST \
  "https://app.aiinsurance.io/api/external/companies/<YOUR-COMPANY-ID>/submissions" \
  -H "Authorization: <YOUR-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "batchId": "'"$BATCH_ID"'",
    "name": "Submission 1",
    "type": "new_business",
    "policy": {
      "policyNumber": "POL-001",
      "policyType": "O",
      "policyStartDate": "2024-01-01",
      "policyEndDate": "2025-01-01"
    }
  }'

curl -X POST \
  "https://app.aiinsurance.io/api/external/companies/<YOUR-COMPANY-ID>/submissions" \
  -H "Authorization: <YOUR-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "batchId": "'"$BATCH_ID"'",
    "name": "Submission 2",
    "type": "new_business",
    "policy": {
      "policyNumber": "POL-002",
      "policyType": "O",
      "policyStartDate": "2024-01-01",
      "policyEndDate": "2025-01-01"
    }
  }'
```

This makes it easy to later query the audit log for all API calls associated with a specific batch operation.
