Intercode SaaS Kit
  • Welcome to SaaS Starter Kit
  • Getting Started
    • Technology stack
    • Database Setup
    • Local Environment Setup
  • Basics
    • Dependencies
    • App architecture
    • Deployment
    • App roles
    • Endpoints List
      • Auth
      • Two Factor Auth
      • Businesses
      • Demo
      • Email
      • Export Document
      • Email Files
      • Files Demo
      • Leads
      • Orders
      • Payments
      • Subscriptions
      • Teams
      • Team Memberships
      • User Admin
  • Animation and Styles
    • Framer Motion
    • Ant Design and Styles
  • Pages
    • Auth
      • Working with PassportJS
      • Two-Factor Auth
      • OAuth Providers
    • Leads
    • Businesses
    • Team management
      • Ownership
    • Profile
    • User Settings
      • App Tour
    • App Settings
      • Lead Statuses
    • Dashboard
      • Lead volume widget
      • Doughnut chart widget
      • Recent leads table widget
      • Lead count over period widget
    • Demo
  • Features
    • Impersonation
    • Subscriptions (Stripe)
    • Search
    • Sentry
    • Captcha
    • Audit Logs
    • Internationalization
  • External integrations
    • Mailer
    • Google oAuth2
    • Facebook oAuth2
    • S3 compatible storage (AWS, MinIO)
Powered by GitBook
On this page
  1. Basics
  2. Endpoints List

User Admin

PreviousTeam MembershipsNextFramer Motion

Last updated 6 months ago

GET

POST

PATCH

PUT

DELETE

Retrieves all user roles.

get
Responses
200
User roles retrieved successfully
application/json
get
GET /users/user-roles HTTP/1.1
Host: 
Accept: */*
200

User roles retrieved successfully

[
  {
    "id": 1,
    "name": "Admin"
  }
]

Searches for users based on the provided search term.

get
Responses
200
Users retrieved successfully
application/json
400
Invalid search term
application/json
get
GET /users/search HTTP/1.1
Host: 
Accept: */*
[
  {
    "id": 1,
    "email": "user@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "roles": [
      {
        "id": 1,
        "name": "Admin"
      }
    ]
  }
]

Retrieves a user by their ID.

get
Path parameters
idstringRequired
Responses
200
User retrieved successfully
application/json
400
Invalid user ID
application/json
404
User not found
application/json
get
GET /users/{id} HTTP/1.1
Host: 
Accept: */*
{
  "id": 1,
  "email": "user@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "status": "active",
  "roles": [
    {
      "id": 1,
      "name": "Admin"
    }
  ]
}

Retrieves a photo by its file name.

get
Path parameters
fileNamestringRequired
Responses
200
Photo retrieved successfully
application/json
Responsestring · binary
404
Photo not found
application/json
get
GET /users/get-photo/{fileName} HTTP/1.1
Host: 
Accept: */*
binary

Toggles the tour completion status for the authenticated user.

patch
Responses
200
Tour completion status toggled successfully
application/json
ResponseanyExample: {"message":"Tour completion status toggled successfully","description":"The tour completion status has been toggled successfully."}
404
User not found
application/json
500
Internal server error
application/json
patch
PATCH /users/tour HTTP/1.1
Host: 
Accept: */*
{
  "message": "Tour completion status toggled successfully",
  "description": "The tour completion status has been toggled successfully."
}

Deletes a photo by its file name.

delete
Path parameters
fileNamestringRequired
Responses
200
Photo deleted successfully
application/json
ResponseanyExample: {"message":"Photo deleted successfully","description":"The photo has been deleted successfully."}
404
Photo not found
application/json
500
Internal server error
application/json
delete
DELETE /users/delete-photo/{fileName} HTTP/1.1
Host: 
Accept: */*
{
  "message": "Photo deleted successfully",
  "description": "The photo has been deleted successfully."
}
  • GET
  • GETRetrieves all user roles.
  • GETSearches for users based on the provided search term.
  • GETRetrieves a user by their ID.
  • GETRetrieves a photo by its file name.
  • POST
  • POSTRetrieves all users based on the provided search parameters.
  • POSTUploads a photo for the authenticated user.
  • PATCH
  • PATCHArchives multiple users.
  • PATCHRestores multiple archived users.
  • PATCHToggles the tour completion status for the authenticated user.
  • PUT
  • PUTUpdates a user.
  • PUTUpdates the profile of the authenticated user.
  • DELETE
  • DELETEDeletes multiple users.
  • DELETEDeletes a photo by its file name.

