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

# Create debtor

> Create a new debtor in your organisation (partner keys: in the organisation of `customer_id`, which is
required).

**Name mapping**:
- A natural person: `acting_as: person`, `debtor_type: privateperson`, and the name split into
  `person.first_name` and `person.last_name` (not the whole name in `last_name`). `salutation` only when known.
- **Salutation**: `mr` (Herr), `mrs` (Frau), `diverse` (Divers); German and English spellings such as `Herr`,
  `Frau`, `male`, `female`, `m`, `w`, `f`, `d` are accepted case-insensitively and stored as the code, also when
  sent as `person.gender`. Unknown gender → leave it out (no salutation; `diverse` is not a fallback). An
  unrecognised value is a `400` listing the accepted ones — see `SalutationInput`.
- A company: `acting_as: company`, `debtor_type: protocolled_company` (registered in the Firmenbuch) or
  `unprotocolled_company`, and the name in `company.company_name`.
- A debtor sent as `privateperson` whose name carries the legal form of an entity registered in the
  Firmenbuch (GmbH, AG, eGen, SE, SCE, EWIV, Sparkasse, Versicherungsverein, OG, KG, e.U.) is stored as a
  `protocolled_company` with that name; the response returns the stored debtor.
- If you only hold the name in one field, send it in `person.last_name` and leave `first_name` empty. A case
  whose debtor is a `privateperson` without a first name is checked by our case managers (person or business,
  name split) before the first letter goes out.

**Your keys**: `company.uid` (the business's EU VAT ID) and `partner_client_reference` (your own customer
number for the debtor) are stored and returned by the `/openapi/debtors` endpoints. They are not used to find
an existing debtor: every `POST` creates a new one.

`iban`, `bic` and `person.salutation` may be `null` (= not given).




## OpenAPI

````yaml post /openapi/debtors
openapi: 3.0.3
info:
  title: incaseof.law Partner API
  version: 1.0.0
  description: >
    The incaseof.law partner API (`/openapi/*`): create claims and debtors,
    attach invoices and documents, record

    payments, follow a claim through collection and take the judicial-step
    decision.


    This document is the contract the API is tested against: every path, request
    body and response field here is

    compared with the implementation on each change. A field that is not listed
    here is not part of the API.


    ## Authentication


    Every `/openapi` request carries `Authorization: Bearer <api key>`. API keys
    are opaque strings starting with

    `ico_live_` (not JWTs). Request a key at https://app.incaseof.law/openapi;
    incaseof.law reviews the request and

    sends the key by e-mail.


    - **Organisation keys** act for one creditor organisation.

    - **Partner keys** act for a partner (software vendor, reseller) and its
    customers. Requests that create a claim
      or a debtor name the customer with `customer_id`; reads and updates reach every object of the partner's own
      customers without it. A `customer_id` that does not exist answers `400`, one of another partner `403`.

    ## Errors


    Every error answers `{ "success": false, "message": "…" }`, some with an
    `error` code. Validation errors list the

    failed fields in `details` (see `BadRequest`). Every response carries the
    rate-limit headers (see

    `TooManyRequests`).


    ## Partner intake rules


    Some partner agreements require more than the API's own required fields, and
    some prohibit data. They apply to

    partner keys only, are set per partner account by incaseof.law, and are
    checked **before anything is stored** — a

    refused request leaves no claim, invoice, PDF, payment, document or customer
    behind.


    - **Required fields.** The fields marked *optional unless your partner
    agreement requires it* exist for every
      caller. When your agreement requires one, a request without it answers `400` naming each missing field
      (`"message": "default_date required"`, one `details` entry per field). They are checked on creation only: on
      `POST /openapi/claims` (`creditor_confirmation`), both invoice endpoints (`default_date`,
      `creditor_reminder_dates` — not with `default_basis: bgb_286_3` —, `contract_date`, `subject`),
      `POST /openapi/debtors` (`legal_representative`) and `POST /openapi/customers` (`legal_form`,
      `legal_representative` — `owner` for a sole trader —, `billing_email`, `payout_account`, `vat_deductible`).
    - **Prohibited data (health data).** When your agreement prohibits health
    data, these free-text fields are checked:
      invoice `subject` (on the PDF upload also `description`), `invoice_issuer`, `invoice_recipient`; payment `notes`;
      document `description`; customer `metadata`. A value that looks like a health insurance number (KVNR: a capital
      letter and nine digits), an institution code (IK: a nine-digit number on its own), the word `PZN`, `Pflegegrad`,
      `Diagnose`, the word `ICD` or an ICD code with its dot (`F32.1`) answers `400` with
      `"error": "PROHIBITED_DATA"` and the field in `details` (the value is never echoed). Use neutral wording, e.g.
      "Privatärztliche Leistung vom 01.09.2026".

    ## Webhooks


    incaseof.law can push events to a partner-controlled HTTPS endpoint whenever
    a claim's lifecycle changes:

    `claim.collection_stage_changed` and `claim.status_changed`. See the
    **Webhooks** section at the bottom of this

    document for the payload shape, header reference, signature scheme and retry
    policy.
