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

# Partner & Revenue Share Workflow

> Set up commission-based partnerships and track revenue shares automatically

incaseof.law supports a **commission-based partner model** where external partners (e.g. law firms, brokers, referral agencies) can refer customers. When payments are collected on claims linked to a partner's customer, **revenue shares are automatically calculated** based on the partner's commission rate.

## How It Works

```mermaid theme={null}
flowchart LR
    A[Become a Partner] --> B[Create Customer]
    B --> C[Create Debtor]
    C --> D[Create Claim with customer_id]
    D --> E[Payment Received]
    E --> F[Revenue Share Auto-Created]
```

1. **Partner**: The referral entity (e.g. a law firm) with a configured commission rate
2. **Customer**: A client brought in by a partner - automatically linked via your API key
3. **Debtor**: The person or company that owes the debt to the customer
4. **Claim**: A debt collection case - linked to a debtor and a customer via `customer_id`
5. **Revenue Share**: Automatically created when incaseof.law earns fees on a claim linked to a customer

***

## Step 1: Create a Partner

Partners are created internally by incaseof.law. If you are interested in becoming a partner, contact us at **[info@incaseof.law](mailto:info@incaseof.law)**.

Once confirmed, you will receive an **API key** to start integrating.

***

## Step 2: Create a Customer

Create a customer. The customer is automatically linked to your partner account via your API key.

