<@U04UQ68083H> Using Keto, I need to look up which...
# ory-copilot
d
@chilly-king-10285 Using Keto, I need to look up which subjects (users) have a specific relation (owner) to a resource. Is this possible?
c
A message from kapa.ai
Yes, it is possible to look up which subjects (users) have a specific relation (owner) to a resource using Ory Keto. You can use the List API to query relationships by providing a partial relationship. In your case, you would provide the namespace and the relation (owner) to list all subjects that have the 'owner' relation. Here is an example of how you can use the List API:
Copy code
plaintext namespace: your-namespace relation: owner
This will return a list of all subjects (users) that have the 'owner' relation in the specified namespace. For more details, you can refer to the [API overview](https://www.ory.sh/docs/keto/concepts/api-overview) and the [gRPC API reference](https://www.ory.sh/docs/keto/reference/proto-api#readservice) or [REST API reference](https://www.ory.sh/docs/keto/reference/rest-api#query-relation-tuples).
d
@chilly-king-10285 Can I filter that list to only owners of a specified resource?
c
A message from kapa.ai
Yes, you can filter the list to only owners of a specified resource. When using the List API, you can provide the namespace, relation, and object to get a list of all subjects that have the specified relation to the specified object. Here is an example of how you can use the List API:
Copy code
plaintext namespace: your-namespace relation: owner object: your-object
This will return a list of all subjects (users) that are 'owners' of the specified object in the specified namespace. For more details, you can refer to the [API overview](https://www.ory.sh/docs/keto/concepts/api-overview) and the [gRPC API reference](https://www.ory.sh/docs/keto/reference/proto-api#readservice) or [REST API reference](https://www.ory.sh/docs/keto/reference/rest-api#query-relation-tuples).