How to create new user account by API?

I am looking for a way to create a new user directly from another web application, either via the CLI or via an API call.

The fields name, username, email and password should be passed to elgg (all as plain text) and the account should then be active directly.

I haven't found out yet how to call elgg via API and how to enable the API functionality at all.

Does anyone have a ready solution for this or can help me to realize this?


  • Elgg API

    Use WebServices.

    You should register the function with the web services API framework and use to expose a method.

    Something like this:

    function user_register($name, $email, $username, $password) {
          $user = get_user_by_username($username);
          if (!$user) {
            $return['success'] = true;
            $return['guid'] = register_user($username, $password, $name, $email);
         } else {
           $return['success'] = false;
           $return['message'] = elgg_echo('registration:userexists');
       return $return;
           'name' => ['type' => 'string'],
           'email' => ['type' => 'string'],
           'username' => ['type' => 'string'],
          'password' => ['type' => 'string'],
      "Register user",


    Elgg CLI

    There aren't the internal methods.

    But we use Symfony Process library for our solutions.



    You may want to use OAuth 2.0 also

  • Thank you very much.

    I'll try it out.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking