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

# Enrichment

> Fetch additional data for each extracted datapoint with secondary API requests

## Overview

Enrichment fetches additional data for each datapoint returned by the main Extract phase. For every extracted record, RWS Integration makes one or more secondary API requests and attaches the responses to the datapoint, so the rest of the integration can combine fields from both the original extraction and the enrichments.

The flow becomes **Extract → Enrichment → Transform → Load**.

## When to use

Use enrichment when the main extraction returns records that are missing details available from a separate endpoint, for example fetching comments for a post, line items for an order, or address details for a customer keyed by an ID in the main list.

## Configuration

Each enrichment is defined by:

| Field                       | Description                                                          |
| --------------------------- | -------------------------------------------------------------------- |
| Name                        | Key the response is stored under (e.g., `comments`)                  |
| Connection                  | Connection used for the request                                      |
| Method                      | HTTP method (`GET`, `POST`, etc.)                                    |
| Path                        | Endpoint path, which can include parameters like `{{ parameterId }}` |
| Enrichment query parameters | Provide the values for the parameters referenced in the path         |

A query parameter pairs a value with a name. The path can then reference that name as `{{ name }}`. The value can be defined in two ways:

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| Fixed         | A fixed value to be used as the query parameter  |
| Business rule | A value computed with a JavaScript business rule |

A `Fixed` value may embed `{{ ... }}` placeholders that are interpolated from the main extraction datapoint or another enrichment, e.g. `{{ id }}`. See [Dynamic Parameters](/en/features/extract/dynamic-parameters) for more information.

## Referencing other enrichments

By default every enrichment runs against the primary extraction datapoint. An enrichment can also depend on another enrichment's response, which is useful when one request returns an ID needed to build the next request.

Enable **Has another enrichment as a dependency?** and set the **Enrichment name** to the enrichment it depends on. You can then reference that enrichment's response fields using dot notation:

```
{{ enrichmentName.path }}
```

For example, if an enrichment named `comments` returns a post's comments, a dependent enrichment can use its fields in query parameter values:

| To               | Fixed value                |
| ---------------- | -------------------------- |
| `postId`         | `{{ comments[0].postId }}` |
| `commenterEmail` | `{{ comments[0].email }}`  |

Dependent enrichments run after the enrichment they reference, so its data is available when the request is built.

## When the request comes back with an error

The **HTTP response with error status** option controls what happens when an enrichment request comes back with an error status (HTTP 4xx or 5xx):

| Option                        | Behavior                                                                                         |
| ----------------------------- | ------------------------------------------------------------------------------------------------ |
| Interrupt execution (default) | The run fails and the integration stops.                                                         |
| Ignore error                  | The run continues; the datapoint goes through Transform and Load without that enrichment's data. |

Choose **Ignore error** when the enrichment is optional and you would rather deliver partial data than stop the integration.

## Accessing enrichment data

Enrichment responses are exposed in other sections of the integration by their enrichment name:

```
{{ enrichmentName }}.{{ fieldPath }}
```

For an enrichment named `comments` returning an array:

| To                  | From                |
| ------------------- | ------------------- |
| `firstCommentEmail` | `comments[0].email` |
| `firstCommentText`  | `comments[0].body`  |

## Related

<CardGroup cols={2}>
  <Card title="Dynamic Parameters" icon="brackets-curly" href="/en/features/extract/dynamic-parameters">
    Interpolate values into paths, headers, and request bodies
  </Card>

  <Card title="Integration with multiple extractions" icon="layer-group" href="/en/guides/enrichment">
    Step-by-step guide to building an enrichment integration
  </Card>
</CardGroup>
