Create a new user
POST/users
The Create User request allows you to create a new user account for ANSCER ANYA. This request takes in a JSON object in the request body that includes the user's name, email, password, and role.
Request
- application/json
Body
required
Possible values: >= 3 characters and <= 50 characters
Possible values: >= 5 characters and <= 255 characters
A Unique email address of the user
Possible values: >= 6 characters and <= 255 characters
Possible values: [developer, admin, user]
Responses
- 200
- 400
- 401
- 403
- 409
- 500
User created
- application/json
- Schema
- Example (from schema)
Schema
Possible values: >= 3 characters and <= 50 characters
Possible values: >= 5 characters and <= 255 characters
Possible values: [developer, admin, user]
createdBy object
The user who created this user
updatedBy object
The user who last updated this user
The date and time this user was created
The date and time this user was last updated
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"email": "user@example.com",
"isActive": true,
"role": "developer",
"createdBy": {
"_id": "string",
"name": "string",
"email": "user@example.com"
},
"updatedBy": {
"_id": "string",
"name": "string",
"email": "user@example.com"
},
"createdAt": "2024-12-03T13:26:27.333Z",
"updatedAt": "2024-12-03T13:26:27.333Z"
}
Bad Request due to validation errors in the request body
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Validation failed.",
"errors": [
{
"field": "name",
"message": "Name is required."
},
{
"field": "email",
"message": "Email must be a valid email address."
}
]
}
{
"message": "Validation failed.",
"errors": [
{
"field": "name",
"message": "Name is required."
},
{
"field": "email",
"message": "Email must be a valid email address."
}
]
}
Unauthorized.
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Authentication token not provided."
}
{
"message": "Authentication token not provided."
}
Forbidden.
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Access to this resource is forbidden."
}
{
"message": "Access to this resource is forbidden."
}
Already registered User with given Email address.
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Already registered User with given Email address."
}
{
"message": "Already registered User with given Email address."
}
Internal Server Error
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Internal Server Error. Please try again later."
}
{
"message": "Internal Server Error. Please try again later."
}