---
title: "executeMapping"
method: POST
path: "/v1/mappings:execute"
tags: ["mappings"]
---

# executeMapping

`POST /v1/mappings:execute`

Execute entity mapping based on a config

## Query parameters

- `preview_mode` boolean

## Request body

- ExecuteMappingReq — Pass either source or source_entity
  - `source_ref` EntityRef, required
    - `entity_id` string, required — id of the source entity to be mapped
    - `entity_schema` string — schema of the source entity
  - `loop_ref` EntityRef
    - `entity_id` string, required — id of the source entity to be mapped
    - `entity_schema` string — schema of the source entity
  - `targets` TargetConfig[], required — Mapping Configuration to apply.
    - `id` string — Identifier for target configuration. Useful for later usages when trying to identify which target config to map to.
    - `name` string — A name for this configuration
    - `allow_failure` boolean — Pass it as true, when you don't want failures to interrupt the mapping process.
    - `target_schema` string, required — Schema of target entity
    - `target_unique` string[] — Unique key for target entity (see upsertEntity of Entity API)
    - `use_uniqueness_criteria` boolean — Execution wire flag set per automation by automation-workers: resolve the target entity via the organization's global uniqueness criteria (deduplication-api) instead of target_unique. Never persisted in stored mapping configs.
    - `loop_config` object — contains config in case of running in loop mode
      - `source_path` string — path to the array from the entity payload
      - `length` number — a hard limit of how many times the loop is allowed to run.
    - `conditionMode` 'oneOf' | 'anyOf' | 'allOf' — Mode of how conditions are considered valid
    - `conditions` MapCondition[] — Conditions necessary to hold for the target entity to be mapped
      - `_exists` ConditionNode
        - `source` string
        - `value` union
          - string
          - number
          - object
          - object[]
      - `_equals` ConditionNode
        - `source` string
        - `value` union
          - string
          - number
          - object
          - object[]
      - `_not_exists` ConditionNode
        - `source` string
        - `value` union
          - string
          - number
          - object
          - object[]
      - `_any_of` ConditionNode
        - `source` string
        - `value` union
          - string
          - number
          - object
          - object[]
    - `mapping_attributes` union[], required — Attribute mappings
      - union
        - MappingAttributeV2
          - `target` string, required — Target JSON path for the attribute to set
          - `operation` union, required — Mapping operation nodes are either primitive values or operation node objects
            - OperationObjectNode
              - …
            - union — Represents any primitive JSON value
              - …
          - `origin` 'system_recommendation' | 'user_manually' | 'entity_updating_system_recommendation' — Origin of an attribute.
        - union
          - SetValueMapper
            - `mode` 'copy_if_exists' | 'append_if_exists' | 'set_value', required — - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
            - `target` string, required — JSON like target path for the attribute. Eg. last_name
            - `value` unknown, required
          - CopyValueMapper
            - `mode` 'copy_if_exists' | 'append_if_exists' | 'set_value', required — - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
            - `target` string, required — JSON like target path for the attribute. Eg. last_name
            - `source` string, required — JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price
          - AppendValueMapper
            - `mode` 'copy_if_exists' | 'append_if_exists' | 'set_value', required — - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
            - `target` string, required — JSON like target path for the attribute. Eg. last_name
            - `source` string — JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price
            - `value_json` string, required — To be provided only when mapping json objects into a target attribute. Eg array of addresses.
            - `target_unique` string[] — Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]
    - `relation_attributes` RelationAttribute[] — Relation mappings
      - `target` string, required — Target attribute to store the relation in
      - `target_tags` string[] — Relation tags (labels) to set for the stored relations
      - `target_tags_include_source` boolean — Include all relation tags (labels) present on the main entity relation
      - `target_entity_tags` string[] — Tags to add to the matched target entity's _tags array during mapping. Useful for assigning file collections to file entities.
      - `override_with_source_filter` boolean — Whether to override the relation source_filter with the specified one
      - `source_filter` object — A filter to identify which source entities to pick as relations from main entity
        - `limit` integer — Limit relations to maximum number (default, all matched relations)
        - `schema` string — Filter by specific schema
        - `attribute` string — Filter by a specific relation attribute on the main entity
        - `relation_tag` string — Filter by relation tag (label) on the main entity
        - `tag` string — Filter by a specific tag on the related entity
        - `self` boolean — Picks main entity as relation (overrides other filters)
      - `related_to` object
      - `mode` 'append' | 'prepend' | 'set', required
      - `origin` 'system_recommendation' | 'user_manually' | 'entity_updating_system_recommendation' — Origin of an attribute.
    - `linkback_relation_attribute` string — Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback
    - `linkback_relation_tags` string[] — Relation tags (labels) to include in main entity linkback relation attribute

