best-plumber-65600
12/18/2024, 4:48 AMbrief-egg-61061
12/18/2024, 4:48 AMbrief-egg-61061
12/18/2024, 4:49 AMGET /admin/identities/{id}
This method requires the ID of the identity you want to retrieve. There is a listIdentities method that allows for some filtering, but it doesn't provide a way to filter by specific profile traits. The [Ory API Reference](https://www.ory.sh/docs/reference/api) shows that this method supports filtering by credential type (username, email), but not by specific trait values. A related issue was discussed in a [GitHub issue](https://github.com/ory/network/issues/305) where users requested the ability to retrieve a subset of identities through the admin API. The suggested workarounds were: 1. Poll Ory periodically for the list of identities and store them in-memory for the application to consume. 2. Use webhooks to keep a local copy of identity data in sync. 3. Execute parallel API requests for known IDs (not suitable for large numbers of identities). It's worth noting that Ory advises against adding layers of caching to your auth infrastructure due to potential security implications. In conclusion, while there isn't a direct way to get an identity by profile traits using the admin/identities API, you might need to consider alternative approaches or workarounds depending on your specific use case.best-plumber-65600
01/22/2025, 9:20 AMbrief-egg-61061
01/22/2025, 9:20 AMbrief-egg-61061
01/22/2025, 9:20 AMcredentials_identifier
and preview_credentials_identifier_similar
query parameters in the list identities API. These parameters are part of the GET /admin/identities
endpoint. According to the [Ory API Reference](https://www.ory.sh/docs/reference/api) and [Kratos API Reference](https://www.ory.sh/docs/kratos/reference/api), here's how you can use these parameters: 1. `credentials_identifier`: - This parameter is used for an exact match lookup of credentials. - It can be used to find an identity by its identifier (username or email). - Only one of credentials_identifier
or preview_credentials_identifier_similar
can be used at a time. Example usage: GET /admin/identities?credentials_identifier=user@example.com
2. `preview_credentials_identifier_similar`: - This is an experimental parameter for similarity search of credentials. - It can be used to find identities with partially matching identifiers. - This parameter is marked as EXPERIMENTAL and may change or be removed in future releases. - Only one of credentials_identifier
or preview_credentials_identifier_similar
can be used at a time. Example usage: GET /admin/identities?preview_credentials_identifier_similar=user
It's important to note a few things: 1. These parameters cannot be combined with other filters. 2. The preview_credentials_identifier_similar
parameter is experimental and not recommended for production use. 3. The API documentation warns: "THIS PARAMETER WILL BE REMOVED IN AN UPCOMING RELEASE WITHOUT ANY MIGRATION PATH." When using these parameters, keep in mind that they are part of the query string in the URL, and you should properly encode any special characters. Remember that while these parameters provide a way to search for identities based on credentials, they don't allow for searching based on specific profile traits as discussed in our previous interaction. [Ory API Reference](https://www.ory.sh/docs/reference/api) provides more details on other available parameters and response formats for this endpoint.best-plumber-65600
01/22/2025, 9:21 AMbrief-egg-61061
01/22/2025, 9:21 AMbrief-egg-61061
01/22/2025, 9:21 AMcredentials_identifier
and preview_credentials_identifier_similar
query parameters in the list identities API. These examples are based on the information from the [Ory API Reference](https://www.ory.sh/docs/reference/api) and [Kratos API Reference](https://www.ory.sh/docs/kratos/reference/api). 1. Using credentials_identifier
for exact match: GET <https://your-project.projects.oryapis.com/admin/identities?credentials_identifier=john.doe@example.com>
This query will search for an identity with the exact email "john.doe@example.com". 2. Using preview_credentials_identifier_similar
for similarity search: GET <https://your-project.projects.oryapis.com/admin/identities?preview_credentials_identifier_similar=john>
This query will search for identities with credentials similar to "john". It might return results like "john.doe@example.com", "johnny@example.com", etc. Remember that the preview_credentials_identifier_similar
parameter is experimental and may be removed in future releases. You can also combine these parameters with other query parameters, such as page_size
to limit the number of results: GET <https://your-project.projects.oryapis.com/admin/identities?credentials_identifier=john.doe@example.com&page_size=10>
This query will search for the exact email "john.doe@example.com" and limit the results to 10 items per page. Please note that you should replace "your-project" with your actual Ory project slug in these URLs. Also, ensure that you have the necessary authentication (typically an API key) when making these requests to the admin API. [Ory API Reference](https://www.ory.sh/docs/reference/api) provides more details on other available parameters and response formats for this endpoint.best-plumber-65600
01/22/2025, 9:23 AMbrief-egg-61061
01/22/2025, 9:23 AMbrief-egg-61061
01/22/2025, 9:23 AMcredentials_identifier
parameters to filter identities by both email and phone in a single API call. The [Ory API Reference](https://www.ory.sh/docs/reference/api) indicates that the credentials_identifier
parameter is used for an exact match lookup of credentials, and it doesn't mention the ability to provide multiple identifiers in a single request. However, there are a couple of relevant points to consider: 1. The API documentation states that "Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used." This suggests that you can't use multiple credential identifiers in a single request. 2. The identity schema can be customized to include multiple identifiers. As shown in the [Identity schema extensions documentation](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#identity-schema-extensions), you can define both email and phone as identifiers: json { "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true } } } }
This can be applied to both email and phone fields in your schema. Given these limitations, if you need to filter by both email and phone, you might need to: 1. Make separate API calls for each identifier type. 2. Retrieve a larger set of identities and filter them on your side. 3. Consider using the preview_credentials_identifier_similar
parameter if a partial match could suffice, though this is experimental and not recommended for production use. If this functionality is crucial for your use case, you might want to reach out to Ory support or consider opening a feature request on their GitHub repository for enhanced filtering capabilities.