# Create Data Mapper Definition

Create a Data Mapper Definition which is used to map data (i.e. in the format from the database) to the CDQ data model.
Data mapper definition consists of:
* `inputMapping` - definition how to map `businessPartner.record` to CDQ data model
* `outputMapping` - definition how to map CDQ data model to the target model

Business partner can be mapped via `businessPartnerAttributeMappings`.
The following values of [attribute mapping rules](https://developer.cdq.com/apis/data-exchange-api/api-v5/data-mapping/paths/~1datamapperdefinitions/post):
- as targetAttributes for inputMapping
- as sourceAttributes for outputMapping (please remember they are case sensitive)

can be mapped to Business Partner attributes:
- businessPartner.dataSource
- businessPartner.externalId
- businessPartner.disclosed - special attribute. When defined in a mapping, takes over the decision for disclosing records in data source this Data Mapper Definition is assigned to. When source attribute is mapped from record, the mapping takes the value. If the attribute is missing, disclosed is set to false.
- businessPartner.names[0-10].value
- businessPartner.names[0-10].shortName
- businessPartner.names[0-10].language
- businessPartner.names[0-10].type
- businessPartner.names
- businessPartner.legalForm.name
- businessPartner.legalForm.categories[0-4].technicalKey
- businessPartner.categories
- businessPartner.identifiers[0-49].value
- businessPartner.identifiers[0-49].type
- businessPartner.identifiers[0-49].issuingBody.name
- businessPartner.identifiers[0-49].issuingBody - mapped to issuingBody.technicalKey
- businessPartner.identifiers[0-49].status
- businessPartner.identifiers
- businessPartner.externalContext.identifiers[0-49].value
- businessPartner.externalContext.identifiers[0-49].type
- businessPartner.externalContext.identifiers

The index of typed concepts: names and identifiers, is not a final position of concept in the CDQ data model - this is a grouping indicator for a set of concept properties.
In Names mapping, in case none of names is typed `LOCAL`.
and exists any name with empty type or not filled type.technicalKey, it becomes name of type LOCAL.
Addresses can be mapped via `addressesAttributeMappings`. Address receives `id` property coming from an index of the collection of AttributeMappingRules.
The following values of [attribute mapping rules](https://developer.cdq.com/apis/data-exchange-api/api-v5/data-mapping/paths/~1datamapperdefinitions/post)
- as targetAttributes for inputMapping
- as sourceAttributes for outputMapping

can be mapped to address attributes:
- address.externalId
- address.version.language
- address.version.characterSet
- address.careOf.value
- address.identifyingName.value
- address.country.value
- address.country.shortName
- address.administrativeAreas
- address.administrativeAreas[0-4].value
- address.administrativeAreas[0-4].shortName
- address.administrativeAreas[0-4].type
- address.postCodes
- address.postCodes[0-4].value
- address.postCodes[0-4].type
- address.localities
- address.localities[0-4].value
- address.localities[0-4].shortName
- address.localities[0-4].type
- address.thoroughfares
- address.thoroughfares[0-4].value
- address.thoroughfares[0-4].shortName
- address.thoroughfares[0-4].number
- address.thoroughfares[0-4].type
- address.premises
- address.premises[0-4].value
- address.premises[0-4].shortName
- address.premises[0-4].number
- address.premises[0-4].type
- address.postalDeliveryPoints
- address.postalDeliveryPoints[0-4].value
- address.postalDeliveryPoints[0-4].shortName
- address.postalDeliveryPoints[0-4].number
- address.postalDeliveryPoints[0-4].type
- address.geographicCoordinates.latitude
- address.geographicCoordinates.longitude
- address.contexts
- address.contexts[0-4]

Endpoint: POST /datamapperdefinitions
Version: 5
Security: apiKey

## Security:

  - `apiKey` (unknown)
    apiKey in header X-API-KEY

## Request body:

  - `application/json` (unknown)
    Request to create a new Data Mapper Definition.

## Request fields (application/json):

  - `name` (string, required)
    Name of the Data Mapper Definition.
    Example: Custom Data Mapper Definition

  - `labels` (array)
    Labels to categorize the Data Mapper Definition.

  - `shareWithOrganization` (boolean)
    Toggle to enable that the Data Mapper Definition is shared with the whole organization.
    Example: true

  - `valueMappings` (array)
    List of value mappings.

  - `valueMappings.sourceValue` (string)
    The source value for a value mapping.
    Example: en

  - `valueMappings.targetValue` (string)
    The target value for a value mapping.
    Example: INTERNATIONAL

  - `valueMappings.targetAttribute` (string)
    The target attribute value (Business Partner or address) in the CDQ data model.
    Example: address.version.characterSet

  - `inputMapping` (object, required)
    Maps Business Partner data from raw data to the CDQ data model.

  - `inputMapping.businessPartnerAttributeMappings` (array)
    List of Business Partner Attribute Mappings.

  - `inputMapping.businessPartnerAttributeMappings.sourceConstant` (string)
    Assigns a fixed value at the path defined in targetAttributes.
    Example: LOCAL

  - `inputMapping.businessPartnerAttributeMappings.sourceAttributes` (array)
    List of source attributes.

  - `inputMapping.businessPartnerAttributeMappings.targetAttributes` (array)
    List of target attributes.

  - `inputMapping.businessPartnerAttributeMappings.targetAttributeTypes` (array)
    List of target attribute types.

  - `inputMapping.businessPartnerAttributeMappings.countryScopes` (array)
    List of country scopes.

  - `inputMapping.businessPartnerAttributeMappings.selectionType` (string)
    Defines how attribute values should be concatenated.
    Enum: "COMMA", "EMPTY", "HYPHEN", "SEMICOLON", "SPACE", "XOR"

  - `inputMapping.businessPartnerAttributeMappings.separationType` (string)
    Define how the source value should be separated.
    Enum: "LENGTH"

  - `inputMapping.businessPartnerAttributeMappings.isMandatoryAttribute` (boolean)
    Define if the attribute is mandatory or optional.
If `true`, the attribute is mandatory.
If `false`, the attribute is optional.
    Example: true

  - `inputMapping.businessPartnerAttributeMappings.valueMapping` (string)
    Maps a cons from raw data to the CDQ data model.
    Example: INTERNATIONAL

  - `inputMapping.businessPartnerAttributeMappings.defaultValue` (string)
    Defines default values applied for fields, for which no value was provided.
    Example: GB

  - `inputMapping.businessPartnerAttributeMappings.transformations` (array)
    List of transformations.

  - `inputMapping.businessPartnerAttributeMappings.transformations.type` (string)
    Define the Transformation Type.
    Enum: "UPPER_CASE", "LOWER_CASE"

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters` (array)
    Depending on the Transformation Type different parameters can be given.

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters.key` (string)
    Transformation parameter key.
    Example: transformationName

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters.value` (string)
    Value of the parameter.
    Example: lv_locality_transformation

  - `inputMapping.addressesAttributeMappings` (array)
    Maps an address attribute from raw data to the CDQ data model.

## Request examples:

  - `Basic Data Mapper Definition` (unknown)

  - `Disclosed Business Partner` (unknown)

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `id` (string)
    ID of related Data Mapper Definition that is used for mapping data of this Business Partner Storage.
    Example: 6440dba32b30176c5917b1b7

  - `createdAt` (string)
    Date of creation (ISO 8601-compliant).
    Example: 2026-10-21T13:37:19Z

  - `createdBy` (string)
    Creator of a resource.
    Example: 76248934691294444

  - `lastUpdatedAt` (string)
    Deprecated, please use modifiedAt instead.
    Example: 2026-10-21T13:37:19Z

  - `modifiedAt` (string)
    Date of modification (ISO 8601-compliant).
    Example: 2026-10-21T13:37:19Z

  - `modifiedBy` (string)
    User or Client UUID which modified the resource.
    Example: 76248934691294444

  - `creatorUsername` (string)
    Username of the creator of the Data Mapper Definition.
    Example: john.doe

  - `creatorOrganization` (string)
    Organization of the creator of the Data Mapper Definition.
    Example: cdq

  - `shareWithOrganization` (boolean)
    Toggle to enable that the Data Mapper Definition is shared with the whole organization.
    Example: true

  - `labels` (array)
    List of labels.

  - `name` (string)
    Name of the Data Mapper Definition.
    Example: Custom name of Data Mapper

  - `valueMappings` (array)
    List of Value Mappings.

  - `valueMappings.sourceValue` (string)
    The source value for a value mapping.
    Example: en

  - `valueMappings.targetValue` (string)
    The target value for a value mapping.
    Example: INTERNATIONAL

  - `valueMappings.targetAttribute` (string)
    The target attribute value (Business Partner or address) in the CDQ data model.
    Example: address.version.characterSet

  - `inputMapping` (object)
    Maps a Business Partner data from raw data to CDQ data model.

  - `inputMapping.businessPartnerAttributeMappings` (array)
    List of Business Partner Attribute Mappings.

  - `inputMapping.businessPartnerAttributeMappings.sourceConstant` (string)
    Assigns a fix value at path defined in targetAttributes.
    Example: LOCAL

  - `inputMapping.businessPartnerAttributeMappings.sourceAttributes` (array)
    List of source attributes.

  - `inputMapping.businessPartnerAttributeMappings.targetAttributes` (array)
    List of target attributes.

  - `inputMapping.businessPartnerAttributeMappings.targetAttributeTypes` (array)
    List of target attribute types.

  - `inputMapping.businessPartnerAttributeMappings.countryScopes` (array)
    List of country scopes.

  - `inputMapping.businessPartnerAttributeMappings.selectionType` (string)
    Defines how attribute values should be concatenated.
    Example: COMMA

  - `inputMapping.businessPartnerAttributeMappings.separationType` (string)
    Define how the source value should be separated.
    Example: LENGTH

  - `inputMapping.businessPartnerAttributeMappings.isMandatoryAttribute` (boolean)
    Define if the attribute is mandatory or optional.
If `true`, the attribute is mandatory.
If `false`, the attribute is optional.
    Example: true

  - `inputMapping.businessPartnerAttributeMappings.valueMapping` (string)
    Maps a cons from raw data to CDQ data model.
    Example: INTERNATIONAL

  - `inputMapping.businessPartnerAttributeMappings.defaultValue` (string)
    Defines default values applied for fields, for which no value was provided.
    Example: GB

  - `inputMapping.businessPartnerAttributeMappings.transformations` (array)
    List of transformations.

  - `inputMapping.businessPartnerAttributeMappings.transformations.type` (string)
    Define the Transformation Type.
    Example: UPPER_CASE

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters` (array)
    Depending on the Transformation Type, different parameters can be given.

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters.key` (string)
    Transformation parameter key.
    Example: transformationName

  - `inputMapping.businessPartnerAttributeMappings.transformations.parameters.value` (string)
    Value of the parameter.
    Example: lv_locality_transformation

  - `inputMapping.addressesAttributeMappings` (array)
    Maps an address attribute from raw data to CDQ data model.