Send your own ID for the business as `partner_client_reference` and its VAT ID as `uid` **on every case**. If your partner account already has a customer with that reference or UID, the API returns it instead of creating a new one — see [Reusing an existing customer](#reusing-an-existing-customer).

> [!NOTE]
>
> **Nothing reaches a debtor before the customer has accepted our terms.** The customer's contact receives an invitation
> and accepts our GTC and DPA when signing in. Until then claims of this customer can be created, but no letter, SMS or
> e-mail goes to a debtor and no court filing is made. If your agreement with us requires the provider confirmation
> under § 1.5 lit. b, forward it once per customer with
> [`POST /openapi/customers/{id}/provider-confirmation`](https://documentation.incaseof.law/api-reference/customers/create-provider-confirmation) — the
> same rule applies until it is on file.

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST 'https://service.incaseof.law/openapi/customers' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
>   -H 'Content-Type: application/json' \
>   -d '{
>     "name": "Acme Corporation",
>     "email": "billing@acme.com",
>     "partner_client_reference": "ACME-001",
>     "uid": "ATU12345678",
>     "phone": "+43 1 234 5678",
>     "address": {
>       "street": "Ringstrasse 10",
>       "city": "Wien",
>       "zip": "1010",
>       "country": "AT"
>     }
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://service.incaseof.law/openapi/customers', {
>   method: 'POST',
>   headers: {
>     'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
>     'Content-Type': 'application/json'
>   },
>   body: JSON.stringify({
>     name: 'Acme Corporation',
>     email: 'billing@acme.com',
>     partner_client_reference: 'ACME-001',
>     uid: 'ATU12345678',
>     phone: '+43 1 234 5678',
>     address: {
>       street: 'Ringstrasse 10',
>       city: 'Wien',
>       zip: '1010',
>       country: 'AT'
>     }
>   })
> })
>
> const data = await response.json()
> const customerId = data.data.id
> console.log(data.reused ? 'Existing customer reused:' : 'Customer created:', customerId)
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
>
> url = 'https://service.incaseof.law/openapi/customers'
> headers = {
>     'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
>     'Content-Type': 'application/json'
> }
>
> payload = {
>     'name': 'Acme Corporation',
>     'email': 'billing@acme.com',
>     'partner_client_reference': 'ACME-001',
>     'uid': 'ATU12345678',
>     'phone': '+43 1 234 5678',
>     'address': {
>         'street': 'Ringstrasse 10',
>         'city': 'Wien',
>         'zip': '1010',
>         'country': 'AT'
>     }
> }
>
> response = requests.post(url, json=payload, headers=headers)
> customer = response.json()
> customer_id = customer['data']['id']
> print(f"{'Existing customer reused' if customer['reused'] else 'Customer created'}: {customer_id}")
> ```

> [!NOTE]
>
> **Save the customer ID**: You will need the `id` from the response to link claims to this customer.

### Customer Fields

| Field | Type | Required | Description |
| - | - | - | - |
| `name` | string | Yes | Customer name (1-255 chars) |
| `email` | string | Yes | Customer email |
| `phone` | string | No | Phone number (max 50 chars) |
| `address` | object | **Yes** | Postal address of the business: `street`, `zip`, `city` (non-empty) and `country` (ISO code of a European country, e.g. `AT`, `DE`). Becomes the creditor address on letters and on the court-fee invoice. A missing or empty line returns `400 VALIDATION_ERROR` naming it, e.g. `address.zip is required` |
| `metadata` | object | No | Arbitrary key-value data |
| `partner_client_reference` | string | No | Your own ID for this business (max 255 chars, trimmed, case-sensitive). Unique within your partner account |
| `uid` | string | No | EU VAT ID, e.g. `ATU12345678`. Spaces and the separators `-` `.` `/` are removed and letters uppercased; it must then be a 2-letter country code plus 2–12 characters, otherwise 400. Unique within your partner account |
| `legal_form` | string | No¹ | The business's legal form: `gmbh`, `ug`, `ag`, `se`, `kg`, `og_ohg`, `gmbh_co_kg`, `gbr`, `partg`, `kgaa`, `eg`, `verein`, `flexco`, `einzelunternehmen`, `eingetragener_kaufmann`, `praktiker`, `pauschalierter_land_forstwirt` |
| `legal_representative` | object | No¹ | `{ "function": "Geschäftsführerin", "name": "Dr. Anna Berger" }` (35 characters each) — the legal representative German court filings name |
| `owner` | object | No¹ | `{ "first_name", "last_name" }` — for a sole trader (`einzelunternehmen`, `eingetragener_kaufmann`, `praktiker`, `pauschalierter_land_forstwirt`) instead of `legal_representative` |
| `billing_email` | string | No¹ | Where invoices from incaseof.law to the business go |
| `vat_deductible` | boolean | No¹ | Whether the business may deduct input VAT (Vorsteuerabzug) |
| `payout_account` | object | No¹ | `{ "iban", "bic"?, "bank_name"? }` — the account we pay the business's share to. The IBAN's check digits are verified. **On creation only**; `PATCH` refuses it — contact incaseof.law to change it |

¹ Partner keys only. Required when your partner agreement requires it (see [Required fields and prohibited data](#required-fields-and-prohibited-data)).

### Reusing an existing customer

Each business you work for should be **one** customer. Before creating, the API looks for a customer of your partner account — first by `partner_client_reference`, then by `uid`, and when neither matches, by the same `email` **and** the same `name` (case and spaces ignored), as long as that customer's stored `partner_client_reference` / `uid` do not differ from the ones you sent:

| Result | HTTP | `reused` | What happens |
| - | - | - | - |
| Match | `200` | `true` | The existing customer is returned (same `id` and `organization_id`). Name, email, address and the business fields (`legal_form` … `payout_account`) are **not** changed — use `PATCH /openapi/customers/{id}` for that. A key the customer does not have yet is added to it. |
| No match | `201` | `false` | A new customer is created. |
| Reference matches one customer, UID another | `409` | — | Nothing is created. Correct the reference or the UID. |

* `null` for either key is treated as not given. Without `partner_client_reference` and `uid`, only name and e-mail identify the customer: the same business sent with a different name or e-mail becomes a new customer. Send `partner_client_reference` (or store the returned `id`) to make the match exact.
* Customers created before you sent these keys can be linked with `PATCH /openapi/customers/{id}` (`{"partner_client_reference": "ACME-001", "uid": "ATU12345678"}`); a key already used by another of your customers returns `409`.
* The keys are scoped to your partner account: another partner sending the same UID gets its own customer.
* The customer's onboarding invitation is sent once, with the first claim filed for that customer — reusing the customer does not send it again.
* **E-mail that already has a login.** If the customer's `email` belongs to an existing incaseof.law user — for example one owner with two companies and separate bookkeeping — no invitation is needed: the user is added to the new customer's organisation immediately, receives a short notice e-mail, and finds the company in their account after the next login. The response shows `"existing_user_linked": true`. Each company remains a separate customer with its own `id`.

### Required fields and prohibited data

Your partner agreement may require fields the API otherwise treats as optional, and may prohibit health data. incaseof.law sets both for your partner account; they are checked **before anything is stored**, so a refused request leaves nothing behind.

* **Required fields** — a request without one answers `400 VALIDATION_ERROR`, one `details` entry per missing field, e.g. `"message": "creditor_confirmation required"`. Checked on creation:
  * claim: `creditor_confirmation: { "warranties_confirmed": true, "consent_confirmed": true }`
  * invoice (JSON and PDF upload): `default_date`, `creditor_reminder_dates` (not with `default_basis: "bgb_286_3"`), `contract_date`, `subject`
  * debtor: `legal_representative` (the debtor's guardian or attorney — send it whenever one exists)
  * customer: `legal_form`, `legal_representative` (`owner` for a sole trader), `billing_email`, `payout_account`, `vat_deductible`
* **Prohibited data** — invoice `subject` / `description`, `invoice_issuer`, `invoice_recipient`, payment `notes`, document `description` and customer `metadata` are checked for health data: a health insurance number (KVNR), an institution code (IK, a nine-digit number on its own), `PZN`, `Pflegegrad`, `Diagnose`, `ICD` or an ICD code (`F32.1`). A match answers `400 PROHIBITED_DATA` naming the field; the value is never echoed. Describe services neutrally, e.g. "Privatärztliche Leistung vom 01.09.2026".

***

## Step 3: Create a Debtor

Create the debtor (person or company) that owes the debt to your customer. **You must include the `customer_id`** so the system knows which organization this debtor belongs to.

**Salutation** (`person.salutation`): `mr` (Herr), `mrs` (Frau) or `diverse` (Divers). `Herr`, `Herrn`, `Hr.`, `Frau`, `Fr.`, `männlich`, `weiblich`, `male`, `female`, `m`, `w`, `f`, `d` (also followed by academic titles, e.g. `Frau Dr.`) are accepted case-insensitively and stored as the code. `ohne Anrede`, `none`, `unbekannt` or no value means no salutation: the letter then addresses the debtor by name only. Do not send `diverse` as a fallback, for couples or for companies; a couple (`Herr und Frau`) is rejected. An unrecognised `salutation` returns `400 VALIDATION_ERROR` with the accepted values. If your system calls the field `gender`, send it as `person.gender`: the same values are accepted, an unrecognised one is ignored, and it is read only when `salutation` is absent, `null` or empty.

Send your own customer number for the debtor as `partner_client_reference` and, for a business, its VAT ID as `company.uid`. A person whose name you hold in one field goes into `person.last_name` with `first_name` empty; such a case is checked by our case managers before the first letter goes out.

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST 'https://service.incaseof.law/openapi/debtors' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
>   -H 'Content-Type: application/json' \
>   -d '{
>     "customer_id": "CUSTOMER_ID",
>     "acting_as": "person",
>     "debtor_type": "privateperson",
>     "person": {
>       "salutation": "mr",
>       "first_name": "Max",
>       "last_name": "Mustermann"
>     },
>     "addresses": [{
>       "street": "Hauptstrasse 1",
>       "zip": "1010",
>       "city": "Wien",
>       "country": "AT",
>       "is_primary": true
>     }],
>     "communication_channels": [{
>       "type": "email",
>       "value": "max@example.com",
>       "is_primary": true
>     }]
>   }'
> ```

