Ory.Api.Identity (ory_client v1.1.23)

API calls for all endpoints tagged Identity.

Link to this section Summary

Functions

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.

Link to this section Functions

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

Parameters

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

returns

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

Parameters

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

returns

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

Parameters

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

returns

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, Ory.Model.ErrorGeneric.t()}
  | {:ok, Ory.Model.Identity.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

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • type (String.t): Type is the credential's Type. One of totp, webauthn, lookup
  • opts (keyword): Optional parameters

returns

Returns

  • {:ok, Ory.Model.Identity.t} 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

Parameters

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

returns

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

Parameters

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

returns

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

Parameters

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

returns

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

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 Currently, only oidc is supported. This will return the initial OAuth 2.0 Access, Refresh and (optionally) OpenID Connect ID Token.

returns

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

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

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

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

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

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :per_page (integer()): Items per Page This is the number of items per page.
    • :page (integer()): Pagination Page 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.
    • :credentials_identifier (String.t): CredentialsIdentifier is the identifier (username, email) of the credentials to look up.

returns

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

Parameters

  • connection (Ory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :per_page (integer()): Items per Page This is the number of items per page.
    • :page (integer()): Pagination Page 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.

returns

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

Parameters

  • connection (Ory.Connection): Connection to server
  • id (String.t): ID is the identity's ID.
  • opts (keyword): Optional parameters
    • :per_page (integer()): Items per Page This is the number of items per page.
    • :page (integer()): Pagination Page 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.
    • :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

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

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

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

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

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

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

Returns

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