Retrieves all users based on the provided search parameters.

post
Body
isDeletedbooleanRequired

Indicates if deleted users should be included

Example: false
globalSearchstring | nullableRequired

Global search term

Example: search term
sortFieldstring | nullableRequired

Field to sort by

Example: createdAt
sortOrderstring · enum | nullableRequired

Order to sort by

Example: ASCPossible values:
Responses
200
Users retrieved successfully
application/json
400
Invalid search parameters
application/json
post
POST /users HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 135

{
  "isDeleted": false,
  "globalSearch": "search term",
  "status": [
    "Active"
  ],
  "roles": [
    "Admin",
    "User"
  ],
  "sortField": "createdAt",
  "sortOrder": "ASC"
}
{
  "count": 10,
  "users": [
    {
      "id": 1,
      "email": "user@example.com",
      "firstName": "John",
      "lastName": "Doe",
      "status": "active",
      "roles": [
        {
          "id": 1,
          "name": "Admin"
        }
      ]
    }
  ]
}

Uploads a photo for the authenticated user.

post
Body
photostring · binaryOptional
Responses
200
Photo uploaded successfully
application/json
ResponsestringExample: formatted_file_name.jpg
400
Invalid file
application/json
post
POST /users/upload-photo HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 18

{
  "photo": "binary"
}
formatted_file_name.jpg

Archives multiple users.

patch
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Users archived successfully
application/json
ResponseanyExample: {"message":"Users archived successfully","description":"The users have been archived successfully."}
400
One or more users not found
application/json
403
Access denied
application/json
500
Internal server error
application/json
patch
PATCH /users/archive HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
{
  "message": "Users archived successfully",
  "description": "The users have been archived successfully."
}

Restores multiple archived users.

patch
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Users restored successfully
application/json
ResponseanyExample: {"message":"Users restored successfully","description":"The users have been restored successfully."}
400
One or more users not found
application/json
403
Access denied
application/json
500
Internal server error
application/json
patch
PATCH /users/restore HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
{
  "message": "Users restored successfully",
  "description": "The users have been restored successfully."
}

Updates a user.

put
Body
idnumberOptionalExample: 1
roleIdsnumber[] | nullableOptionalExample: [1,2,3]
Responses
200
User updated successfully
application/json
ResponseanyExample: {"message":"User updated successfully","description":"The user has been updated successfully."}
400
Invalid user data
application/json
404
User not found
application/json
put
PUT /users/update-user HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 26

{
  "id": 1,
  "roleIds": [
    1,
    2,
    3
  ]
}
{
  "message": "User updated successfully",
  "description": "The user has been updated successfully."
}

Updates the profile of the authenticated user.

put
Body
firstNamestring | nullableRequiredExample: John
lastNamestring | nullableRequiredExample: Doe
emailstring | nullableRequiredExample: john.doe@example.com
photostring | nullableRequiredExample: photo.jpg
phoneNumberstring | nullableRequiredExample: 123-456-7890
impersonationAllowedboolean | nullableRequiredExample: true
Responses
200
Profile updated successfully
application/json
ResponseanyExample: {"message":"Profile updated successfully","description":"The profile has been updated successfully."}
400
User not found
application/json
put
PUT /users/update-profile HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 145

{
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "photo": "photo.jpg",
  "phoneNumber": "123-456-7890",
  "impersonationAllowed": true
}
{
  "message": "Profile updated successfully",
  "description": "The profile has been updated successfully."
}

Deletes multiple users.

delete
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Users deleted successfully
application/json
ResponseanyExample: {"message":"Users deleted successfully","description":"The users have been deleted successfully."}
400
One or more users not found
application/json
403
Access denied
application/json
500
Internal server error
application/json
delete
DELETE /users HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
{
  "message": "Users deleted successfully",
  "description": "The users have been deleted successfully."
}