Ignore Duplicate Tuples On Write
We've added two new optional parameters to the Write API endpoint to improve the experience of writing data to FGA. You can now gracefully "ignore" duplicate writes and missing deletes.
The Problemโ
When you're writing tuples to OpenFGA, it's almost inevitable that you'll try to write a relationship tuple that already exists (e.g., user:anne is already a viewer of document:123) or try to delete one that's already gone. In the past, OpenFGA would reject the entire Write request containing that single duplicate operation.
This forced developers to build complex error-handling and retry logic on the client-side, just to filter out the single problematic tuple and resend the rest of the batch. This adds latency and operational overhead.
The Solutionโ
The Write API now accepts two new optional parameters to gracefully handle these use cases:
-
on_duplicate: "ignore": When included in thewritessection, this tells OpenFGA to simply skip any tuples that already exist instead of failing the request. -
on_missing: "ignore": When included in thedeletessection, this tells OpenFGA to skip any tuples that don't exist.
Now, you can send large batches of writes and deletes without worrying about these common conditions breaking your import.
