---
title: "Comment by Dharmin Kansara on \"How to bypass duplicate rules via Apex in Salesforce?\" | Hashnode"
description: "Great article, the code which you presented is for anonymous window, can you show an example where I can implement this? I am creating a record in SF using API,"
url: "https://hashnode.com/posts/how-to-bypass-duplicate-rules-via-apex-in-salesforce/63de36632f21c58845cbe0c0/comment/6470b734bd422f7eb3b31af9"
---

[Discussion](https://hashnode.com/posts/how-to-bypass-duplicate-rules-via-apex-in-salesforce/63de36632f21c58845cbe0c0)

Comment [How to bypass duplicate rules via Apex in Salesforce?](https://hashnode.com/posts/how-to-bypass-duplicate-rules-via-apex-in-salesforce/63de36632f21c58845cbe0c0)

[Dharmin Kansara](https://hashnode.com/@Dharmin)

[May 26, 2023](https://hashnode.com/posts/how-to-bypass-duplicate-rules-via-apex-in-salesforce/63de36632f21c58845cbe0c0/comment/6470b734bd422f7eb3b31af9)

Great article, the code which you presented is for anonymous window, can you show an example where I can implement this?

I am creating a record in SF using API, and SF is blocking the record due to a dupe rule. The dupe rule has already the condition, to NOT block if source is the API, this works internally (when I create from SF)

But when I push from API --> it blocks.

I want to bypass this, can you show me how to write a code for this?
