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

# LexisNexis Bankruptcies

## LexisNexis Bankruptcies

The **LexisNexis Bankruptcies** block combines a business bankruptcy search with its detailed report.

## What the service returns

| Service ID | Role | Stored result |
| - | - | - |
| `lexis_nexis_bankruptcy_search` | Searches by business, address, EIN, and available owner data; stores the first match's TMS and business IDs. | `commercial_data.lexis_nexis.bankruptcy_search` |
| `lexis_nexis_bankruptcy_report` | Uses the stored IDs to request detailed case information. | `commercial_data.lexis_nexis.bankruptcy_report` |

The search can return multiple candidates. The report is based on identifiers from the first search record, so review the search match before relying on the report.

## Requirements

### Search

| Application field | Requirement | Notes |
| - | - | - |
| Business legal name | Optional | Used to identify potential business matches when available. |
| Primary business address | Optional | Street, city, state, and ZIP code can improve matching. State and ZIP code must pass validation when provided. |
| EIN | Optional | The value must pass validation when provided. |
| Primary owner's name | Optional | Used as an additional matching input when available. |
| Primary owner's SSN, address, and phone | Optional | These values can improve matching and must pass applicable validation when provided. |

### Report

| Application field | Requirement | Notes |
| - | - | - |
| Bankruptcy search result | Conditional | A report requires the business and record identifiers selected from the first search result. If no usable search result is stored, Lendflow runs Bankruptcy Search first. |

## Run the services

Call [Enrich Business Credit Application](/api-reference/workflow-management/enrich-business-credit-application) at `PUT /api/applications/{application_id}/enrich`.

Search:

```json theme={"system"}
{ "provider": "lexis_nexis_bankruptcy_search" }
```

Report:

```json theme={"system"}
{ "provider": "lexis_nexis_bankruptcy_report" }
```

Run the search before the report. If report identifiers are not stored, the report service automatically performs a search first. It then requires both `BusinessId` and `TMSId` from the selected search record.

Search settings are fixed by Lendflow: up to 20 records from record 1, nickname and phonetic matching enabled, also-found records included, and all bankruptcy chapters. The report requests all bankruptcies. Callers cannot override these settings through `options`.

## Retrieve results

Poll `GET /api/applications/{application_id}/commercial_data` through [Get Commercial Data](/api-reference/workflow-management/get-commercial-data) with both service IDs in `services[]`.

| Data | Search path | Report path |
| - | - | - |
| Result | `commercial_data.lexis_nexis.bankruptcy_search` | `commercial_data.lexis_nexis.bankruptcy_report` |
| Status | `statuses.lexis_nexis.bankruptcy_search` | `statuses.lexis_nexis.bankruptcy_report` |
| Request | `request_data.lexis_nexis.bankruptcy_search` | `request_data.lexis_nexis.bankruptcy_report` |
| Date | `dates.lexis_nexis_bankruptcy_search` | `dates.lexis_nexis_bankruptcy_report` |

[Get Commercial Data](/api-reference/workflow-management/get-commercial-data) returns the latest `statuses`, `dates`, `commercial_data`, and `request_data` values for each requested service ID.

## Asynchronous behavior

Each enrichment call queues a job; `{"data":{"onqueue":true}}` is not a provider result. Poll each service independently until its commercial-data status is `Success` or contains an error. Rerunning a report reuses stored match IDs unless they are absent, in which case a new search is performed.

## Example response

Search result:

```json theme={"system"}
{
  "BankruptcySearch2ResponseEx": {
    "response": {
      "Header": { "Status": 0, "QueryId": "101", "TransactionId": "txn-search" },
      "Records": {
        "Record": [{
          "Bankruptcy": {
            "TMSId": "BKEXAMPLE001",
            "Chapter": "11",
            "CourtName": "EXAMPLE DISTRICT COURT",
            "CaseNumber": "21-01231",
            "FilingDate": { "Month": 3, "Day": 26, "Year": 2021 },
            "FilingStatus": "Voluntary",
            "Debtors": { "Debtor": [{ "Names": { "Name": [{ "CompanyName": "EXAMPLE LLC" }] } }] }
          }
        }],
        "RecordCount": 1
      }
    }
  }
}
```

Report result:

