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

# Entität erstellen

> Registrieren Sie eine Person oder ein Unternehmen mit den minimalen KYC-Daten und dem primären Dokument – der erste Schritt eines KYC/KYB-Onboardings.

Dieser Leitfaden zeigt Ihnen, wie Sie eine Person und ein Unternehmen mit [Entität erstellen](https://docs.localpayment.com/de/reference/create-entity.md) registrieren. Die Entität wird ohne Dateien erstellt. Die Dateien laden Sie im nächsten Schritt hoch: [Dokumente und Nachweise hochladen](https://docs.localpayment.com/de/docs/upload-documents-and-proofs.md).

## Voraussetzungen

* Ein Zugriffstoken für Stage. Siehe [Zugriffstoken abrufen](https://docs.localpayment.com/de/reference/get-token.md).
* Der Entitätstyp: `INDIVIDUAL` für eine natürliche Person, `COMPANY` für eine juristische Person.
* Das Identifikationsdokument. Für eine Person: die Steuernummer (`CPF`, `CUIT`, `RFC`, `CURP`) oder ein Ausweisdokument (`DNI`, `PASSPORT`, `CC`). Für ein Unternehmen: die Steuernummer (`CNPJ`, `CUIT`, `RFC`, `RUC`, `NIT`). Es wird zum primären Dokument.
* Eine stabile `externalId`: Ihre eigene Referenz, die pro Händler eindeutig ist.
* Falls Localpayment benutzerdefinierte Felder für Ihr Händlerkonto konfiguriert hat, das zugehörige Schema. Siehe [Benutzerdefinierte Felder](https://docs.localpayment.com/de/docs/custom-fields.md).

## Welche Dokumente Sie angeben müssen

Ein Dokument ist eine ID, die beliebig viele Dateien enthalten kann, etwa Vorderseite, Rückseite und Selfie eines Ausweisdokuments. Senden Sie das Identifikationsdokument beim Erstellen der Entität in `document`: Es wird zum primären Dokument. Alle weiteren Dokumente geben Sie mit [Dokument hinzufügen](https://docs.localpayment.com/de/reference/add-entity-document.md) an. Das Paar `type` + `id` muss innerhalb Ihres Händlerkontos eindeutig sein.

| Typ | Primäres Dokument | Weitere Dokumente |
| - | - | - |
| `INDIVIDUAL` | Steuernummer oder Ausweisdokument (CPF, DNI, PASSPORT). Nachweise: FRONT, BACK, SELFIE. | PROOF\_OF\_ADDRESS sowie alle weiteren Belege (PROOF\_OF\_FUNDS, PAYSLIP, OTHER). |
| `COMPANY` | Steuernummer (CNPJ, CUIT, RFC, RUC, NIT). Nachweis: DOCUMENT. | ARTICLES\_OF\_INCORPORATION, PROOF\_OF\_ADDRESS. Eigentümer werden als INDIVIDUAL-Entitäten registriert und über [UBOs verwalten](https://docs.localpayment.com/de/docs/manage-ubos.md) verknüpft. |

Die vollständige Liste der Werte finden Sie unter [Dokument- und Nachweistypen](https://docs.localpayment.com/de/reference/entity-document-and-proof-types.md).

## Mindestangaben

| Typ | Von der API verlangt | Dringend empfohlen |
| - | - | - |
| `INDIVIDUAL` | externalId, type, name, lastname, document | birthdate, nationality, residenceCountry, email, phone, address |
| `COMPANY` | externalId, type, name, document | incorporationCountry, incorporationDate, legalRepresentativeName, website, email, phone, address |

Fehlen erforderliche KYC-Daten, wird 422 `INCOMPLETE_KYC_DATA` zurückgegeben.

## Person erstellen

```bash Request theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
curl -X POST https://api.stage.localpayment.com/api/entity/v1/entities \
  -H "Authorization: Bearer $LOCALPAYMENT_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Correlation-ID: 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10" \
  -d '{
    "externalId": "550e8400-e29b-41d4-a716-446655440000",
    "type": "INDIVIDUAL",
    "name": "Jane",
    "lastname": "Doe",
    "birthdate": "1990-01-15",
    "nationality": "BRA",
    "birthCountry": "BRA",
    "residenceCountry": "BRA",
    "isPep": false,
    "email": "jane.doe@example.com",
    "phone": {
      "countryCode": "55",
      "areaCode": "11",
      "number": "999990001"
    },
    "address": {
      "street": "Rua Exemplo",
      "number": "123",
      "city": "São Paulo",
      "state": "SP",
      "zipCode": "01310-100",
      "country": "BRA"
    },
    "document": {
      "type": "CPF",
      "id": "00000000000",
      "issuingCountry": "BRA"
    }
  }'
```

```json Response theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "internalId": "5aced5da-40c1-4bec-85ff-c8cd1bcb4526",
  "externalId": "550e8400-e29b-41d4-a716-446655440000",
  "type": "INDIVIDUAL",
  "status": "PENDING_KYC",
  "name": "Jane",
  "lastname": "Doe",
  "birthdate": "1990-01-15",
  "gender": null,
  "nationality": "BRA",
  "birthCountry": "BRA",
  "residenceCountry": "BRA",
  "occupation": null,
  "isPep": false,
  "incorporationDate": null,
  "incorporationCountry": null,
  "website": null,
  "legalRepresentativeName": null,
  "email": "jane.doe@example.com",
  "phone": {
    "countryCode": "55",
    "areaCode": "11",
    "number": "999990001"
  },
  "address": {
    "street": "Rua Exemplo",
    "city": "São Paulo",
    "state": "SP",
    "zipCode": "01310-100",
    "number": "123",
    "comment": null,
    "country": "BRA",
    "line2": null,
    "line3": null
  },
  "attributes": null,
  "documentationStatus": "NO_FILES",
  "document": {
    "documentId": "2e16d844-4fa9-4295-9a21-83ec32ef241a",
    "entityId": "5aced5da-40c1-4bec-85ff-c8cd1bcb4526",
    "type": "CPF",
    "id": "00000000000",
    "issuingCountry": "BRA",
    "issueDate": null,
    "expirationDate": null,
    "isPrimary": true,
    "status": "PENDING",
    "metadata": null,
    "proofs": [],
    "createdAt": "2024-01-15T17:03:10Z",
    "updatedAt": "2024-01-15T17:03:10Z"
  },
  "documents": [],
  "version": 0,
  "createdAt": "2024-01-15T17:03:10Z",
  "updatedAt": "2024-01-15T17:03:10Z",
  "customFieldSchemaVersion": null
}
```

Die Antwort lautet 201 Created mit dem Header `ETag: "0"`.

Speichern Sie `internalId` (die Entität) und `document.documentId` (das primäre Dokument). Beide werden in den nächsten Schritten benötigt.

## Unternehmen erstellen

Ein Unternehmen mit seiner Steuernummer als primärem Dokument, einer Adresse mit zusätzlichen Zeilen und benutzerdefinierten Feldern:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "externalId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "type": "COMPANY",
  "name": "Example Company S.A.",
  "incorporationCountry": "BRA",
  "incorporationDate": "2020-01-15",
  "website": "https://www.example.com",
  "email": "test@example.com",
  "phone": {
    "countryCode": "55",
    "areaCode": "11",
    "number": "999990000"
  },
  "legalRepresentativeName": "Jane Doe",
  "isPep": false,
  "address": {
    "street": "Rua Exemplo",
    "number": "100",
    "city": "São Paulo",
    "state": "SP",
    "zipCode": "01310-100",
    "country": "BRA",
    "line2": "Sala 100",
    "line3": "Torre A"
  },
  "document": {
    "type": "CNPJ",
    "id": "00000000000100",
    "issuingCountry": "BRA"
  },
  "attributes": {
    "reasonForAccountOpening": "receive_payments_for_goods_and_services",
    "sourceOfFundsAndIncome": "sales_of_goods_and_services",
    "numberOfEmployees": "11-50",
    "estimatedAnnualRevenueUsd": "1m_to_10m",
    "estimatedMonthlyVolumeUsd": "50000",
    "businessActivityDescription": "Online retail of home goods. Receives payments from end customers in Brazil via PIX.",
    "countryTaxResidence": "BRA",
    "socialMedia": "https://www.linkedin.com/company/example",
    "emailPixKey": "test@example.com"
  }
}
```

## Fehler in Ihrer Integration behandeln

```python theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
import os
import uuid
import requests

BASE_URL = "https://api.stage.localpayment.com/api/entity"
access_token = os.environ["LOCALPAYMENT_ACCESS_TOKEN"]

payload = {
    "externalId": "550e8400-e29b-41d4-a716-446655440000",
    "type": "INDIVIDUAL",
    "name": "Jane",
    "lastname": "Doe",
    "document": {"type": "CPF", "id": "00000000000", "issuingCountry": "BRA"},
}

response = requests.post(
    f"{BASE_URL}/v1/entities",
    json=payload,
    headers={
        "Authorization": f"Bearer {access_token}",
        "X-Correlation-ID": str(uuid.uuid4()),
    },
    timeout=30,
)

if response.status_code == 201:
    entity = response.json()
    entity_id = entity["internalId"]
    primary_document_id = entity["document"]["documentId"]
else:
    problem = response.json()  # application/problem+json
    code = problem.get("code")
    if code == "DUPLICATE_ENTITY":
        # Already registered: look it up with GET /v1/entities?externalId=...
        pass
    elif code in ("VALIDATION_ERROR", "CUSTOM_FIELDS_INVALID"):
        for detail in problem.get("details", []):
            print(f"{detail['field']}: {detail['issue']}")
    else:
        # Quote the correlation id when you contact support
        print(f"{response.status_code} {code} correlationId={problem.get('correlationId')}")
```

## Häufige Fehler

| Fehler | Ursache | Lösung |
| - | - | - |
| 400 VALIDATION\_ERROR | Unbekannte Eigenschaft, Ländercode mit zwei Buchstaben, eine Liste documents statt document oder kein Dokument. | Prüfen Sie das in jedem Eintrag von details genannte Feld. Verschieben Sie zusätzliche Daten nach attributes. |
| 400 CUSTOM\_FIELDS\_INVALID | attributes entspricht nicht dem Schema der benutzerdefinierten Felder. | Lesen Sie das Schema und korrigieren Sie das in details genannte Feld. |
| 409 DUPLICATE\_ENTITY | externalId oder eine Kombination aus Dokument-type + id wird in Ihrem Händlerkonto bereits verwendet. | Verwenden Sie die bestehende Entität. Sie finden sie mit [Entitäten auflisten](https://docs.localpayment.com/de/reference/list-entities.md). |
| 422 INCOMPLETE\_KYC\_DATA | Minimale KYC-Daten fehlen. | Ergänzen Sie name und lastname (Person) bzw. name (Unternehmen). |

Beispiel für einen Validierungsfehler bei benutzerdefinierten Feldern:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "type": "about:blank",
  "title": "Validation error",
  "status": 400,
  "detail": "Validation error",
  "instance": "/api/entity/v1/entities",
  "code": "CUSTOM_FIELDS_INVALID",
  "correlationId": "fff39bf8-1cb2-40c7-ac99-37478d819943",
  "details": [
    {
      "field": "numberOfEmployees",
      "issue": "NOT_IN_OPTIONS"
    },
    {
      "field": "legacyNote",
      "issue": "UNKNOWN_FIELD"
    }
  ]
}
```

> [!WARNING]
>
> Eine Steuernummer (`CPF`, `CNPJ`, `CUIT`, `RFC`) ist ein Dokument und kein Feld der Entität. Senden Sie sie in `document`. Ländercodes müssen dem Format ISO 3166-1 Alpha-3 entsprechen (`BRA`, nicht `BR`).

## Nächste Schritte

> [card] [Dokumente und Nachweise hochladen](https://docs.localpayment.com/de/docs/upload-documents-and-proofs.md)
>
> Hängen Sie die Dateien an, die jedes angegebene Dokument belegen.

> [card] [Referenz: Entität erstellen](https://docs.localpayment.com/de/reference/create-entity.md)
>
> Alle Anfragefelder, Antwortfelder und Fehlercodes.


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