melodic-oil-50942
04/15/2025, 11:58 AMbrief-egg-61061
04/15/2025, 11:58 AMbrief-egg-61061
04/15/2025, 11:58 AMory get identity $(ory ls identities --format json | jq -r 'map(select(.recovery_addresses[].value | endswith("@example.com"))) | .[].id')
This example retrieves identities with recovery email addresses ending with "@example.com" [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-get-identity#ory-get-identity). ### Using the Identity API If you're using the Identity Management API, you'll need to authorize your requests with an API key: 1. Create a free Developer project with the Ory CLI or Console 2. Create a new API key and export it 3. Use the API to query identities However, the Identity API doesn't directly support filtering by email in a single request. You would need to: 1. List all identities 2. Filter them programmatically on your side [Identity API documentation](https://www.ory.sh/docs/kratos/sdk/go#identity-api) provides examples of how to interact with identities. ### Current Limitations There is a known limitation in the Ory API for querying identities by properties. As noted in GitHub issue #396, the current approach of querying individual identities can face rate limiting issues when used for real-time, user-facing flows: > "We've been using Ory as a single source of truth for user properties... The issue we've encountered is that this solution does not scale, due to rate limiting on the Ory side." [GitHub issue #396](https://github.com/ory/network/issues/305) discusses the need for an API that can accept a set of identity IDs to retrieve properties for multiple users at once. For now, recommended workarounds include: - Using an in-memory cache with TTL to reduce API calls - Using webhooks post login/signup to update data in your cache - Upgrading to a higher tier with higher rate limits - Replicating essential user data in your application database If you need to query multiple identities by ID, there's a feature request for batch querying in [GitHub issue #305](https://github.com/ory/network/issues/305).