How to Use REST API ? and what are the Endpoints for Sugarcrm for Enterprise edition ? for User Management

I am looking for API which will handle User Management endpoints. example - Create User, Delete userr, assign roles to the user etc. please suggest. thanks in advance !

  • You can also just use the BeanFactory class to create users. Not sure what your intended end use of this question is, but you can use the BeanFactory from within a custom API endpoint or even from the CLI functionality added into sugar at version 7.7


    $user = BeanFactory::newBean('Users');
            $user->new_with_id = true;
            $user->id = Uuid::uuid4();
            if you are adding this to CLI, add use Sugarcrm\Sugarcrm\Util\Uuid;

            $user->user_name = 'some username';
            $user->first_name = 'some first name';
            $user->last_name = 'some last name';
            $user->email1 = 'an email';
            $user->user_hash = Hash::getInstance()->hash('some password here');
            if you are adding this to CLI, you need to add use Sugarcrm\Sugarcrm\Security\Password\Hash;

            $user->is_admin = 0;
            $user->status = 'Active';

    You probably want to check how many licenses you have left, before you create a user, this is something you can check in the config table of your sugar database.

    Doing all that correctly will create a non-admin user for your instance.

    You will need to also add some role to the user if you do it this way, which you can do via

            $role = new ACLRole();
                    'role_id' => 'some role id',
                    'user_id' => 'the id from the above bean'

    To check what ids the role names your instance has refer to, you can do with this query (although you may also want to check via the GUI the roles to give yourself a reminder about what role has access to which modules...)

    SELECT id FROM acl_roles WHERE `name` = 'name of the role' AND deleted = 0;

    As well as a team..


    Here you basically are interested in the add_user_to_team method.

    Deactivating a user is trivial, you can use the Sugar beans again to do this:

            $bean = BeanFactory::retrieveBean('Users', $userId);
            //where $userId should correspond to the value of column id in table users
            if(!empty($bean)) {
                $bean->status = 'Inactive';
  • Hi,

    Actually the agenda here is I wanted to create user and do some manipulations on the Sugarcrm from outside of it. so looking for an API.

    Thanks for the suggestion will try !

  • I think in that case you can add all that functionality into a custom API endpoint, just be aware that you will need to use the oauth authentication to get into the Sugar API.

    A useful link about using the API:…