createUser
const url = 'https://example.com/api/v1/users';const options = { method: 'POST', headers: {'X-CSRF-Token': 'example', 'Content-Type': 'application/json'}, body: '{"name":"example","username":"example","password":"example","role":"owner","active":true,"contentAccess":{"libraryMode":"all","tagMode":"all","folderIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"tagIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"]},"screenAccess":{"mode":"all","scopes":[{"type":"location","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","name":"example"}]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/users \ --header 'Content-Type: application/json' \ --header 'X-CSRF-Token: example' \ --data '{ "name": "example", "username": "example", "password": "example", "role": "owner", "active": true, "contentAccess": { "libraryMode": "all", "tagMode": "all", "folderIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "tagIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }, "screenAccess": { "mode": "all", "scopes": [ { "type": "location", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example" } ] } }'Create a dashboard user account. Requires the users.manage capability and the admin scope. Only an Owner may assign the Owner or Administrator role, or a role that grants a capability the caller does not hold. Cookie-authenticated unsafe requests require X-CSRF-Token.
Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Role key. The built-in roles are owner, administrator, editor, contributor, and viewer. Custom role keys start with “custom.”. Decide authorization from the capabilities the server reports, not from the role key.
Media library access for the new account. When omitted, the account receives the creator’s own library and tag modes with no grants.
object
Granted folders; each covers its descendants.
Tags the account may apply and remove.
Screen access for the new account, written in the same transaction as the account. When omitted, the account is restricted with no grants and reaches no screen. An Owner always reaches every screen. A caller with restricted screen access may grant only locations and Display Groups granted to it directly (screen_scope_delegation).
object
All reaches every screen. restricted reaches the union of the granted locations and Display Groups, and nothing without grants.
Grants for restricted access. Must be empty for all.
object
Responses
Section titled “ Responses ”User account created
object
object
Role key. The built-in roles are owner, administrator, editor, contributor, and viewer. Custom role keys start with “custom.”. Decide authorization from the capabilities the server reports, not from the role key.
Example
{ "data": { "role": "owner" }}Invalid request body
Dashboard authentication required
Insufficient role, or screen access the caller may not delegate
Username already in use
Name, username, password, role, or screen access invalid