# Validation rule - Validate against a connected field using a pipe

> In this example, we are creating a validation rule with a pipe to prevent users from using more credits than they have available.

Source: https://tadabase.com/docs/snippets/validation-rule-validate-against-a-connected-field-using-a-pipe  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/2022-10-06-15-57-03.png)

In this example, we are creating a validation rule with a pipe to prevent users from using more credits than they have available.

**Step 1**

**Follow the steps in the image below to create a new pipe with the following API call.**

```
https://api.tadabase.io/api/v1/data-tables/TABLE_ID/records/{recordId}
```

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665004877228.png)

> **Note:** Remember to change the Table ID in the call to the ID of the table you wish to use for your validation. You can find your table ID in the example below.

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665032288954.png)

**Step 2**

**In the parameter tab of your pipe. Set a parameter for record ID.**

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665032556518.png)

**Step 3**

**Within the pipe's headers tab, add each of the following as a key. And then, fill the value with your API value.**

- `X-Tadabase-App-id`
- `X-Tadabase-App-Key`
- `X-Tadabase-App-Secret`

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665061906730.png)

**Step 4**

**In the pipe response tab, you will need to add the information from the field you wish to use for your validation. See the image below for where to find this information.**

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665084639720.png)

**Step 5**

**Add the pipe to a validation rule within your form for purchases with this setup.**

![Screenshot for “Validation rule - Validate against a connected field using a pipe”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665086383002.png)

**Original Community Post:**

[Validation rule - Validate against a connected field using a pipe - Community Discussions / Pipes - Tadabase Community](https://community.tadabase.io/t/validation-rule-validate-against-a-connected-field-using-a-pipe/413)
