# Create New User

## Request

```CURL
POST [[[<REST API URL>|Hub-Rest-Api-URL.html]]]/users?fields=string
```

|  Parameter  |  Description  |
| --- | --- |
|  `fields`  |  Optional. Returns only the specified subset of the fields for each User. Use [Fields Syntax](hub-api-fields-syntax.html) to define the subset.  |

### Request Body

#### user

extends [authorityHolder](HUB-REST-API_JSON-Scheme.html#authorityHolder)

extended by [invitedUser](HUB-REST-API_JSON-Scheme.html#invitedUser)

```JSON
{
  "login": string, 
  "banned": boolean, 
  "banReason": string, 
  "bannedInAuthModule": [[[authmodule|HUB-REST-API_JSON-Scheme.html#authmodule]]], 
  "banBadge": string, 
  "guest": boolean, 
  "avatar": [[[avatar|HUB-REST-API_JSON-Scheme.html#avatar]]], 
  "profile": [[[profile|HUB-REST-API_JSON-Scheme.html#profile]]], 
  "groups": [[[[userGroup|HUB-REST-API_JSON-Scheme.html#userGroup]]], ...], 
  "transitiveGroups": [[[[userGroup|HUB-REST-API_JSON-Scheme.html#userGroup]]], ...], 
  "details": [[[[details|HUB-REST-API_JSON-Scheme.html#details]]], ...], 
  "VCSUserNames": [[[[vcsUserName|HUB-REST-API_JSON-Scheme.html#vcsUserName]]], ...], 
  "sshPublicKeys": [[[[sshPublicKey|HUB-REST-API_JSON-Scheme.html#sshPublicKey]]], ...], 
  "creationTime": calendar, 
  "lastAccessTime": calendar, 
  "refreshTokens": [[[[refreshToken|HUB-REST-API_JSON-Scheme.html#refreshToken]]], ...], 
  "permanentTokens": [[[[permanentToken|HUB-REST-API_JSON-Scheme.html#permanentToken]]], ...], 
  "approvedScopes": [[[[approvedScope|HUB-REST-API_JSON-Scheme.html#approvedScope]]], ...], 
  "applicationPasswords": [[[[applicationPassword|HUB-REST-API_JSON-Scheme.html#applicationPassword]]], ...], 
  "favoriteProjects": [[[[project|HUB-REST-API_JSON-Scheme.html#project]]], ...], 
  "endUserAgreementConsent": [[[endUserAgreementConsent|HUB-REST-API_JSON-Scheme.html#endUserAgreementConsent]]], 
  "eraseTimestamp": calendar, 
  "twoFactorAuthentication": [[[twoFactorAuthentication|HUB-REST-API_JSON-Scheme.html#twoFactorAuthentication]]], 
  "requiredTwoFactorAuthentication": boolean, 
  "pendingTwoFactorAuthentication": [[[twoFactorAuthenticationSecret|HUB-REST-API_JSON-Scheme.html#twoFactorAuthenticationSecret]]], 
  "webauthnDevice": [[[webauthnDevice|HUB-REST-API_JSON-Scheme.html#webauthnDevice]]], 
  "permissions": [string, ...], 
    "name": string , 
    "projectRoles": [[[[projectRole|HUB-REST-API_JSON-Scheme.html#projectRole]]], ...] , 
    "transitiveProjectRoles": [[[[projectRole|HUB-REST-API_JSON-Scheme.html#projectRole]]], ...] , 
    "sourcedProjectRoles": [[[[sourcedProjectRole|HUB-REST-API_JSON-Scheme.html#sourcedProjectRole]]], ...] , 
    "id": string , 
    "aliases": [[[[alias|HUB-REST-API_JSON-Scheme.html#alias]]], ...] 
}
```

## Response

|  Response Code  |  Meaning  |
| --- | --- |
|  200 OK  |  Successful request.  |
|  400 Bad Request  |  At least one of the request parameters is invalid. For example, a required field in the passed JSON object is missing. For details, check the error message in the response.  |
|  403 Forbidden  |  The requester has no access to the requested resource.  |
|  404 Not Found  |  The requested resource was not found.  |
|  500 Internal Server Error  |  Failed to process request because of the server error. For details, check the error message in the response.  |

### Response body

```JSON
{
  "login": string, 
  "banned": boolean, 
  "banReason": string, 
  "bannedInAuthModule": [[[authmodule|HUB-REST-API_JSON-Scheme.html#authmodule]]], 
  "banBadge": string, 
  "guest": boolean, 
  "avatar": [[[avatar|HUB-REST-API_JSON-Scheme.html#avatar]]], 
  "profile": [[[profile|HUB-REST-API_JSON-Scheme.html#profile]]], 
  "groups": [[[[userGroup|HUB-REST-API_JSON-Scheme.html#userGroup]]], ...], 
  "transitiveGroups": [[[[userGroup|HUB-REST-API_JSON-Scheme.html#userGroup]]], ...], 
  "details": [[[[details|HUB-REST-API_JSON-Scheme.html#details]]], ...], 
  "VCSUserNames": [[[[vcsUserName|HUB-REST-API_JSON-Scheme.html#vcsUserName]]], ...], 
  "sshPublicKeys": [[[[sshPublicKey|HUB-REST-API_JSON-Scheme.html#sshPublicKey]]], ...], 
  "creationTime": calendar, 
  "lastAccessTime": calendar, 
  "refreshTokens": [[[[refreshToken|HUB-REST-API_JSON-Scheme.html#refreshToken]]], ...], 
  "permanentTokens": [[[[permanentToken|HUB-REST-API_JSON-Scheme.html#permanentToken]]], ...], 
  "approvedScopes": [[[[approvedScope|HUB-REST-API_JSON-Scheme.html#approvedScope]]], ...], 
  "applicationPasswords": [[[[applicationPassword|HUB-REST-API_JSON-Scheme.html#applicationPassword]]], ...], 
  "favoriteProjects": [[[[project|HUB-REST-API_JSON-Scheme.html#project]]], ...], 
  "endUserAgreementConsent": [[[endUserAgreementConsent|HUB-REST-API_JSON-Scheme.html#endUserAgreementConsent]]], 
  "eraseTimestamp": calendar, 
  "twoFactorAuthentication": [[[twoFactorAuthentication|HUB-REST-API_JSON-Scheme.html#twoFactorAuthentication]]], 
  "requiredTwoFactorAuthentication": boolean, 
  "pendingTwoFactorAuthentication": [[[twoFactorAuthenticationSecret|HUB-REST-API_JSON-Scheme.html#twoFactorAuthenticationSecret]]], 
  "webauthnDevice": [[[webauthnDevice|HUB-REST-API_JSON-Scheme.html#webauthnDevice]]], 
  "permissions": [string, ...], 
    "name": string , 
    "projectRoles": [[[[projectRole|HUB-REST-API_JSON-Scheme.html#projectRole]]], ...] , 
    "transitiveProjectRoles": [[[[projectRole|HUB-REST-API_JSON-Scheme.html#projectRole]]], ...] , 
    "sourcedProjectRoles": [[[[sourcedProjectRole|HUB-REST-API_JSON-Scheme.html#sourcedProjectRole]]], ...] , 
    "id": string , 
    "aliases": [[[[alias|HUB-REST-API_JSON-Scheme.html#alias]]], ...] 
}
```

