# Skip duplicates

> Stops the run quietly when the same document was already handled, for example the same invoice number from the same supplier.

Source: https://docs.go-lumen.ai/reference/steps/dedupe

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `dedupe` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | control, logic |
| **Credits** | **0.5** credits each time it succeeds |
| **Side effects** | yes: It changes something outside Lumen, so a retry asks first and a test shows what it would do instead of doing it. |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | nothing |
| **Produces** | `fields` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

A later node references an output as `{nodeId.field}` in text, or `nodeId.field` in a condition.

| Output | Type |
| --- | --- |
| `duplicate` | boolean |
| `firstSeenAt` | date |

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `key` (required) | string |  | For example the invoice number and the supplier (minLength 1; maxLength 500) |
| `days` | integer | `90` | Days is how long a key is remembered. Unset is 90. (minimum 1; maximum 365) |

The full JSON Schema of these settings: [dedupe.schema.json](https://docs.go-lumen.ai/schemas/steps/dedupe.schema.json).

## Example

Skip an invoice you already handled

```yaml title="config"
days: 90
key: '{supplier} {invoiceNumber}'
```

## Use it in a flow

A node that runs `dedupe` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: dedupe-example
  namespace: tenant-acme
spec:
  displayName: "Skip duplicates"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [dedupe]
  nodes:
    - id: dedupe
      stepRef: {name: dedupe}
      config:
        days: 90
        key: '{supplier} {invoiceNumber}'
```
