How do I check a permission using the API? #1527
Replies: 5 comments 5 replies
-
|
Hello @jonlambert No worries at all, it's a great question! In Ory Keto, permissions are modeled as relationships between entities. The When you want to check a permission using the Keto API, you're essentially checking if a certain relationship exists. For example, to check if a user has the The API endpoint you mentioned, Here's how you might use it to check the
You would make a separate API request for each relationship you want to check. If any of the requests return true, then the user has the For more details on how to use the API, you can refer to the Keto API Reference. I hope this helps! Let me know if you have any other questions. |
Beta Was this translation helpful? Give feedback.
-
|
If I understand correctly, this is more about how to invoke the method I would be very interested to know how to invoke permits when self hosting. |
Beta Was this translation helpful? Give feedback.
-
|
So, no way to check permission via HTTP API? Only via cli? |
Beta Was this translation helpful? Give feedback.
-
This would defeat the idea of abstracting away details of permission ( |
Beta Was this translation helpful? Give feedback.
-
|
Thanks . It took me some time to realize that as the ory documentation does
not clarify that , including the API docs you have mentioned
…On Fri, Dec 19, 2025 at 8:40 PM Vincent ***@***.***> wrote:
The CLI is just a wrapper for the API.
Pass the permits function name (e.g. view) as the relation parameter in
your check request:
GET
/relation-tuples/check?namespace=File&object=private&relation=view&subject_id=User:vinckr
Or POST equivalent.
The Check Permission endpoint evaluates the full OPL model, including
permits functions and traversals, not just direct tuples. The max-depth
parameter controls traversal depth.
Reference in API docs:
https://www.ory.com/docs/keto/reference/rest-api#tag/permission/operation/checkPermission
Let me know if that helps @melezhik <https://github.com/melezhik>
@tjoekbezoer <https://github.com/tjoekbezoer>
—
Reply to this email directly, view it on GitHub
<#1527 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHRHSIHOZAJG325OGC5YIL4CQ2A3AVCNFSM6AAAAACOWVBGFOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTKMZQGEYDGMY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey!
I'm evaluating using Keto at the moment for use in our team.
I understand we can define relationships between entities (Document, Folder, User) and there appears to be a section in the docs that refers to permissions, and how to define them in OPL using the
permitsattribute.However, it's not clear at all how I query this using the API.
Taking this example from the docs:
How do I query the
viewpermission? The documentation directs me to the API, which has an endpoint which allows me to "Check a permission", but there doesn't seem to be anything relating to permissions in the arguments to the endpoint:Am I missing something super obvious? Apologies if so!
Beta Was this translation helpful? Give feedback.
All reactions