## Response `200`

The target entities which were mapped

- ExecuteMappingResp
  - `mapped_entities` Entity[], required
    - `_id` string
    - `_schema` string
    - `_title` string, nullable
    - `_org` string
    - `_tags` string[], nullable
    - `_created_at` string, nullable
    - `_updated_at` string, nullable
    - `required` unknown
  - `failures` MappingFailure[]
    - `target` TargetConfig
      - `id` string — Identifier for target configuration. Useful for later usages when trying to identify which target config to map to.
      - `name` string — A name for this configuration
      - `allow_failure` boolean — Pass it as true, when you don't want failures to interrupt the mapping process.
      - `target_schema` string, required — Schema of target entity
      - `target_unique` string[] — Unique key for target entity (see upsertEntity of Entity API)
      - `use_uniqueness_criteria` boolean — Execution wire flag set per automation by automation-workers: resolve the target entity via the organization's global uniqueness criteria (deduplication-api) instead of target_unique. Never persisted in stored mapping configs.
      - `loop_config` object — contains config in case of running in loop mode
        - `source_path` string — path to the array from the entity payload
        - `length` number — a hard limit of how many times the loop is allowed to run.
      - `conditionMode` 'oneOf' | 'anyOf' | 'allOf' — Mode of how conditions are considered valid
      - `conditions` MapCondition[] — Conditions necessary to hold for the target entity to be mapped
        - `_exists` ConditionNode
          - `source` string
          - `value` union
            - string
            - number
            - object
            - object[]
              - …
        - `_equals` ConditionNode
          - `source` string
          - `value` union
            - string
            - number
            - object
            - object[]
              - …
        - `_not_exists` ConditionNode
          - `source` string
          - `value` union
            - string
            - number
            - object
            - object[]
              - …
        - `_any_of` ConditionNode
          - `source` string
          - `value` union
            - string
            - number
            - object
            - object[]
              - …
      - `mapping_attributes` union[], required — Attribute mappings
        - union
          - MappingAttributeV2
            - `target` string, required — Target JSON path for the attribute to set
            - `operation` union, required — Mapping operation nodes are either primitive values or operation node objects
              - …
            - `origin` 'system_recommendation' | 'user_manually' | 'entity_updating_system_recommendation' — Origin of an attribute.
          - union
            - SetValueMapper
              - …
            - CopyValueMapper
              - …
            - AppendValueMapper
              - …
      - `relation_attributes` RelationAttribute[] — Relation mappings
        - `target` string, required — Target attribute to store the relation in
        - `target_tags` string[] — Relation tags (labels) to set for the stored relations
        - `target_tags_include_source` boolean — Include all relation tags (labels) present on the main entity relation
        - `target_entity_tags` string[] — Tags to add to the matched target entity's _tags array during mapping. Useful for assigning file collections to file entities.
        - `override_with_source_filter` boolean — Whether to override the relation source_filter with the specified one
        - `source_filter` object — A filter to identify which source entities to pick as relations from main entity
          - `limit` integer — Limit relations to maximum number (default, all matched relations)
          - `schema` string — Filter by specific schema
          - `attribute` string — Filter by a specific relation attribute on the main entity
          - `relation_tag` string — Filter by relation tag (label) on the main entity
          - `tag` string — Filter by a specific tag on the related entity
          - `self` boolean — Picks main entity as relation (overrides other filters)
        - `related_to` object
        - `mode` 'append' | 'prepend' | 'set', required
        - `origin` 'system_recommendation' | 'user_manually' | 'entity_updating_system_recommendation' — Origin of an attribute.
      - `linkback_relation_attribute` string — Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback
      - `linkback_relation_tags` string[] — Relation tags (labels) to include in main entity linkback relation attribute
    - `error` object
      - `isSilent` boolean
      - `message` string
  - `warnings` MappingWarning[]
    - `explanation` string, required
    - `context` string
    - `id` string

---

[API](https://skmtc.dev/epilot/apis/entity-mapping-api.md) · [All operations](https://skmtc.dev/epilot/apis/entity-mapping-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/epilot/entity-mapping-api/revisions/ac038dfc97a1/schema)
