Create User with Keycloak rest API

Hello, I am trying to create a user via keycloak api but am getting unknown error. Any help would be appreciated

if I update the path from
http://0.0.0.0:8080/admin/realms/test-realm/users

to

http://0.0.0.0:8080/auth/admin/realms/test-realm/users

I get an error:

{
    "error": "RESTEASY003210: Could not find resource for full path: http://0.0.0.0:8080/auth/admin/realms/test-realm/users"
}

Path param /auth/ is for old version of Keycloak.

About your response with unknown_error. See Keycloak Admin REST API
In your JSON I see value of emailVerified as string. It should be boolean true/false.

Maybe this will help. Request otherwise looks correct (maybe check the keycloak’s logs).

thanks for the reply! where can I find keycloak’s logs? Im using v19.0.1, and the interface looks different than what I’m seeing on the docs and other tutorials.

I updated the emailVerified field as you suggested, now I’m getting HTTP 401 Unauthorized error. My understanding is I need to retrieve the access token via admin cli and pass that to as my bearer token in the curl request?

correction: I am on v21.0.1

Because from Keycloak (18?) started new theme of adminstration console. You can change it if you switch to master realm go to Realm Setting → tab Theme → Admin UI theme. There is keycloak and keycloak.v2. But from version 21 is old keycloak theme fully removed
(in some situations it was necessary to change the appearance because Keycloak 19 was quite buggy - example custom flow and configuration)

Yes. I am still Keycloak newbie, but you will need I think non-public client with credetials. Somethink like this

something like this:

With credentials you must call API for getting access_token. Something like this:

curl -X POST --location "http://localhost:8080/realms/yourrealm/protocol/openid-connect/token" \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "client_id=your_client_name&client_secret=your_secret&scope=email&grant_type=client_credentials"

And your next API call will contain header Authorization: Bearer $ACCESS_TOKEN

right, thank you this worked.