Is it possible to create admin user using Strapi API

Hey @Sarath_CM,

I guess you are looking for something like this:

      await strapi.db.query("admin::role").create({
        name: "Super Admin",
        code: "strapi-super-admin",
        description:
          "Super Admins can access and manage all features and settings.",
      });

After that just edit the roles-array of your admin-user (“admin::user”). :slight_smile:

If you’ve trouble adapting that maybe have a look into my strapi-plugin to easily create a default admin on startup of strapi:

1 Like