Ory.Api.Identity (ory_client v1.6.2)

API calls for all endpoints tagged Identity.

Summary

Functions

Create and deletes multiple identities Creates or delete multiple identities. This endpoint can also be used to import credentials for instance passwords, social sign in configurations or multifactor methods.

Create an Identity Create an identity. This endpoint can also be used to import credentials for instance passwords, social sign in configurations or multifactor methods.

Create a Recovery Code This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account.

Create a Recovery Link This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account.

Delete an Identity Calling this endpoint irrecoverably and permanently deletes the identity given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already.

Delete a credential for a specific identity Delete an identity credential by its type You can only delete second factor (aal2) credentials.

Delete & Invalidate an Identity's Sessions Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.

Deactivate a Session Calling this endpoint deactivates the specified session. Session data is not deleted.

Extend a Session Calling this endpoint extends the given session ID. If session.earliest_possible_extend is set it will only extend the session after the specified time has passed. Retrieve the session ID from the /sessions/whoami endpoint / toSession SDK method.

Get an Identity Return an identity by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the include_credential query parameter.

Get Identity JSON Schema Return a specific identity schema.

Get Session This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context.

List Identities Lists all identities in the system.

Get all Identity Schemas Returns a list of all identity schemas currently in use.

List an Identity's Sessions This endpoint returns all sessions that belong to the given Identity.

List All Sessions Listing all sessions that exist.

Patch an Identity Partially updates an identity's field using JSON Patch. The fields id, stateChangedAt and credentials can not be updated using this method.

Update an Identity This endpoint updates an identity. The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well.

Functions

Link to this function

batch_patch_identities(connection, opts \\ [])

@spec batch_patch_identities(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.BatchPatchIdentitiesResponse.t()}
  | {:error, Tesla.Env.t()}

Create and deletes multiple identities Creates or delete multiple identities. This endpoint can also be used to import credentials for instance passwords, social sign in configurations or multifactor methods.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :body (PatchIdentitiesBody):

