ĐARK々MÁTTERĐ
ZITADEL14mo ago
24 replies
ĐARK々MÁTTER

How can I create the human users programatically using APIs?

I have 2 organizations and I want to create users in them programatically based on the condition in the csv file, (I dont want to use the import feature because csv requires some transformation). I have tried with converting JSON file to jwt for management, auth and admin users and it didnt work.

go install github.com/zitadel/zitadel-tools@latest

zitadel-tools key2jwt --audience https://auth.example.com --key admin-api.json
zitadel-tools key2jwt --audience https://auth.example.com --key management-api.json
zitadel-tools key2jwt --audience https://auth.example.com --key auth-api.json


And I used in the the key in the curl, just a matter of testing whether authentication key works or not

curl -L 'https://auth.example.com/v2/users' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer JWT_KEY' \
--data-raw '{
  "query": {
    "offset": "0",
    "limit": 3,
    "asc": true
  }
}'

Error I am getting
{"code":16,"message":"Errors.Token.Invalid (AUTH-7fs1e)","details":[{"@type":"type.googleapis.com/zitadel.v1.ErrorDetail","id":"AUTH-7fs1e","message":"Errors.Token.Invalid"}]}
Was this page helpful?