Get a List of Users

DescriptionGet a list of users

URL

/api/users/search

HTTP MethodGET
Response Formatsjson | xml

Security

None

Available sinceVersion 3.6

Examples

Use CaseExample Request
Get all the active users of the SonarQube instance

GET http://localhost:9000/api/users/search

Response Format

{

    "users": [
        {
            "login": "fmallet",
            "name": "Freddy Mallet"
            "active": true,
            "email": "f@m.com"
        },
        {
            "login": "sbrandhof",
            "name": "Simon",
            "active": true
        }
    ]

}

Parameters

Parameter

Description

Required

Default Value

Example Value
includeDeactivated

Include deactivated users

No

false

true

logins

Comma-separated list of user logins.

NoNoneadmin,sbrandhof
format

Response format can be set through:

  • Parameter format: xml | json
  • Or the 'Accept' property in the HTTP header:
    • Accept:text/xml
    • Accept:application/json
If nothing is set, json is used.
NoNonejson

Create a User

DescriptionCreate a user

URL

/api/users/create

HTTP MethodPOST

Security

Requires Administer System permission

Available sinceVersion 3.7

Examples

Use CaseExample Request

Create a new user:

  • Login: myuser
  • Password: mypassword
  • Name: My Name
  • Email: myname@email.com

curl -X POST -v -u admin:admin 'http://localhost:9000/api/users/create?login=myuser&password=mypassword&password_confirmation=mypassword&name=My%20Name&email=myname@email.com'

Parameters

Parameter

Description

Required

Default Value

Example Value
login

User login.

Yes

None

myuser

password

User password.

YesNonemypassword
password_confirmation

Must be the same value as "password".

YesNonemypassword
nameUser name.NoNoneMy Name
emailUser email.NoNonemyname@email.com

Update a User

DescriptionUpdate a user

URL

/api/users/update

HTTP MethodPOST

Security

Requires Administer System permission

Available sinceVersion 3.7

Examples

Use CaseExample Request

Update user "myuser":

  • New name: My New Name
  • New email: mynewname@email.com

curl -X POST -v -u admin:admin 'http://localhost:9000/api/users/update?login=myuser&name=My%20New%20Name&email=mynewname@email.com'

Parameters

Parameter

Description

Required

Default Value

Example Value
login

User login.

Yes

None

myuser

nameUser name.NoNoneMy New Name
emailUser email.NoNonemynewname@email.com

Deactivate a User

DescriptionDeactivate a user

URL

/api/users/deactivate

HTTP MethodPOST

Security

Requires Administer System permission

Available sinceVersion 3.7

Examples

Use CaseExample Request

Deactivate user "myuser"

curl -X POST -v -u admin:admin 'http://localhost:9000/api/users/deactivate?login=myuser'

Parameters

Parameter

Description

Required

Default Value

Example Value
login

User login.

Yes

None

myuser