servers:
  - url: https://service.incaseof.law
    description: Production API
  - url: https://sandbox.incaseof.law
    description: Partner sandbox (test data only, sandbox keys — see "Partner sandbox")
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Service availability
  - name: Claims
    description: Claims, their status and the judicial-step decision
  - name: Debtors
    description: Debtors of your claims
  - name: Invoices
    description: The invoices a claim is based on
  - name: Payments
    description: Payments the debtor made
  - name: Documents
    description: Supporting documents of a claim
  - name: Customers
    description: A partner's customers (the creditors it works for)
paths:
  /openapi/debtors:
    post:
      tags:
        - Debtors
      summary: Create debtor
      description: >
        Create a new debtor in your organisation (partner keys: in the
        organisation of `customer_id`, which is

        required).


        **Name mapping**:

        - A natural person: `acting_as: person`, `debtor_type: privateperson`,
        and the name split into
          `person.first_name` and `person.last_name` (not the whole name in `last_name`). `salutation` only when known.
        - **Salutation**: `mr` (Herr), `mrs` (Frau), `diverse` (Divers); German
        and English spellings such as `Herr`,
          `Frau`, `male`, `female`, `m`, `w`, `f`, `d` are accepted case-insensitively and stored as the code, also when
          sent as `person.gender`. Unknown gender → leave it out (no salutation; `diverse` is not a fallback). An
          unrecognised value is a `400` listing the accepted ones — see `SalutationInput`.
        - A company: `acting_as: company`, `debtor_type: protocolled_company`
        (registered in the Firmenbuch) or
          `unprotocolled_company`, and the name in `company.company_name`.
        - A debtor sent as `privateperson` whose name carries the legal form of
        an entity registered in the
          Firmenbuch (GmbH, AG, eGen, SE, SCE, EWIV, Sparkasse, Versicherungsverein, OG, KG, e.U.) is stored as a
          `protocolled_company` with that name; the response returns the stored debtor.
        - If you only hold the name in one field, send it in `person.last_name`
        and leave `first_name` empty. A case
          whose debtor is a `privateperson` without a first name is checked by our case managers (person or business,
          name split) before the first letter goes out.

        **Your keys**: `company.uid` (the business's EU VAT ID) and
        `partner_client_reference` (your own customer

        number for the debtor) are stored and returned by the `/openapi/debtors`
        endpoints. They are not used to find

        an existing debtor: every `POST` creates a new one.


        `iban`, `bic` and `person.salutation` may be `null` (= not given).
      operationId: createDebtor
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDebtorInput'
            examples:
              person:
                summary: Person (organisation key)
                value:
                  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
              personPartner:
                summary: Person (partner key)
                value:
                  customer_id: c5d6e7f8-0000-0000-0000-000000000000
                  acting_as: person
                  debtor_type: privateperson
                  person:
                    first_name: Max
                    last_name: Mustermann
                    salutation: null
                  iban: null
              company:
                summary: Company
                value:
                  acting_as: company
                  debtor_type: protocolled_company
                  company:
                    company_name: ACME GmbH
                    firmenbuchnummer: FN123456a
                  addresses:
                    - street: Industriestrasse 2
                      zip: '80331'
                      city: München
                      country: DE
              companyWithKeys:
                summary: Company with UID and your customer number (partner key)
                value:
                  customer_id: c5d6e7f8-0000-0000-0000-000000000000
                  acting_as: company
                  debtor_type: unprotocolled_company
                  company:
                    company_name: Installateur Huber
                    uid: ATU12345678
                  partner_client_reference: '4711'
                  addresses:
                    - street: Hauptplatz 3
                      zip: '8010'
                      city: Graz
                      country: AT
      responses:
        '201':
          description: Debtor created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseDebtor'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateDebtorInput:
      type: object
      required:
        - acting_as
        - debtor_type
      properties:
        acting_as:
          type: string
          enum:
            - person
            - company
        debtor_type:
          type: string
          enum:
            - privateperson
            - protocolled_company
            - unprotocolled_company
        customer_id:
          type: string
          format: uuid
          description: >-
            Partner keys — required; the customer the debtor belongs to.
            Organisation keys — optional.
        iban:
          type: string
          nullable: true
        bic:
          type: string
          nullable: true
        person:
          type: object
          required:
            - first_name
            - last_name
          properties:
            first_name:
              type: string
            last_name:
              type: string
            salutation:
              $ref: '#/components/schemas/SalutationInput'
            gender:
              type: string
              enum:
                - mr
                - mrs
                - diverse
                - ''
              nullable: true
              description: >
                Alias of `salutation` for systems that call the field gender —
                same accepted spellings. Read only when

                `salutation` is absent, `null` or `""` (a `salutation` of "ohne
                Anrede" wins); an unrecognised gender is

                ignored (no salutation), never a 400.
            birth_date:
              type: string
        company:
          type: object
          required:
            - company_name
          properties:
            company_name:
              type: string
            firmenbuchnummer:
              type: string
            not_protocolled:
              type: boolean
              description: The company is not registered in the Firmenbuch
            uid:
              type: string
              maxLength: 40
              nullable: true
              description: >
                EU VAT ID (UID) of the business, e.g. ATU12345678 — same rules
                as a customer's `uid`: spaces and the

                separators - . / are removed and letters uppercased; then a
                2-letter country prefix plus 2–12 characters

                (otherwise 400). null is treated as not given.
              example: ATU12345678
        partner_client_reference:
          type: string
          maxLength: 255
          nullable: true
          description: >-
            Your own customer number for this debtor. Trimmed; stored and
            returned, not matched. null is treated as not given.
          example: '4711'
        legal_representative:
          $ref: '#/components/schemas/DebtorLegalRepresentative'
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/AddressInput'
        communication_channels:
          type: array
          items:
            $ref: '#/components/schemas/CommunicationChannelInput'
    ApiResponseDebtor:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/DebtorWithKeys'
    SalutationInput:
      type: string
      enum:
        - mr
        - mrs
        - diverse
        - ''
      nullable: true
      description: >
        Salutation of the person, stored as `mr` (Herr), `mrs` (Frau) or
        `diverse` (Divers). Other common spellings are

        accepted, case-insensitive, and stored as the code:

        - `mr`: Herr, Herrn, Hr., male, männlich, m, Mr. (also followed by
        academic titles, e.g. "Herr Mag.")

        - `mrs`: Frau, Fr., female, weiblich, ms, f, w, Mrs. (also followed by
        academic titles, e.g. "Frau Dr.")

        - `diverse`: divers, d, x, other


        Omitted, `null`, `''`, `none`, `ohne Anrede`, `keine Angabe` or
        `unbekannt` means no salutation (the letter

        addresses the debtor by name only). Send `diverse` only when the person
        is diverse — not as a fallback for an

        unknown gender, and not for couples or companies — "Herr und Frau" is
        rejected. Any other value is rejected with

        `400 VALIDATION_ERROR`, the message lists the accepted values.
      example: mrs
    DebtorLegalRepresentative:
      type: object
      description: >
        The debtor's legal guardian (Betreuer, Vormund) or attorney
        (Bevollmächtigter), where one exists. Send it only

        then — a debtor without one is sent without this object.
      required:
        - type
        - name
      properties:
        type:
          type: string
          enum:
            - guardian
            - attorney
            - other
        name:
          type: string
          minLength: 1
          maxLength: 200
        address:
          type: object
          required:
            - street
            - zip
            - city
            - country
          properties:
            street:
              type: string
            zip:
              type: string
            city:
              type: string
            country:
              $ref: '#/components/schemas/CountryCode'
        email:
          type: string
          format: email
        phone:
          type: string
          maxLength: 50
    AddressInput:
      type: object
      required:
        - street
        - zip
        - city
        - country
      properties:
        street:
          type: string
        zip:
          type: string
        city:
          type: string
        country:
          $ref: '#/components/schemas/CountryCode'
        is_primary:
          type: boolean
    CommunicationChannelInput:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - email
            - phone
        value:
          type: string
          description: >
            An e-mail address, or a phone number of at least 6 digits (digits,
            spaces, +, -, ( and ) only).
          example: contact@example.com
        is_primary:
          type: boolean
          default: false
    DebtorWithKeys:
      description: >-
        A debtor as the `/openapi/debtors` endpoints return it — with your keys
        for it.
      allOf:
        - $ref: '#/components/schemas/Debtor'
        - type: object
          properties:
            company:
              nullable: true
              allOf:
                - $ref: '#/components/schemas/DebtorCompany'
                - type: object
                  properties:
                    uid:
                      type: string
                      nullable: true
                      description: EU VAT ID (UID) of the business, normalised
            partner_client_reference:
              type: string
              nullable: true
              description: Your own customer number for this debtor
            legal_representative:
              nullable: true
              description: >-
                The debtor's legal guardian or attorney as you sent it; `null`
                when none.
              allOf:
                - $ref: '#/components/schemas/DebtorLegalRepresentative'
    CountryCode:
      type: string
      description: Country (ISO 3166-1 alpha-2)
      enum:
        - AF
        - AL
        - DZ
        - AD
        - AO
        - AG
        - AR
        - AM
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BT
        - BO
        - BA
        - BW
        - BR
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - CV
        - CF
        - TD
        - CL
        - CN
        - CO
        - KM
        - CG
        - CD
        - CR
        - HR
        - CU
        - CY
        - CZ
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - ET
        - FJ
        - FI
        - FR
        - GA
        - GM
        - GE
        - DE
        - GH
        - GR
        - GD
        - GT
        - GN
        - GW
        - GY
        - HT
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IR
        - IQ
        - IE
        - IL
        - IT
        - CI
        - JM
        - JP
        - JO
        - KZ
        - KE
        - KI
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MK
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MR
        - MU
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - NZ
        - NI
        - NE
        - NG
        - KP
        - 'NO'
        - OM
        - PK
        - PW
        - PS
        - PA
        - PG
        - PY
        - PE
        - PH
        - PL
        - PT
        - QA
        - RO
        - RU
        - RW
        - KN
        - LC
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SK
        - SI
        - SB
        - SO
        - ZA
        - KR
        - SS
        - ES
        - LK
        - SD
        - SR
        - SZ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TZ
        - TH
        - TL
        - TG
        - TO
        - TT
        - TN
        - TR
        - TM
        - TV
        - UG
        - UA
        - AE
        - GB
        - US
        - UY
        - UZ
        - VU
        - VA
        - VE
        - VN
        - YE
        - ZM
        - ZW
    Debtor:
      type: object
      properties:
        id:
          type: string
          format: uuid
        customer_id:
          type: string
          format: uuid
          nullable: true
        acting_as:
          type: string
          enum:
            - person
            - company
        debtor_type:
          type: string
          enum:
            - privateperson
            - protocolled_company
            - unprotocolled_company
        person:
          type: object
          nullable: true
          properties:
            salutation:
              type: string
              enum:
                - mr
                - mrs
                - diverse
              nullable: true
            first_name:
              type: string
            last_name:
              type: string
            birth_date:
              type: string
              nullable: true
        company:
          $ref: '#/components/schemas/DebtorCompany'
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/Address'
        communication_channels:
          type: array
          items:
            $ref: '#/components/schemas/CommunicationChannel'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    DebtorCompany:
      type: object
      nullable: true
      properties:
        company_name:
          type: string
        firmenbuchnummer:
          type: string
          nullable: true
        not_protocolled:
          type: boolean
    Address:
      type: object
      properties:
        id:
          type: string
          format: uuid
        street:
          type: string
        zip:
          type: string
        city:
          type: string
        country:
          $ref: '#/components/schemas/CountryCode'
        is_primary:
          type: boolean
    CommunicationChannel:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - email
            - phone
        value:
          type: string
        is_primary:
          type: boolean
  responses:
    BadRequest:
      description: >
        The request is invalid. A body that fails validation answers `error:
        VALIDATION_ERROR` with one entry per

        problem in `details` (`path` — the field, as a list of keys and indexes;
        `message`; `code`). Other `400`s carry

        only `message`.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: VALIDATION_ERROR
              message:
                type: string
                example: Validation failed
              details:
                type: array
                items:
                  type: object
                  properties:
                    path:
                      type: array
                      items:
                        oneOf:
                          - type: string
                          - type: integer
                    message:
                      type: string
                    code:
                      type: string
                      example: invalid_type
          examples:
            validationError:
              value:
                success: false
                error: VALIDATION_ERROR
                message: Validation failed
                details:
                  - code: invalid_type
                    expected: string
                    received: undefined
                    path:
                      - invoice_number
                    message: Required
            businessRule:
              value:
                success: false
                message: >-
                  Payment invoice number must match an active collection letter
                  or cost invoice. Active document numbers: ICO-2026-000123
    Unauthorized:
      description: The `Authorization` header is missing, or the key is invalid or expired.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: Unauthorized
              message:
                type: string
                example: >-
                  Invalid API token. Please check your token or request a new
                  one.
    Forbidden:
      description: >-
        The key may not do this — for example a `customer_id` of another
        partner.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: Forbidden
              message:
                type: string
                example: This customer does not belong to your partner account.
    TooManyRequests:
      description: >
        The key's hourly limit is used up — every `/openapi` request can answer
        this. Requests are counted per key and

        clock hour (UTC); the limit is agreed per key (default 1 000 per hour).
        Retry after `Retry-After` seconds.

        Every answer — not only this one — carries `X-RateLimit-Limit`,
        `X-RateLimit-Remaining` and `X-RateLimit-Reset`.
      headers:
        Retry-After:
          description: Seconds until the next hour starts and requests are admitted again.
          schema:
            type: integer
            example: 1260
        X-RateLimit-Limit:
          description: Requests allowed per hour for this key.
          schema:
            type: integer
            example: 1000
        X-RateLimit-Remaining:
          description: Requests left in the current hour (0 here).
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Unix time (seconds) at which the count starts again.
          schema:
            type: integer
            example: 1790002800
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: Too Many Requests
              message:
                type: string
                example: >-
                  Rate limit exceeded. Your limit is 1000 requests per hour.
                  Please try again later.
              details:
                type: object
                properties:
                  limit:
                    type: integer
                    example: 1000
                  window:
                    type: string
                    example: 1 hour
                  resets_at:
                    type: string
                    format: date-time
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
                example: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key (`ico_live_…`), sent as `Authorization: Bearer <key>`. Not a
        JWT.

````

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