Create customer

POST {{baseUrl}}/customers

Creates a new customer.

A customer represents the contract relation of an entity with Tangany and has exactly one owning entity and at least one authorized entity.

The owner is the contract partner while authorized entities are allowed to act on behalf of the owner. In most cases the owner is also an authorized entity.

Example request: ```http-client POST https://api.tangany.com/customers/customers

{ id: c3bd5c49-b7c2-480f-b1bc-2f80e77edb2d, contracts: [ { type: standard, signedDate: 2022-10-18, cancelledDate: null } ], owner: { entityId: aa2d0d28-79e3-433c-a249-44bf65f5c8ed }, authorized: [ { entityId: aa2d0d28-79e3-433c-a249-44bf65f5c8ed } ] } ```

Restrictions

This endpoint executes additional validation logic to enforce context-dependent restrictions.

The following is a list of enforced restrictions. The server responds with 422 Unprocessable entity error with a custom error code:

Example error response:

{
    "statusCode": 422,
    "activityId": "efdc8732-8572-4240-9cff-4466100adea3",
    "message": "Referenced entity has not been provided with sufficient data to be used in the requested context",
    "errorCode": "entity_data_insufficient",
    "details": {
      "entityId": "490f4b22-42ad-4578-81a9-81d5f28403f1",
      "missingData": [
        "address",
        "kyc"
      ]
    }
}

Enforced restrictions

  • Restrictions for natural persons:

    • Owner/Authorized entity must contain sufficient data (entity_data_insufficient)

    Following optional properties become required when relating a person to a customer:

    nationality
    address
    kyc (Not required for owners under 18 years old)
    
    • All authorized entities must be over 18 years old (entity_must_be_an_adult)
  • Restrictions for legal entities:

    • No restrictions
  • Restrictions for partnership entities:

    • At least two members are required. (entity_data_insufficient)
  • Restrictions on contracts:

    • Only the contracts provided by Tangany can be used. Contracts must be created by Tangany support beforehand. Without existing contracts, customer creation will be blocked. Please contact via support@tangany.com if this is not available.
    • The signed date of the contract must be past the validity date of the contract (see property contractValidFrom)
    • A contract can only be signed once per customer and no contract can be removed once assigned.
    • Additionally, the kyc data should not be older than 24 months before the contract signed date and the kyc document must be valid past this date.

Note that after creating a customer, the referenced entities cannot be updated in an invalid way.

Invalid updates to referenced entities will result in a existing_constraints_violated error:

{
  "statusCode": 422,
  "activityId": "4a9120ed-8abb-4ef9-996b-b38296415fd9",
  "message": "Update violates existing constraints of other resources",
  "errorCode": "existing_constraints_violated",
  "details": {
    "errorCode": "entity_data_insufficient",
    "missingData": [
      "address"
    ]
  }
}

Allowed roles : EDITOR and CREATOR

Request Body

{"id"=>"{{$guid}}", "contracts"=>[{"type"=>"standard", "signedDate"=>"2012-10-11T01:57:00.766Z", "cancelledDate"=>"2040-02-01", "additionalAttributes"=>{"Lorem_41"=>"et elit nulla non", "deserunt_d01"=>"id in aliquip laborum"}}], "owner"=>{"entityId"=>"{{entity-id}}"}, "authorized"=>[{"entityId"=>"{{entity-id}}"}]}

HEADERS

KeyDatatypeRequiredDescription
tangany-versionnumber(Required) API version
Content-Typestring
Acceptstring
_tangany-datastring

RESPONSES

status: OK

{"authorized":[{"entityId":"in aliqua"},{"entityId":"aliq"}],"contracts":[{"type":"standard","signedDate":"1960-05-25T17:31:40.794Z","cancelledDate":"1955-10-03T11:10:20.034Z","additionalAttributes":{"amet_f9":"Ut consequat ipsum","consequat_e8":"do labore Ut"}}],"id":"78c483d7-5e6d-488b-981c-2ac4bccca2a5","owner":{"entityId":"proident enim nisi aliqua a"},"reason":null,"status":"suspended","additionalAttributes":{"eae":"enim ","non89":"dolor adipisicing ex ut","labore_477":"Ut dolor","laboris_cf8":"elit incididunt"}}