> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform-resources/skill-library/logic-and-data-integration/mapper.md).

# Mapper

**Mapper** transforms and maps data from source fields to target fields. Use it for renaming fields, reshaping structures, converting types, or supplying defaults before data reaches a downstream skill.

It exists because the shape one system returns is rarely the shape the next one wants. Rather than teaching every skill to speak every format, put the translation between them where you can see it.

## How it works

* **Input resolution** — resolves the previous skill's output via `$input`. Vault secrets are available through `$secret`.
* **Processing** — works through the `mappings` list in order. For each mapping it extracts a value from a source path, applies `defaultValue` if the path is missing, converts the value to the declared type (`string`, `number`, `any`, `date`), and writes it to the target field.
* **Execution** — blocking. Waits for all mappings to complete.
* **Response** — on success, a `data` object holding every mapped target field. On failure, `data: null` and an error message.

## Worked example

**Configuration:**

```json
{
  "mappings": [
    { "target": "firstName",  "type": "string", "source": "user.first_name" },
    { "target": "age",        "type": "number", "source": "user.age" },
    { "target": "signupDate", "type": "date",   "source": "user.created_at" }
  ]
}
```

**Output:**

```json
{
  "data": {
    "firstName": "John",
    "age": 32,
    "signupDate": "2025-07-27T10:00:00.000Z"
  },
  "statusCode": 200
}
```

**When a source path is missing and no default is set:**

```json
{
  "data": null,
  "statusCode": 422,
  "error": "Source path user.age not found and no defaultValue provided"
}
```

{% hint style="info" %}
A missing source path fails the **whole mapping**, not just that field — `data` comes back `null`. If a field is genuinely optional, give it a `defaultValue`. That one decision is the difference between a resilient mapper and a workflow that stops the first time an upstream system omits a field.
{% endhint %}

## Configuration reference

| Field         | Type           | Required | Description                                                                                                                         |
| ------------- | -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `mappings`    | array\<object> | ✅        | Source-to-target mappings. Each: `target`, `type` (`string` \| `number` \| `any` \| `date`), `source`, and optional `defaultValue`. |
| `name`        | string         | —        | Display name for the skill.                                                                                                         |
| `description` | string         | —        | Description for documentation.                                                                                                      |

<figure><img src="/files/PyPWcwWP3JlVGhMIQ65u" alt=""><figcaption><p>Defining data mappings to standardize field names and types</p></figcaption></figure>

## Output

The output port (`mapperOutput`) always conforms to:

| Field        | Type           | Always | Description                                  |
| ------------ | -------------- | ------ | -------------------------------------------- |
| `data`       | any \| null    | —      | The object holding all mapped target fields. |
| `statusCode` | number         | ✅      | HTTP-style status; `200` on success.         |
| `error`      | string \| null | —      | Error message on failure.                    |

## Errors

| Status | Cause                                                                        |
| ------ | ---------------------------------------------------------------------------- |
| `400`  | Invalid mapping syntax, or an empty `target` field.                          |
| `422`  | A source path was not found in the input and no `defaultValue` was provided. |

## Security

* Secrets from `$secret` are never written to the output unless you explicitly map them.
* Exclude or rename fields carrying sensitive data to prevent unintentional exposure — a mapper is exactly where PII quietly acquires a new name and travels somewhere it shouldn't.
* Log redaction policies apply to sensitive mapping values.

## Testing in isolation

* **Path** — `/skill-runtime/workflows/nodes/Mapper/execute`
* **Method** — `POST`
* **Body:**

```json
{
  "config": { "name": "Mapper Skill", "description": "For better workflow structure" },
  "input":  { "userId": 12345, "status": "active" }
}
```

***

To add this skill to an agent, see [Adding a Skill to the Agent](/agent-builder/build/adding-a-skill-to-the-agent.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/platform-resources/skill-library/logic-and-data-integration/mapper.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
