New Ory Agent Security is now live! Claim your complimentary test drive. Get Started!

Skip to main content

Identity state

The identity state determines whether an identity is active or not with the following states:

  • active - The identity can use self-service flows such as sign-in.
  • inactive - The identity can't use self-service flows.

When an inactive identity tries to sign in, the server responds with a UI error. For password sign-in:

  • By default, the server responds with error 4010011, which states that the account is disabled.
  • With account enumeration mitigation enabled, the server responds with error 4000006, the same response as for an identifier that doesn't exist.

De-activating an identity revokes all of its sessions. Activating the identity again doesn't restore them: the user must sign in again.

Change identity state using the SDK​

Use the SDK to activate and de-activate identities:

// Copyright © 2026 Ory Corp

import { Configuration, IdentityApi } from "@ory/client"
import { JsonPatchOpEnum } from "@ory/client/api"

const identity = new IdentityApi(
new Configuration({
basePath: `https://${process.env.ORY_PROJECT_SLUG}.projects.oryapis.com`,
accessToken: process.env.ORY_API_KEY,
}),
)

export async function setState(
identityId: string,
state: "active" | "inactive",
) {
return await identity
.patchIdentity({
id: identityId,
jsonPatch: [
{
op: JsonPatchOpEnum.Replace,
value: state,
path: "/state",
},
],
})
.then(({ data }) => data)
}