> ## 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.

# Codat Accounting

## Codat Accounting

The **Codat Accounting** Workflow Builder block retrieves accounting data for a business after the applicant connects an accounting platform. The current block represents `codat`.

## Requirements

| Application field | Requirement | Notes |
| - | - | - |
| Linked accounting account | Required | Must include at least one completed accounting-platform connection. |

## API flow

1. Generate or share the application's Codat connection link.
2. Have the applicant select an accounting platform and finish authorization.
3. Call [Enrich Business Credit Application](/api-reference/workflow-management/enrich-business-credit-application) with `provider: "codat"`.
4. Confirm `data.onqueue: true`; Codat fetches asynchronously.
5. Poll [Get Commercial Data](/api-reference/workflow-management/get-commercial-data) with `services[]=codat`.

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

Without an existing Codat company, Lendflow creates one from the application. The fetch itself requires a linked accounting connection.

## Data Orchestration availability and flow

The block is available in the **Accounting** group for business entities. Place it after the applicant-facing Codat connection step. A full run fetches every currently supported dataset; individual internal runs can target one dataset, but the block represents the combined service.

## What the service returns

| Result area | Response path | Meaning |
| - | - | - |
| Lifecycle | `data.statuses.codat` | Latest Codat execution message. |
| Accounting data | `data.commercial_data.codat[]` | Stored accounting-data records. Each record identifies the Codat action and contains that action's provider response. |

Supported groups are `accounts`, `agedCreditor`, `agedDebtor`, `balanceSheets`, `billCreditNotes`, `billPayments`, `bills`, `companyInfo`, `creditNotes`, `customers`, `invoices`, `payments`, `profitAndLoss`, `suppliers`, and `taxRates`.

## Representative response

```json theme={"system"}
{
  "data": {
    "statuses": {"codat": "Success"},
    "commercial_data": {
      "codat": [{
        "accounting_service_name": "codatAccounting",
        "action": "profitAndLoss",
        "response_body": {
          "reports": [{
            "fromDate": "2026-08-01T00:00:00",
            "toDate": "2026-08-31T00:00:00",
            "income": {"name": "Income", "value": 62000, "items": []},
            "grossProfit": 41000,
            "netOperatingProfit": 12500,
            "netProfit": 13200
          }],
          "currency": "USD"
        }
      }]
    }
  }
}
```

## Field meanings

| Field | Type | Meaning |
| - | - | - |
| `accounting_service_name` | String | Internal accounting integration name; Codat records use `codatAccounting`. |
| `action` | String | Supported dataset fetched for this record, such as `profitAndLoss` or `balanceSheets`. |
| `response_body` | Object | Provider response for that action. Its shape varies by dataset and connected platform. |
| `reports` | Array | Time-bounded accounting reports. |
| `fromDate`, `toDate` | String | Inclusive report period timestamps returned by Codat. |
| `income`, `expenses` | Object | Hierarchical account totals with optional nested `items`. |
| `value` | Number | Amount in the report currency. |
| `grossProfit`, `netOperatingProfit`, `netProfit` | Number | Provider-calculated profit measures for the period. |
| `currency` | String | Currency code for the report. |

The exact object shape differs by dataset and accounting platform. Empty or unavailable datasets can be omitted or contain an error object.

## Errors and statuses

| Signal | Meaning |
| - | - |
| `Service Connection Required` | No linked Codat source is available for the requested dataset. |
| `create_business.error` | Lendflow could not create the Codat company. |
| Dataset `error`, `response`, and `status` | Codat rejected that dataset request; other datasets may still have results. |
| `Started` | One or more asynchronous dataset fetches are still running. |
| `Success` | The combined fetch completed and stored available data. |
| HTTP `401`, `403`, or `422` | Lendflow authentication, authorization, service enablement, or request validation failed. |

## FAQ

<AccordionGroup>
  <Accordion title="Does running the block create the applicant's accounting connection?">
    It can create the Codat company, but the applicant must still authorize an accounting platform through the Codat connection link.
  </Accordion>

  <Accordion title="Why can one dataset contain an error while others contain data?">
    Codat fetches supported datasets separately. A connected platform may not support or permit every dataset.
  </Accordion>

  <Accordion title="Are all response fields identical across accounting platforms?">
    No. The supported top-level datasets are fixed by Lendflow, but record availability and nested provider fields vary by source platform.
  </Accordion>
</AccordionGroup>
