<@U04UQ68083H> how to bulk check relationships wit...
# ory-copilot
b
@chilly-king-10285 how to bulk check relationships with ory sdk in golang
b
A message from kapa.ai
To bulk check relationships (permissions) with the Ory SDK in Golang, you should use the batch check endpoint provided by Ory Keto. This endpoint allows you to check multiple permission tuples in a single request. The relevant REST API endpoint is:
Copy code
POST /relation-tuples/batch/check
You need to send a JSON body with an array of tuples, each specifying the namespace, object, relation, and subject (either subject_id or subject_set). Here’s the structure for the request body:
Copy code
json {   "tuples": [     {       "namespace": "example_namespace",       "object": "example_object",       "relation": "example_relation",       "subject_id": "example_subject"     },     {       "namespace": "another_namespace",       "object": "another_object",       "relation": "another_relation",       "subject_id": "another_subject"     }     // ... more tuples   ] }
While the knowledge sources provide the API specification and mention SDKs, they do not include a direct Golang code example for the batch check operation. However, you can use the Ory Go SDK's Permission API to call this endpoint by constructing the appropriate request body and invoking the batch check method. For more details on the API structure, see the [Ory Keto API reference](https://www.ory.sh/docs/keto/concepts/api-overview). If you need a code example, you may refer to the auto-generated documentation for the Go SDK or the [API reference for batchCheckPermission](https://www.ory.sh/docs/keto/concepts/api-overview), but the knowledge sources do not provide a ready-to-use code snippet for this specific operation. Summary: - Use the
POST /relation-tuples/batch/check
endpoint. - Construct a JSON body with the tuples you want to check. - Use the Ory Go SDK's Permission API to call this endpoint. If you need further details or a code example, please consult the SDK documentation or request an example from the Ory team, as the knowledge sources do not provide a direct code sample for this use case.
b
@chilly-king-10285 when you don't pass a max-depth when checking permissions, what is the global default?
b
A message from kapa.ai
The knowledge sources explain that if you do not pass a
max-depth
parameter when checking permissions, the system will use the global max-depth value. However, the exact numeric value of the global default is not specified in the provided sources. The documentation states: > If the value is less than 1 or greater than the global max-depth then the global max-depth will be used instead. This is to ensure low latency and limit the resource usage per request. But it does not define what the global max-depth actually is. You may need to check your Ory Keto configuration or the official documentation for the specific default value in your deployment [API overview](https://www.ory.sh/docs/keto/concepts/api-overview).
b
@chilly-king-10285 how long should a permission check to ory network take in ms?
b
A message from kapa.ai
The knowledge sources do not provide a specific expected latency (in milliseconds) for a permission check to Ory Network. However, there is a related performance discussion for session checks, where Ory Network's edge caching can deliver a P95 latency of ~35ms and a P99 latency of ~45ms globally for session validation endpoints. This information is specific to session checks, not permission checks, so it may not directly apply to permission checks, which can be affected by factors such as data model complexity and traversal width [Low latency with Edge Sessions](https://www.ory.sh/docs/concepts/cache). For permission checks, especially with complex relationships or large traversal widths, performance can vary and may be slower, as noted in user reports of permission checks taking over 1 second in certain scenarios with large datasets or complex traversals [Poor query performance as traversal width increases](https://github.com/ory/keto/issues/1519). In summary, the knowledge sources do not specify an exact expected latency for permission checks to Ory Network. Performance will depend on your data model and usage patterns.