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

# Litigation & Bankruptcy Search: API Quickstart

> Step-by-step guide to implementing Baselayer Docket Search via API.

This guide walks through the full docket search implementation: submitting a search, retrieving results, and requesting case details and documents when needed.

Before starting, review [Litigation & Bankruptcy Search: Basics](/docs/litigation-bankruptcy-search-basics) for an overview of how the product works, and [Litigation, Bankruptcy, and Public Records](/docs/litigation-and-bankruptcy-records) for court and case terminology.

***

### Prerequisites

* An active Baselayer API key
* A completed Business Search: you will need either the `business_id` or `business_search_id` from that result
* Familiarity with Baselayer's Business Search API: see [Business Search: API Basics](/docs/business-search) if needed

***

### Base URL & Authentication

```
Production:  https://api.baselayer.com
```

All requests require an API key in the `X-API-Key` header:

```http theme={null}
X-API-Key: YOUR_API_KEY
```

***

## Step 1: Submit the Docket Search

`POST /docket_searches` accepts three request variants depending on what identifiers you have available.

***

### Option A: Search by `business_id`

```bash theme={null}
curl --request POST \
  --url https://api.baselayer.com/docket_searches \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "business_id": "f7688172-2e5f-400b-9e3f-8d2f93eabd79"
  }'
```

***

### Option B: Search by `business_search_id` with `additional_search_entities`

Use the `id` from a Business Search response. This variant supports `additional_search_entities` to search linked individuals or alternate business names in the same call.

```bash theme={null}
curl --request POST \
  --url https://api.baselayer.com/docket_searches \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "business_search_id": "1504f313-9721-4006-b813-82faf6c6f02d",
    "additional_search_entities": [
      {
        "name": "Jane Smith",
        "type": "Person",
        "search_states": ["DE"]
      }
    ]
  }'
```

For full guidance on `additional_search_entities`, see [Litigation & Bankruptcy Search: Best Practices](/docs/litigation-bankruptcy-search-best-practices) and [Litigation & Bankruptcy Search for Individuals](/docs/litigation-bankruptcy-search-for-individuals).

***

### Option C: Search by `person_id`

```bash theme={null}
curl --request POST \
  --url https://api.baselayer.com/docket_searches \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "person_id": "f9458925-bea9-4551-9913-31c21658d3d7"
  }'
```

For a full guide on searching individuals, see [Litigation & Bankruptcy Search for Individuals](/docs/litigation-bankruptcy-search-for-individuals).

***

### Scoping to Litigations, Bankruptcies, or Both

By default, Baselayer searches for both litigations and bankruptcy proceedings. Use the `options` field to scope the search if needed:

```bash theme={null}
# Litigation only
--data '{ "business_id": "...", "options": ["Order.Litigations"] }'

# Bankruptcy only
--data '{ "business_id": "...", "options": ["Order.Bankruptcy"] }'

# Both (default — same as omitting the field)
--data '{ "business_id": "...", "options": ["Order.Litigations", "Order.Bankruptcy"] }'
```

Most customers search for both. Scoping to one type is useful when your workflow treats litigation and bankruptcy as separate decisioning steps, or when cost efficiency matters at high volume.

***

### Execution Mode

Docket searches support both synchronous and asynchronous execution. Results are returned directly in the response body on synchronous requests. For async execution, consume results via webhooks (`DocketSearch.completed`) or by polling `/docket_searches/{id}`. See [Synchronous & Asynchronous Request Execution](/docs/synchronous-asynchronous-request-execution) for setup guidance.

***

## Step 2: Retrieve Results

**Synchronous (default):** Results are returned in the `POST` response body. Skip ahead to **Step 3: Parse the Response**.

**Asynchronous:** Consume results via the `DocketSearch.completed` webhook or poll `/docket_searches/{id}` until `state` is `COMPLETED`. See [Synchronous & Asynchronous Request Execution](/docs/synchronous-asynchronous-request-execution) for full guidance.

***

## Step 3: Parse the Response

A completed search returns a response containing a `dockets` array.

**Example response:**

```json theme={null}
{
  "id": "7b3c1a20-0001-0001-0001-000000000001",
  "state": "COMPLETED",
  "business_id": "f7688172-2e5f-400b-9e3f-8d2f93eabd79",
  "last_updated_at": "2024-06-01T12:00:00Z",
  "dockets": [
    {
      "id": "d0001111-0001-0001-0001-000000000001",
      "title": "First National Bank v. Acme Logistics Inc",
      "docket_number": "2023-CV-004521",
      "court": "DE Superior Court",
      "date_filed": "2023-04-10",
      "case_type": "Contract Dispute",
      "status": "Open",
      "normalized_status": "open",
      "is_bankruptcy": false,
      "bankruptcy_type": null,
      "risk_level": "medium",
      "match_level": "EXACT",
      "last_synced_at": "2024-05-30T08:00:00Z"
    },
    {
      "id": "d0001111-0001-0001-0001-000000000002",
      "title": "In re Acme Logistics Inc",
      "docket_number": "2022-BK-001234",
      "court": "US Bankruptcy Court, District of Delaware",
      "date_filed": "2022-09-01",
      "case_type": "Chapter 11",
      "status": "Closed",
      "normalized_status": "closed",
      "is_bankruptcy": true,
      "bankruptcy_type": "Chapter 11",
      "risk_level": "high",
      "match_level": "EXACT",
      "last_synced_at": "2024-05-30T08:00:00Z"
    }
  ]
}
```

