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

# Import Identity Mapper Set

> Import Mapper Set for a specific Template in the indicated Environment. This API call is designed to support CREATE and UPDATE operations for Mapper Set. <br> <br>
<h2>Notice</h2>Accessing the API call is through a dedicated domain/URL, according to your PlainID Tenant Location<li><b>United States (US)</b> - `https://api.us1.plainid.io`</li><li><b>Canada (CA)</b> - `https://api.ca1.plainid.io`</li><li><b>Europe (EU)</b> - `https://api.eu1.plainid.io`</li> <br> <h2>Using HTML Encoded Special Characters</h2> <p>Use HTML encoded patterns when working with values that contain special characters like spaces, dashes, etc. Refer to this <a href="https://www.w3schools.com/tags/ref_urlencode.ASP" target="_blank">HTML URL Encoding Reference</a> for a full list.</p> <br>

<h2>Important note about headers</h2> <p>Refer to the headers below to modify your cURL sample. Check if the following headers are in the sample, if not, ensure you add it to your API tool. </p> <h3>Headers</h3> *Required <table><thead> <tr> <th>Header</th> <th>Value</th> <th>cURL Line</th> </tr></thead> <tbody> <tr> <td>Accept</td> <td>`application/json`</td> <td> `-H "Accept:application/json"`</td> </tr> <tr> <td>Content-Type</td> <td>`application/json`</td> <td> `-H "Content-Type:application/json"`</td> </tr> </tbody> </table> <br> <h3>cURL Sample Guidelines</h3> <p>In order for the relevant parameters to appear in the cURL sample, you can input the values in the interactive API console on the right in the Try It or Code Sample tabs. You can then copy the cURL sample from the Code Sample tab in the correct format.</p>

## OpenAPI