> [!NOTE]
>
> **Save the debtor ID**: You will need the `id` from the response when creating the claim.

***

## Step 4: Create a Claim with Customer ID

When creating a claim, pass the `customer_id` to link it to a partner's customer. This enables automatic revenue share tracking.

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST 'https://service.incaseof.law/openapi/claims' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
>   -H 'Content-Type: application/json' \
>   -d '{
>     "debtor_id": "DEBTOR_ID",
>     "customer_id": "CUSTOMER_ID"
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://service.incaseof.law/openapi/claims', {
>   method: 'POST',
>   headers: {
>     'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
>     'Content-Type': 'application/json'
>   },
>   body: JSON.stringify({
>     debtor_id: 'DEBTOR_ID',
>     customer_id: 'CUSTOMER_ID'
>   })
> })
>
> const data = await response.json()
> const claimId = data.data.id
> console.log('Claim created with customer link:', claimId)
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
>
> url = 'https://service.incaseof.law/openapi/claims'
> headers = {
>     'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
>     'Content-Type': 'application/json'
> }
>
> payload = {
>     'debtor_id': 'DEBTOR_ID',
>     'customer_id': 'CUSTOMER_ID'
> }
>
> response = requests.post(url, json=payload, headers=headers)
> claim = response.json()
> claim_id = claim['data']['id']
> print(f'Claim created: {claim_id}')
> ```

> [!WARNING]
>
> The `customer_id` is **required** for partner API tokens. It tells the system which organization this claim belongs to. Without it, the request will fail. You can update the `customer_id` on an existing claim via the update endpoint.

***

## Step 4b: Decide on the court step

When out-of-court collection is exhausted, the claim moves to `dunning_action_recommended` (you receive the webhook
`claim.collection_stage_changed`). The creditor decides whether to take the claim to court — through your integration:

1. [`GET /openapi/claims/{claim_id}/lawsuit-decision/estimate`](https://documentation.incaseof.law/api-reference/claims/estimate-lawsuit-decision) — the
   court fee, and whether a lawyer is required (Austria) or not allowed (Germany). `decision_open` is `true` while a
   decision can still be sent (the claim is at `dunning_action_recommended` or `dunning_action_filed`); once one is recorded (by you or by the creditor in the portal) it turns `false` and
   `decided` turns `true`.
2. [`POST /openapi/claims/{claim_id}/lawsuit-decision`](https://documentation.incaseof.law/api-reference/claims/create-lawsuit-decision) with
   `{ "decision": "sue" }` or `{ "decision": "decline" }`.

The court fee is invoiced to the **creditor**, at the e-mail address and postal address of the customer you created in
Step 2 — keep them current. It is never invoiced to you as the partner.

## Step 5: Automatic Revenue Sharing

When incaseof.law earns fees on a claim linked to a customer, the system automatically calculates the partner's commission based on those fees - not the payment amount.

No additional API calls are needed - revenue shares are created automatically.

### Revenue Share Statuses

| Status | Description |
| - | - |
| `pending` | Commission calculated, awaiting payout |
| `paid` | Commission has been paid to the partner |
| `cancelled` | Commission was cancelled (e.g. payment reversed) |

***

## Complete Partner Workflow Example

> [tab] JavaScript
>
> ```javascript theme={null}
> const API_BASE = 'https://service.incaseof.law/openapi'
> const API_TOKEN = 'YOUR_API_TOKEN_HERE'
>
> const headers = {
>   'Authorization': `Bearer ${API_TOKEN}`,
>   'Content-Type': 'application/json'
> }
>
> async function partnerWorkflow() {
>   // Step 1: Create a customer (automatically linked to your partner via API key)
>   const customerRes = await fetch(`${API_BASE}/customers`, {
>     method: 'POST',
>     headers,
>     body: JSON.stringify({
>       name: 'Acme Corporation',
>       email: 'billing@acme.com',
>       address: { street: 'Ringstrasse 10', zip: '1010', city: 'Wien', country: 'AT' }
>     })
>   })
>   const customer = await customerRes.json()
>   const customerId = customer.data.id
>   console.log('Customer created:', customerId)
>
>   // Step 2: Create a debtor (customer_id required for partner tokens)
>   const debtorRes = await fetch(`${API_BASE}/debtors`, {
>     method: 'POST',
>     headers,
>     body: JSON.stringify({
>       customer_id: customerId,
>       acting_as: 'person',
>       debtor_type: 'privateperson',
>       person: {
>         salutation: 'mr',
>         first_name: 'Max',
>         last_name: 'Mustermann'
>       },
>       addresses: [{
>         street: 'Hauptstrasse 1',
>         zip: '1010',
>         city: 'Wien',
>         country: 'AT',
>         is_primary: true
>       }],
>       communication_channels: [{
>         type: 'email',
>         value: 'max@example.com',
>         is_primary: true
>       }]
>     })
>   })
>   const debtor = await debtorRes.json()
>   const debtorId = debtor.data.id
>   console.log('Debtor created:', debtorId)
>
>   // Step 3: Create a claim linked to the customer and debtor
>   const claimRes = await fetch(`${API_BASE}/claims`, {
>     method: 'POST',
>     headers,
>     body: JSON.stringify({
>       debtor_id: debtorId,
>       customer_id: customerId
>     })
>   })
>   const claim = await claimRes.json()
>   console.log('Claim created:', claim.data.id)
>
>   // Step 4: Upload invoice and record payments as usual
>   // Revenue shares will be automatically created when payments are recorded
>
>   return {
>     customerId,
>     debtorId,
>     claimId: claim.data.id
>   }
> }
>
> partnerWorkflow()
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
>
> API_BASE = 'https://service.incaseof.law/openapi'
> API_TOKEN = 'YOUR_API_TOKEN_HERE'
>
> headers = {
>     'Authorization': f'Bearer {API_TOKEN}',
>     'Content-Type': 'application/json'
> }
>
> def partner_workflow():
>     # Step 1: Create a customer (automatically linked to your partner via API key)
>     customer_res = requests.post(f'{API_BASE}/customers', headers=headers, json={
>         'name': 'Acme Corporation',
>         'email': 'billing@acme.com',
>         'address': {'street': 'Ringstrasse 10', 'zip': '1010', 'city': 'Wien', 'country': 'AT'}
>     })
>     customer_id = customer_res.json()['data']['id']
>     print(f'Customer created: {customer_id}')
>
>     # Step 2: Create a debtor (customer_id required for partner tokens)
>     debtor_res = requests.post(f'{API_BASE}/debtors', headers=headers, json={
>         'customer_id': customer_id,
>         'acting_as': 'person',
>         'debtor_type': 'privateperson',
>         'person': {
>             'salutation': 'mr',
>             'first_name': 'Max',
>             'last_name': 'Mustermann'
>         },
>         'addresses': [{
>             'street': 'Hauptstrasse 1',
>             'zip': '1010',
>             'city': 'Wien',
>             'country': 'AT',
>             'is_primary': True
>         }],
>         'communication_channels': [{
>             'type': 'email',
>             'value': 'max@example.com',
>             'is_primary': True
>         }]
>     })
>     debtor_id = debtor_res.json()['data']['id']
>     print(f'Debtor created: {debtor_id}')
>
>     # Step 3: Create a claim linked to the customer and debtor
>     claim_res = requests.post(f'{API_BASE}/claims', headers=headers, json={
>         'debtor_id': debtor_id,
>         'customer_id': customer_id
>     })
>     claim_id = claim_res.json()['data']['id']
>     print(f'Claim created: {claim_id}')
>
>     # Step 4: Upload invoices and record payments as usual
>     # Revenue shares are automatically created when payments are recorded
>
>     return {
>         'customer_id': customer_id,
>         'debtor_id': debtor_id,
>         'claim_id': claim_id
>     }
>
> partner_workflow()
> ```

***

## Managing Customers

### List Customers

> [tab] cURL
>
> ```bash theme={null}
> curl -X GET 'https://service.incaseof.law/openapi/customers' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE'
> ```

### Update a Customer

> [tab] cURL
>
> ```bash theme={null}
> curl -X PATCH 'https://service.incaseof.law/openapi/customers/CUSTOMER_ID' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
>   -H 'Content-Type: application/json' \
>   -d '{
>     "name": "Updated Name",
>     "email": "new@email.com"
>   }'
> ```

### Delete a Customer

> [tab] cURL
>
> ```bash theme={null}
> curl -X DELETE 'https://service.incaseof.law/openapi/customers/CUSTOMER_ID' \
>   -H 'Authorization: Bearer YOUR_API_TOKEN_HERE'
> ```

***

## Next Steps

* Use the [Customer API](https://documentation.incaseof.law/api-reference/customers/create-customer.md) to create customers
* Link claims to customers using `customer_id` when [creating claims](https://documentation.incaseof.law/api-reference/claims/create-claim.md)
* Revenue shares are tracked automatically

Need help? Contact us at [info@incaseof.law](mailto:info@incaseof.law)


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