How to list identities with Active lifecycle status?

I am trying to list all identities with a given lifecycle status (eg: Active, Terminated etc) using APIs and unsure what to use. I am using /beta/public-identities to list all my identities and trying to use /cc/api/user/preview/{id} to list all the identity attribute values but getting a message that this method is not allowed.

Is there an API where I could filter identities based on the lifecycle state (I tried passing a parameter attributes.cloudLifecycleState to /beta/public-identities but didn’t work)

Thanks!

Welcome to the developer community Pavani,

You can use the search API to accomplish this. An example of a request body you can use is as follows:

{
    "query": {
        "query": "status:ACTIVE"
    },
    "indices": [
        "identities"
    ]
}

Please see our search documentation for more information on searchable fields.