# Debt Collection

This example case describes how to use the API to sync debt invoice data to an external system for processing debt invoice errands.

## Sections

- [Activation level](/introduction/cases/debt-collection/activation-level) — Company-level credentials.
- [Access](/introduction/cases/debt-collection/access) — Read and write entities and permissions.
- [Implementation example](/introduction/cases/debt-collection/implementation-example) — Data fetching and writing; toggle between REST API and Python SDK.


## Entity relationships

**Debt invoice chain:**

```mermaid
flowchart TB
  C[Company]
  I[Invoice]
  DI[DebtInvoice]
  DIE[DebtInvoiceEvent]

  I --> C
  DI --> I
  DIE --> DI
```

**Recipients and payments:**

```mermaid
flowchart TB
  I[Invoice]
  DI[DebtInvoice]
  IR[InvoiceRecipient]
  T[Tenant]
  ST[SubTenant]
  IP[InvoicePayment]
  PDF[InvoiceRelatedPDFFile]

  IR --> I
  T --> IR
  ST --> IR
  IP --> I
  IP --> DI
  PDF --> I
```

**Contract and documents:**

```mermaid
flowchart TB
  I[Invoice]
  Contract[Contract]
  Space[Space]
  SCD[SignedContractDocument]
  SD[SignableDocument]

  Contract --> Space
  SCD --> Contract
  SD --> Contract
  I --> Contract
```