.. _CreateUser: CreateUser ========== Create a database user and assign existing roles. Requires ``access_control.create`` permission. No input or output blobs are used. Parameters ---------- * ``username`` (string, required): at least four characters, no whitespace, and no leading underscore. * ``password`` (string, required): at least ten characters with a letter, digit, and punctuation; no whitespace or unsupported characters. * ``roles`` (array of strings, required): names of existing roles; may be empty. * ``email`` (string, optional): defaults to an empty string. Behavior -------- The username must be new and every assigned role must exist. Roles created earlier in the same query are available. All changes roll back if execution of any command fails. The user receives the combined permissions of its roles; see :doc:`../AccessControl`. Response -------- Success returns ``status: 0``. Failures return a negative ``status`` and an ``info`` message; see :doc:`../Responses` for error envelopes and retry guidance. Examples -------- .. TESTED_EXAMPLE: CreateUser_1 .. code-block:: json [{ "CreateUser": { "username": "john", "password": "love4Aperture!", "roles": ["admin", "user", "architect"], "email": "jfk@aperturedata.io" } }] Response: .. TESTED_EXAMPLE: CreateUser_1_response .. code-block:: json [{ "CreateUser": { "status": 0 } }]