````json POST /api/1.0/identity-templates/{envId}/{identityTemplateId}/mapper-sets
{
  "openapi": "3.0.3",
  "info": {
    "title": "Management APIs",
    "version": "1.0.0",
    "contact": {
      "name": "PlainID",
      "url": "https://plainid.com",
      "email": "contact@plainid.com"
    },
    "license": {
      "name": "Commercial",
      "url": "https://plainid.com/license"
    },
    "termsOfService": "https://www.plainid.com/terms/",
    "description": "<h3>The PlainID Authorization Platform provides Management capabilities through the APIs below.</h3><h4> To access the Management APIs, make sure to enter your dedicated domain according to your PlainID Tenant Location:<table><thead><tr><th>Region</th><th>Base URL</th></tr></thead><tbody><tr><td>United States (US)</td><td>https://api.us1.plainid.io</td></tr><tr><td>Canada (CA)</td><td>https://api.ca1.plainid.io</td></tr><tr><td>Europe (EU)</td><td>https://api.eu1.plainid.io</td></tr><tr><td>Local PAA</td><td>https://api.plainid.local</td></tr></tbody></table>"
  },
  "servers": [
    {
      "description": "United States",
      "url": "https://api.us1.plainid.io"
    },
    {
      "description": "Europe",
      "url": "https://api.eu1.plainid.io"
    },
    {
      "description": "Canada",
      "url": "https://api.ca1.plainid.io"
    },
    {
      "description": "Local PAA",
      "url": "https://api.plainid.local"
    }
  ],
  "paths": {
    "/api/1.0/identity-templates/{envId}/{identityTemplateId}/mapper-sets": {
      "post": {
        "summary": "Import Identity Mapper Set",
        "operationId": "importMapperSet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Import Mapper Set for a specific Template in the indicated Environment. This API call is designed to support CREATE and UPDATE operations for Mapper Set. <br> <br>\n<h2>Notice</h2>Accessing the API call is through a dedicated domain/URL, according to your PlainID Tenant Location<li><b>United States (US)</b> - `https://api.us1.plainid.io`</li><li><b>Canada (CA)</b> - `https://api.ca1.plainid.io`</li><li><b>Europe (EU)</b> - `https://api.eu1.plainid.io`</li> <br> <h2>Using HTML Encoded Special Characters</h2> <p>Use HTML encoded patterns when working with values that contain special characters like spaces, dashes, etc. Refer to this <a href=\"https://www.w3schools.com/tags/ref_urlencode.ASP\" target=\"_blank\">HTML URL Encoding Reference</a> for a full list.</p> <br>\n\n<h2>Important note about headers</h2> <p>Refer to the headers below to modify your cURL sample. Check if the following headers are in the sample, if not, ensure you add it to your API tool. </p> <h3>Headers</h3> *Required <table><thead> <tr> <th>Header</th> <th>Value</th> <th>cURL Line</th> </tr></thead> <tbody> <tr> <td>Accept</td> <td>`application/json`</td> <td> `-H \"Accept:application/json\"`</td> </tr> <tr> <td>Content-Type</td> <td>`application/json`</td> <td> `-H \"Content-Type:application/json\"`</td> </tr> </tbody> </table> <br> <h3>cURL Sample Guidelines</h3> <p>In order for the relevant parameters to appear in the cURL sample, you can input the values in the interactive API console on the right in the Try It or Code Sample tabs. You can then copy the cURL sample from the Code Sample tab in the correct format.</p>",
        "tags": [
          "Mapper Sets"
        ],
        "parameters": [
          {
            "name": "envId",
            "in": "path",
            "required": "true",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The Environment ID can be found under the Details Tab in the Environment Settings."
          },
          {
            "name": "identityTemplateId",
            "in": "path",
            "required": "true",
            "schema": {
              "type": "string"
            },
            "description": "The Identity Template ID. This can be found in your Identity Workspace Settings."
          }
        ],
        "requestBody": {
          "description": "Mapper Set to import.",
          "required": "true",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MapperSet"
              },
              "examples": {
                "example": {
                  "value": {
                    "mapperSetId": "ms_123",
                    "displayName": "User Mapper Set",
                    "description": "Mapper set for user identities",
                    "linkedSources": [
                      {
                        "sourceId": "REQUEST_INPUT",
                        "sourceUsedAs": "BASE",
                        "mappers": [
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "uid",
                                "target": "uid"
                              },
                              {
                                "origin": "assignmentId",
                                "target": "assignmentId"
                              },
                              {
                                "origin": "assignmentName",
                                "target": "assignmentName"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "sourceId": "REQUEST_MAPPERS",
                        "sourceUsedAs": "BASE",
                        "mappers": [
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "$.JWT.a.claim",
                                "target": "userAssignment"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "sourceId": "ds_users",
                        "sourceUsedAs": "MAIN",
                        "additionalProps": {
                          "isValidateUser": "true"
                        },
                        "mappers": [
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "userID",
                                "target": "uid"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "sourceId": "ds_classes",
                        "sourceUsedAs": "AUX",
                        "additionalProps": {
                          "cacheDuration": "0"
                        },
                        "mappers": [
                          {
                            "type": "CORRELATION",
                            "mappings": [
                              {
                                "origin": "userIdentifier",
                                "target": "uid",
                                "operator": "EQUALS"
                              }
                            ]
                          },
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "assignmentId",
                                "target": "userAssignmentId"
                              },
                              {
                                "origin": "assignmentName",
                                "target": "userAssignmentName"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "sourceId": "ds_classes",
                        "sourceUsedAs": "CONTEXT",
                        "additionalProps": {},
                        "mappers": [
                          {
                            "type": "CORRELATION",
                            "mappings": [
                              {
                                "origin": "userIdentifier",
                                "target": "uid",
                                "operator": "EQUALS"
                              }
                            ]
                          },
                          {
                            "type": "CONTEXT_FILTERS",
                            "mappings": [
                              {
                                "origin": "class",
                                "target": "classification",
                                "originMapper": "$.JWT.a.claim",
                                "isRequired": "true",
                                "isExcludedFromCache": "false"
                              }
                            ]
                          },
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "assignmentId",
                                "target": "userAssignmentId"
                              },
                              {
                                "origin": "assignmentName",
                                "target": "userAssignmentName"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "sourceId": "CALCULATED",
                        "sourceUsedAs": "AUX",
                        "mappers": [
                          {
                            "type": "IDENTITY_ATTRIBUTES",
                            "mappings": [
                              {
                                "origin": "SUBSTRING({{assignmentName}},0,5)",
                                "target": "userAssignmentPrefix"
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful operation",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MapperSetResponse"
                },
                "examples": {
                  "example": {
                    "value": {
                      "data": {
                        "mapperSetId": "ms_123",
                        "displayName": "User Mapper Set",
                        "description": "Mapper set for user identities",
                        "linkedSources": [
                          {
                            "sourceId": "REQUEST_INPUT",
                            "sourceUsedAs": "BASE",
                            "mappers": [
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "uid",
                                    "target": "uid"
                                  },
                                  {
                                    "origin": "assignmentId",
                                    "target": "assignmentId"
                                  },
                                  {
                                    "origin": "assignmentName",
                                    "target": "assignmentName"
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "sourceId": "REQUEST_MAPPERS",
                            "sourceUsedAs": "BASE",
                            "mappers": [
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "$.JWT.a.claim",
                                    "target": "userAssignment"
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "sourceId": "ds_users",
                            "sourceUsedAs": "MAIN",
                            "additionalProps": {
                              "isValidateUser": "true"
                            },
                            "mappers": [
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "userID",
                                    "target": "uid"
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "sourceId": "ds_classes",
                            "sourceUsedAs": "AUX",
                            "additionalProps": {
                              "cacheDuration": "0"
                            },
                            "mappers": [
                              {
                                "type": "CORRELATION",
                                "mappings": [
                                  {
                                    "origin": "userIdentifier",
                                    "target": "uid",
                                    "operator": "EQUALS"
                                  }
                                ]
                              },
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "assignmentId",
                                    "target": "userAssignmentId"
                                  },
                                  {
                                    "origin": "assignmentName",
                                    "target": "userAssignmentName"
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "sourceId": "ds_classes",
                            "sourceUsedAs": "CONTEXT",
                            "additionalProps": {},
                            "mappers": [
                              {
                                "type": "CORRELATION",
                                "mappings": [
                                  {
                                    "origin": "userIdentifier",
                                    "target": "uid",
                                    "operator": "EQUALS"
                                  }
                                ]
                              },
                              {
                                "type": "CONTEXT_FILTERS",
                                "mappings": [
                                  {
                                    "origin": "class",
                                    "target": "classification",
                                    "originMapper": "$.JWT.a.claim",
                                    "isRequired": "true",
                                    "isExcludedFromCache": "false"
                                  }
                                ]
                              },
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "assignmentId",
                                    "target": "userAssignmentId"
                                  },
                                  {
                                    "origin": "assignmentName",
                                    "target": "userAssignmentName"
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "sourceId": "CALCULATED",
                            "sourceUsedAs": "AUX",
                            "mappers": [
                              {
                                "type": "IDENTITY_ATTRIBUTES",
                                "mappings": [
                                  {
                                    "origin": "SUBSTRING({{assignmentName}},0,5)",
                                    "target": "userAssignmentPrefix"
                                  }
                                ]
                              }
                            ]
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            }
          },
          "404": {
            "description": "Object not found",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "validationError": {
                    "$ref": "#/components/examples/TemplateMapperSetNotFoundError"
                  }
                }
              }
            }
          },
          "422": {
            "description": "Payload Validation Error",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "The ID of the request"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "MapperSet": {
        "type": "object",
        "description": "Mapper Set",
        "required": [
          "mapperSetId",
          "displayName",
          "linkedSources"
        ],
        "properties": {
          "mapperSetId": {
            "type": "string",
            "description": "Identity Mapper Set Unique Identifier. This can be found using the <a href=\"https://docs.plainid.io/apidocs/export-api-mapper-set-by-filter\" target=\"_blank\">Export API Mapper Set By Filter call</a>."
          },
          "displayName": {
            "type": "string",
            "description": "Display name for the Mapper Set"
          },
          "description": {
            "type": "string",
            "description": "Description of the Mapper Set",
            "maxLength": "200"
          },
          "linkedSources": {
            "type": "array",
            "description": "List of linked sources for the Mapper Set",
            "items": {
              "type": "object",
              "required": [
                "sourceId",
                "sourceUsedAs",
                "mappers"
              ],
              "properties": {
                "sourceId": {
                  "type": "string",
                  "description": "Source identifier. This can be found in the relevant Source in your Identity Workspace Settings."
                },
                "sourceUsedAs": {
                  "type": "string",
                  "enum": [
                    "BASE",
                    "MAIN",
                    "AUX",
                    "CONTEXT"
                  ],
                  "description": "How the source is used in the mapping"
                },
                "additionalProps": {
                  "type": "object",
                  "description": "Additional properties for the source",
                  "properties": {
                    "cacheDuration": {
                      "type": "integer",
                      "description": "Cache duration in minutes"
                    },
                    "isValidateUser": {
                      "type": "boolean",
                      "description": "Whether to validate the user in MAIN source only"
                    }
                  }
                },
                "mappers": {
                  "type": "array",
                  "description": "List of Mappers for the Source",
                  "items": {
                    "type": "object",
                    "required": [
                      "type",
                      "mappings"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "IDENTITY_ATTRIBUTES",
                          "CORRELATION",
                          "CONTEXT_FILTERS"
                        ],
                        "description": "Type of mapper"
                      },
                      "mappings": {
                        "type": "array",
                        "description": "List of Attribute mappings",
                        "items": {
                          "type": "object",
                          "properties": {
                            "origin": {
                              "type": "string",
                              "description": "Origin Attribute or expression"
                            },
                            "target": {
                              "type": "string",
                              "description": "Target Attribute"
                            },
                            "operator": {
                              "type": "string",
                              "description": "Operator for correlation (for correlation mappers)"
                            },
                            "originMapper": {
                              "type": "string",
                              "description": "Origin mapper expression (for context filters mappers)"
                            },
                            "isRequired": {
                              "type": "boolean",
                              "description": "If the Mapping is required (for context filters mappers)"
                            },
                            "isExcludedFromCache": {
                              "type": "boolean",
                              "description": "Exclude from cache (for context filters mappers)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "MapperSetResponse": {
        "type": "object",
        "description": "Response payload for a Mapper Set",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MapperSet"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "string"
          }
        }
      }
    },
    "examples": {
      "TemplateMapperSetNotFoundError": {
        "value": {
          "errors": [
            {
              "code": "EMTMS-001",
              "id": "EQ7CMX",
              "status": "404",
              "name": "TemplateMapperSetNotFoundError",
              "message": "Template Mapper Set: [TMS] not found, Hint: did you mean [User, Target]"
            }
          ]
        }
      }
    }
  }
}
````