**Key fields to evaluate on each docket:**

| Field | What to check |
| - | - |
| `is_bankruptcy` | Flag immediately if `true` - see Best Practices for threshold guidance |
| `risk_level` | `high` cases should always surface to underwriting |
| `normalized_status` | `open` cases with recent `date_filed` carry higher risk |
| `match_level` | `EXACT` for automated decisioning; `SIMILAR` for deeper due diligence |
| `case_type` | Use to classify and filter by your internal must-review list |
| `date_filed` | Recency matters - a 2-year-old open case is more material than a 10-year-old closed one |

For full guidance on interpreting and acting on results, see [Litigation & Bankruptcy Search: Best Practices](/docs/litigation-bankruptcy-search-best-practices).

***

## Step 4: Request Case Details (Optional)

Case details provide the full chronological timeline of a case: all filings, hearings, motions, and court orders.

> Most customers do not need case details for standard workflows. Request them selectively for cases that warrant deeper review.

**Request details for a specific docket:**

```bash theme={null}
curl --request PUT \
  --url https://api.baselayer.com/dockets/DOCKET_ID/details \
  --header 'X-API-Key: YOUR_API_KEY'
```

This initiates retrieval and emits `DocketDetailsSearch.submitted` and `DocketDetailsSearch.completed` webhook events.

**Retrieve the details:**

```bash theme={null}
curl --request GET \
  --url https://api.baselayer.com/dockets/DOCKET_ID/details \
  --header 'X-API-Key: YOUR_API_KEY'
```

The response includes an `updates` array: a chronological record of all case events. Some updates may reference exhibits (court documents) associated with that event.

***

## Step 5: Retrieve Exhibits (Optional)

Exhibits are court documents referenced in case details. Availability varies by court and jurisdiction.

**Check availability:** Each exhibit in the `updates` array includes an `is_available` field.

**Retrieve an available exhibit:**

```bash theme={null}
curl --request GET \
  --url https://api.baselayer.com/dockets/exhibits/EXHIBIT_ID \
  --header 'X-API-Key: YOUR_API_KEY' \
  --output exhibit.pdf
```

If `is_available` is `false`, the document must be ordered explicitly:

```bash theme={null}
curl --request PUT \
  --url https://api.baselayer.com/dockets/exhibits/EXHIBIT_ID \
  --header 'X-API-Key: YOUR_API_KEY'
```

***

## Full Example: Business Docket Search (Synchronous)

```python theme={null}
import requests
from datetime import date, timedelta

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.baselayer.com"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json"
}

# Step 1: Submit search — business + guarantor in one call
payload = {
    "business_search_id": "1504f313-9721-4006-b813-82faf6c6f02d",
    "additional_search_entities": [
        {
            "name": "Jane Smith",
            "type": "Person",
            "search_states": ["DE"]
        }
    ]
}

response = requests.post(f"{BASE_URL}/docket_searches", json=payload, headers=headers)
result = response.json()

high_risk = []
review_later = []
cutoff = str(date.today() - timedelta(days=365 * 5))  # 5-year recency threshold

for docket in result.get("dockets", []):
    # Only process EXACT matches by default
    if docket.get("match_level") != "EXACT":
        continue

    risk_level = docket.get("risk_level")
    is_bankruptcy = docket.get("is_bankruptcy")
    date_filed = docket.get("date_filed", "")
    normalized_status = docket.get("normalized_status")

    if is_bankruptcy or risk_level == "high":
        high_risk.append(
            f"[HIGH] {docket['case_type']} — {docket['court']} "
            f"(filed {date_filed}, status: {normalized_status})"
        )

    elif risk_level == "medium" and date_filed >= cutoff:
        review_later.append(
            f"[MEDIUM] {docket['case_type']} — {docket['court']} "
            f"(filed {date_filed})"
        )

if high_risk:
    print("HIGH RISK — escalate to underwriting:")
    for r in high_risk:
        print(f"  - {r}")

if review_later:
    print("MEDIUM RISK — include in underwriting file:")
    for r in review_later:
        print(f"  - {r}")

if not high_risk and not review_later:
    print("No material docket signals detected.")
```

***

## Where to Go Next

* **[Litigation & Bankruptcy Search: Best Practices](/docs/litigation-bankruptcy-search-best-practices)**: Risk classification, match level strategy, pattern recognition, and ticket-size frameworks
* **[Litigation & Bankruptcy Search for Individuals](/docs/litigation-bankruptcy-search-for-individuals)**: Searching litigation for sole proprietors, guarantors, and beneficial owners
* **[Litigation & Bankruptcy Search: Basics](/docs/litigation-bankruptcy-search-basics)**: Full response field reference


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.