Before you start
Familiarize yourself with basic Auth0 FGA Concepts before completing this guide.Step by step
01. Add and remove relationship tuples in the same transaction
A call to the Write API can add or delete tuples in your store. For example, the following tuple makestweet:1 public by making everyone a viewer:
Deleting the previous tuple converts this tweet to private:
By removing the tuple, we made the tweet visible to no-one, which may not be what we want.
The Write API allows you to send up to 40 unique tuples in the request. (This limit applies to the sum of both writes and deletes in that request). This means we can submit one API call that converts the tweet from public to visible to only the user’s followers.
02. Add multiple related relationship tuples in the same transaction
Sending multiple tuples per request can also help maintain consistency. For example, ifanne follows becky, you can save the following two tuples or neither of them:
In this case, the type
user exists because users can be related to each other, so users now are a type in the system.