```json theme={"system"}
{
  "BankruptcyReport2ResponseEx": {
    "response": {
      "Header": { "Status": 0, "QueryId": "101", "TransactionId": "txn-report" },
      "BankruptcyReportRecords": {
        "BankruptcyReportRecord": [{
          "CaseId": "case-001",
          "Chapter": "11",
          "CourtName": "EXAMPLE DISTRICT COURT",
          "CaseNumber": "21-01231",
          "CaseStatus": "1",
          "FilingDate": { "Month": 3, "Day": 26, "Year": 2021 },
          "ClosedDate": null,
          "Debtors": { "Debtor": [{ "Names": { "Name": [{ "CompanyName": "EXAMPLE LLC" }] } }] }
        }]
      }
    }
  }
}
```

## Response fields

| Field | Type | Meaning | Format or behavior |
| - | - | - | - |
| `BankruptcySearch2ResponseEx.response` | object | LexisNexis bankruptcy-search response envelope. | Contains `Header` and `Records`. |
| `BankruptcyReport2ResponseEx.response` | object | LexisNexis bankruptcy-report response envelope. | Contains `Header` and `BankruptcyReportRecords`. |
| `Header` | object | Provider request status and correlation metadata. | Returned by search and report. |
| `Header.Status` | integer | LexisNexis response status code. | Provider-defined; `0` appears in successful fixtures. |
| `Header.QueryId` | string | Correlates the provider request. | Derived from Lendflow's owner record when available. |
| `Header.TransactionId` | string | LexisNexis transaction identifier. | Provider-generated. |
| `Records` | object | Search-result container. | Contains `Record` and `RecordCount`. |
| `Records.Record` | array | Search candidates. | Can be empty. |
| `Records.Record[].Bankruptcy` | object | Candidate bankruptcy case and match data. | Returned for each search record. |
| `Bankruptcy.TMSId` | string | Provider record ID used by the report. | Required for report lookup. |
| `Bankruptcy.Chapter` | string | Current bankruptcy chapter. | Provider code such as `11`. |
| `Bankruptcy.CourtName` | string | Court name. | Provider text. |
| `Bankruptcy.CaseNumber` | string | Case number. | Court-defined text. |
| `Bankruptcy.FilingDate` | object | Filing date. | `Month`, `Day`, and `Year` integers. |
| `Bankruptcy.FilingStatus` | string | Filing status. | Provider text such as `Voluntary`. |
| `Bankruptcy.Debtors.Debtor` | array | Debtors associated with the candidate. | Can contain businesses or people. |
| `Names.Name[].CompanyName` | string | Reported debtor company name. | Present for a business name. |
| `Records.RecordCount` | integer | Number of search records reported. | `0` means no candidates. |
| `BankruptcyReportRecords` | object | Detailed-case container. | Contains `BankruptcyReportRecord`. |
| `BankruptcyReportRecords.BankruptcyReportRecord` | array | Detailed report cases. | Can be empty. |
| `CaseId` | string | Provider case identifier. | Provider-generated. |
| `CaseStatus` | string | Provider case-status code. | Interpret with other case status text returned by LexisNexis. |
| `ClosedDate` | object or null | Date the case closed. | Date-parts object when known; null when absent or open. |

Only fields shown in the fixture are defined here. LexisNexis can return additional provider fields.

## Data Orchestration

The block is available under **Bankruptcies → LexisNexis**. Data Orchestration bankruptcy conditions use the search service, not the report service. Run `lexis_nexis_bankruptcy_search` before any dependent condition.

## Errors

| Result | Meaning | Action |
| - | - | - |
| HTTP `401` or `403` | Lendflow authentication or application authorization failed. | Use an authorized bearer token. |
| HTTP `422` | Service access, body, or application data validation failed. | Confirm enabled services and correct invalid EIN, SSN, phone, state, or ZIP data. |
| Report error requiring `BusinessId` or `TMSId` | Search returned no usable first record. | Review the search result and rerun after correcting match inputs. |
| `failed_at` or error status | Provider request or execution failed. | Inspect the exact service's lifecycle `error` and stored status. |

## FAQ

<AccordionGroup>
  <Accordion title="Can I run only the report service?">
    Yes, but it automatically runs search when stored bankruptcy IDs are absent. Running and reviewing search first makes the selected match explicit.
  </Accordion>

  <Accordion title="Can I change the search record limit or chapter?">
    No. The current implementation uses fixed search settings and exposes no options.
  </Accordion>

  <Accordion title="Does a successful search guarantee a report?">
    No. The first search record must provide both a TMS ID and business ID, and the report request can still fail independently.
  </Accordion>

  <Accordion title="Does onqueue true mean both services completed?">
    No. It confirms only the service or services in that request were queued.
  </Accordion>
</AccordionGroup>