Returns

  • {:ok, Ory.Model.BatchPatchIdentitiesResponse.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

create_identity(connection, opts \\ [])

@spec create_identity(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Identity.t()}
  | {:error, Tesla.Env.t()}

Create an Identity Create an identity. This endpoint can also be used to import credentials for instance passwords, social sign in configurations or multifactor methods.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :body (CreateIdentityBody):

Returns

  • {:ok, Ory.Model.Identity.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

create_recovery_code_for_identity(connection, opts \\ [])

@spec create_recovery_code_for_identity(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.RecoveryCodeForIdentity.t()}
  | {:error, Tesla.Env.t()}

Create a Recovery Code This endpoint creates a recovery code which should be given to the user in order for them to recover (or activate) their account.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :body (CreateRecoveryCodeForIdentityBody):

Returns

  • {:ok, Ory.Model.RecoveryCodeForIdentity.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

delete_identity(connection, id, opts \\ [])

@spec delete_identity(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:ok, Ory.Model.ErrorGeneric.t()} | {:error, Tesla.Env.t()}

Delete an Identity Calling this endpoint irrecoverably and permanently deletes the identity given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

delete_identity_credentials(connection, id, type, opts \\ [])

@spec delete_identity_credentials(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, nil} | {:ok, Ory.Model.ErrorGeneric.t()} | {:error, Tesla.Env.t()}

Delete a credential for a specific identity Delete an identity credential by its type You can only delete second factor (aal2) credentials.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • type (String.t): Type is the type of credentials to be deleted. password CredentialsTypePassword oidc CredentialsTypeOIDC totp CredentialsTypeTOTP lookup_secret CredentialsTypeLookup webauthn CredentialsTypeWebAuthn code CredentialsTypeCodeAuth link_recovery CredentialsTypeRecoveryLink CredentialsTypeRecoveryLink is a special credential type linked to the link strategy (recovery flow). It is not used within the credentials object itself. code_recovery CredentialsTypeRecoveryCode
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

delete_identity_sessions(connection, id, opts \\ [])

@spec delete_identity_sessions(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:ok, Ory.Model.ErrorGeneric.t()} | {:error, Tesla.Env.t()}

Delete & Invalidate an Identity's Sessions Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

disable_session(connection, id, opts \\ [])

@spec disable_session(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:ok, Ory.Model.ErrorGeneric.t()} | {:error, Tesla.Env.t()}

Deactivate a Session Calling this endpoint deactivates the specified session. Session data is not deleted.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the session's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

extend_session(connection, id, opts \\ [])

@spec extend_session(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Session.t()}
  | {:error, Tesla.Env.t()}

Extend a Session Calling this endpoint extends the given session ID. If session.earliest_possible_extend is set it will only extend the session after the specified time has passed. Retrieve the session ID from the /sessions/whoami endpoint / toSession SDK method.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the session's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Ory.Model.Session.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

get_identity(connection, id, opts \\ [])

@spec get_identity(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Identity.t()}
  | {:error, Tesla.Env.t()}

Get an Identity Return an identity by its ID. You can optionally include credentials (e.g. social sign in connections) in the response by using the include_credential query parameter.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID must be set to the ID of identity you want to get
  • opts (keyword): Optional parameters
    • :include_credential ([String.t]): Include Credentials in Response Include any credential, for example password or oidc, in the response. When set to oidc, This will return the initial OAuth 2.0 Access Token, OAuth 2.0 Refresh Token and the OpenID Connect ID Token if available.

Returns

  • {:ok, Ory.Model.Identity.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

get_identity_schema(connection, id, opts \\ [])

@spec get_identity_schema(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()} | {:ok, Map.t()} | {:error, Tesla.Env.t()}

Get Identity JSON Schema Return a specific identity schema.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID must be set to the ID of schema you want to get
  • opts (keyword): Optional parameters

Returns

  • {:ok, map()} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

get_session(connection, id, opts \\ [])

@spec get_session(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Session.t()}
  | {:error, Tesla.Env.t()}

Get Session This endpoint is useful for: Getting a session object with all specified expandables that exist in an administrative context.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the session's ID.
  • opts (keyword): Optional parameters
    • :expand ([String.t]): ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. Example - ?expand=Identity&expand=Devices If no value is provided, the expandable properties are skipped.

Returns

  • {:ok, Ory.Model.Session.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

list_identities(connection, opts \\ [])

@spec list_identities(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, [Ory.Model.Identity.t()]}
  | {:error, Tesla.Env.t()}

List Identities Lists all identities in the system.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :per_page (integer()): Deprecated Items per Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This is the number of items per page.
    • :page (integer()): Deprecated Pagination Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the Link header.
    • :page_size (integer()): Page Size This is the number of items per page to return. For details on pagination please head over to the pagination documentation.
    • :page_token (String.t): Next Page Token The next page token. For details on pagination please head over to the pagination documentation.
    • :consistency (String.t): Read Consistency Level (preview) The read consistency level determines the consistency guarantee for reads: strong (slow): The read is guaranteed to return the most recent data committed at the start of the read. eventual (very fast): The result will return data that is about 4.8 seconds old. The default consistency guarantee can be changed in the Ory Network Console or using the Ory CLI with ory patch project --replace '/previews/default_read_consistency_level="strong"'. Setting the default consistency level to eventual may cause regressions in the future as we add consistency controls to more APIs. Currently, the following APIs will be affected by this setting: GET /admin/identities This feature is in preview and only available in Ory Network. ConsistencyLevelUnset ConsistencyLevelUnset is the unset / default consistency level. strong ConsistencyLevelStrong ConsistencyLevelStrong is the strong consistency level. eventual ConsistencyLevelEventual ConsistencyLevelEventual is the eventual consistency level using follower read timestamps.
    • :ids ([String.t]): List of ids used to filter identities. If this list is empty, then no filter will be applied.
    • :credentials_identifier (String.t): CredentialsIdentifier is the identifier (username, email) of the credentials to look up using exact match. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used.
    • :preview_credentials_identifier_similar (String.t): This is an EXPERIMENTAL parameter that WILL CHANGE. Do NOT rely on consistent, deterministic behavior. THIS PARAMETER WILL BE REMOVED IN AN UPCOMING RELEASE WITHOUT ANY MIGRATION PATH. CredentialsIdentifierSimilar is the (partial) identifier (username, email) of the credentials to look up using similarity search. Only one of CredentialsIdentifier and CredentialsIdentifierSimilar can be used.

Returns

  • {:ok, [%Identity{}, ...]} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

list_identity_schemas(connection, opts \\ [])

@spec list_identity_schemas(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, [Ory.Model.IdentitySchemaContainer.t()]}
  | {:error, Tesla.Env.t()}

Get all Identity Schemas Returns a list of all identity schemas currently in use.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :per_page (integer()): Deprecated Items per Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This is the number of items per page.
    • :page (integer()): Deprecated Pagination Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the Link header.
    • :page_size (integer()): Page Size This is the number of items per page to return. For details on pagination please head over to the pagination documentation.
    • :page_token (String.t): Next Page Token The next page token. For details on pagination please head over to the pagination documentation.

Returns

  • {:ok, [%IdentitySchemaContainer{}, ...]} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

list_identity_sessions(connection, id, opts \\ [])

@spec list_identity_sessions(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [Ory.Model.Session.t()]}
  | {:ok, Ory.Model.ErrorGeneric.t()}
  | {:error, Tesla.Env.t()}

List an Identity's Sessions This endpoint returns all sessions that belong to the given Identity.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • opts (keyword): Optional parameters
    • :per_page (integer()): Deprecated Items per Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This is the number of items per page.
    • :page (integer()): Deprecated Pagination Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the Link header.
    • :page_size (integer()): Page Size This is the number of items per page to return. For details on pagination please head over to the pagination documentation.
    • :page_token (String.t): Next Page Token The next page token. For details on pagination please head over to the pagination documentation.
    • :active (boolean()): Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned.

Returns

  • {:ok, [%Session{}, ...]} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

list_sessions(connection, opts \\ [])

@spec list_sessions(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, [Ory.Model.Session.t()]}
  | {:ok, Ory.Model.ErrorGeneric.t()}
  | {:error, Tesla.Env.t()}

List All Sessions Listing all sessions that exist.

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :page_size (integer()): Items per Page This is the number of items per page to return. For details on pagination please head over to the pagination documentation.
    • :page_token (String.t): Next Page Token The next page token. For details on pagination please head over to the pagination documentation.
    • :active (boolean()): Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned.
    • :expand ([String.t]): ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. If no value is provided, the expandable properties are skipped.

Returns

  • {:ok, [%Session{}, ...]} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

patch_identity(connection, id, opts \\ [])

@spec patch_identity(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Identity.t()}
  | {:error, Tesla.Env.t()}

Patch an Identity Partially updates an identity's field using JSON Patch. The fields id, stateChangedAt and credentials can not be updated using this method.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID must be set to the ID of identity you want to update
  • opts (keyword): Optional parameters
    • :body ([Ory.Model.JsonPatch.t]):

Returns

  • {:ok, Ory.Model.Identity.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

update_identity(connection, id, opts \\ [])

@spec update_identity(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Identity.t()}
  | {:error, Tesla.Env.t()}

Update an Identity This endpoint updates an identity. The full identity payload (except credentials) is expected. It is possible to update the identity's credentials as well.

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID must be set to the ID of identity you want to update
  • opts (keyword): Optional parameters
    • :body (UpdateIdentityBody):

Returns

  • {:ok, Ory.Model.Identity.t} on success
  • {:error, Tesla.Env.t} on failure