---
swagger: "2.0"
host: "localhost:3000"
schemes:
- https
- http
info:
title: Litmus Portal Authentication API
version: 2.7.0
description: |
Litmus Portal Authentication APIs are used to authenticate the identity of a user and to perform several user-specific tasks like:
Update Profile
Change Password
Reset Password
Create new users etc.
paths:
"/status":
get:
description: This API is used to check the status of the server.
responses:
"200":
description: OK
examples:
application/json:
status: up
schema:
type: object
parameters: []
produces:
- application/json
"/login":
post:
description: |
This API is used to login into auth server.
| Field |
Possible values |
Mandatory/Optional |
| username |
admin |
Mandatory |
| password |
pass123 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
access_token: ACCESS_TOKEN
expires_in: 86400
type: Bearer
schema:
type: object
"401":
description: Unauthorized
examples:
application/json:
error: unauthorized
error_description:
The user does not have requested authorization to
access this resource
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
username: admin
password: admin
consumes:
- application/json
produces:
- application/json
"/users":
get:
description: This API is used to get the list of users
responses:
"200":
description: OK
examples:
application/json:
- _id: f8036c51-0d79-4cd7-a7d0-45dcadb80eeb
username: admin
email: user1@litmus.com
name: user1
role: admin
created_at: "1627040098"
schema:
type: object
parameters: []
produces:
- application/json
"/getUser/{user_id}":
get:
description: This API is used to get the details of an user by passing uid in the URL
responses:
"200":
description: OK
examples:
application/json:
_id: f8036c51-0d79-4cd7-a7d0-45dcadb80eeb
username: admin
email: user1@litmus.com
name: user1
role: admin
created_at: "1627040098"
schema:
type: object
parameters:
- name: user_id
required: true
description: ID of the user
in: path
type: string
produces:
- application/json
"/update/password":
post:
description: |
This API is used to update the password
| Field |
Possible values |
Mandatory/Optional |
| username |
admin |
Optional |
| old_password |
pass123 |
Mandatory |
| new_password |
pass1234 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: password has been reset
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
username: admin
old_password: admin
new_password: litmus
consumes:
- application/json
produces:
- application/json
"/create":
post:
description: |
This API is used to create a new user.
| Field |
Possible values |
Mandatory/Optional |
| username |
user1 |
Mandatory |
| password |
pass123 |
Mandatory |
| role |
admin |
Mandatory |
| email |
user1@gmail.com |
Optional |
| name |
admin |
Optional |
responses:
"200":
description: OK
examples:
application/json:
_id: 5873815a-1535-4b1c-8766-2fe53c726276
username: test1
email: test1@litmus.com
name: Test Account
role: admin
created_at: "1627040799"
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
username: test1
password: test1
role: admin
email: test1@litmus.com
name: Test Account
consumes:
- application/json
produces:
- application/json
"/reset/password":
post:
description: |
This API is used to reset the password of a user.
| Field |
Possible values |
Mandatory/Optional |
| username |
test1 |
Mandatory |
| new_password |
pass1234 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: password has been reset successfully
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
username: test1
new_password: test2
consumes:
- application/json
produces:
- application/json
"/update/details":
post:
description: |
This API is used to update the details of a user.
| Field |
Possible values |
Mandatory/Optional |
| name |
test1 |
Optional |
| email |
test1@test.com |
Optional |
responses:
"200":
description: OK
examples:
application/json:
message: User details updated successfully
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
name: Administrator
email: admin@litmus.com
consumes:
- application/json
produces:
- application/json
"/update/state":
post:
description: |
This API is used to update the state of a user.
| Field |
Possible values |
Mandatory/Optional |
| username |
test1 |
Mandatory |
| is_deactivate |
true |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: user's state updated successfully
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
username: test1
is_deactivate: true
consumes:
- application/json
produces:
- application/json
"/create_project":
post:
description: |
This API is used to create a project
| Field |
Possible values |
Mandatory/Optional |
| project_name |
My project |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
data:
ID: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
Name: my project
Members:
[
{
UserID: "c0b43e3f-8e7f-475e-9aa3-c2393a0f408b",
Role: "Owner",
Invitation: "Accepted",
JoinedAt: "1640676874",
},
]
State: active
CreatedAt: "1627040799"
UpdatedAt: "1627040799"
RemovedAt: ""
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_name: my project
consumes:
- application/json
produces:
- application/json
"/get_project/{project_id}":
get:
description: |
This API is used to get details of a project with given project ID
responses:
"200":
description: OK
examples:
application/json:
data:
ID: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
Name: my project
Members:
[
{
UserID: "c0b43e3f-8e7f-475e-9aa3-c2393a0f408b",
UserName: "admin",
Name: "",
Role: "Owner",
Email: "",
Invitation: "Accepted",
JoinedAt: "1640676874",
DeactivatedAt: "",
},
]
State: active
CreatedAt: "1627040799"
UpdatedAt: "1627040799"
RemovedAt: ""
schema:
type: object
parameters:
- name: project_id
required: true
description: ID of the project
in: path
type: string
produces:
- application/json
"/get_user_with_project/{username}":
get:
description: |
This API is used to get details of a project for a user
responses:
"200":
description: OK
examples:
application/json:
data:
ID: c0b43e3f-8e7f-475e-9aa3-c2393a0f408b
UserName: "admin"
CreatedAt: "1627040799"
Email: ""
Name: ""
Projects:
[
{
ID: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8,
Name: my project,
Members:
[
{
UserID: c0b43e3f-8e7f-475e-9aa3-c2393a0f408b,
Role: Owner,
Invitation: Accepted,
JoinedAt: "1640676874",
},
],
State: active,
CreatedAt: "1627040799",
UpdatedAt: "1627040799",
RemovedAt: "",
},
]
schema:
type: object
parameters:
- name: username
required: true
description: username of the user
in: path
type: string
produces:
- application/json
"/list_projects":
get:
description: |
This API is used to get project details of logged in user
responses:
"200":
description: OK
examples:
application/json:
data:
[
{
ID: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8,
Name: my project,
Members:
[
{
UserID: "c0b43e3f-8e7f-475e-9aa3-c2393a0f408b",
Role: "Owner",
Invitation: "Accepted",
JoinedAt: "1640676874",
},
],
State: active,
CreatedAt: "1627040799",
UpdatedAt: "1627040799",
RemovedAt: "",
},
]
schema:
type: object
parameters: []
produces:
- application/json
"/get_projects_stats":
get:
description: |
This API is used to get overall stats for all the projects(accessible only to admin).
responses:
"200":
description: OK
examples:
application/json:
data:
[
{
Name: admin's project,
ProjectId: "430baca1-cdea-4886-bd80-9cfa204ea81f",
Members:
{
Owner:
[
{
UserId: "6abec0cf-7263-4519-bd69-7e02e26837fa",
Username: admin,
},
],
Total: 2,
},
},
]
schema:
type: object
parameters: []
produces:
- application/json
"/update_projectname":
post:
description: |
This API is used to update a project name
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| project_name |
admin's project |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: Successful
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
project_name: admin's project
consumes:
- application/json
produces:
- application/json
"/send_invitation":
post:
description: |
This API is used to send project invite to an user
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| user_id |
3bdc0bd9-fc46-433b-ac21-05d555566c46 |
Mandatory |
| role |
Viewer |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
data:
UserID: 3bdc0bd9-fc46-433b-ac21-05d555566c46
UserName: john
Name: ""
Role: "Viewer"
Email: ""
Invitation: "Pending"
JoinedAt: "1640676874"
DeactivatedAt: ""
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
user_id: 3bdc0bd9-fc46-433b-ac21-05d555566c46
role: Viewer
consumes:
- application/json
produces:
- application/json
"/accept_invitation":
post:
description: |
This API is used to accept a project invite
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| user_id |
3bdc0bd9-fc46-433b-ac21-05d555566c46 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: Successful
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
user_id: 3bdc0bd9-fc46-433b-ac21-05d555566c46
consumes:
- application/json
produces:
- application/json
"/decline_invitation":
post:
description: |
This API is used to decline a project invite
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| user_id |
3bdc0bd9-fc46-433b-ac21-05d555566c46 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: Successful
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
user_id: 3bdc0bd9-fc46-433b-ac21-05d555566c46
consumes:
- application/json
produces:
- application/json
"/remove_invitation":
post:
description: |
This API is used to revoke a project invite or remove a project member
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| user_id |
3bdc0bd9-fc46-433b-ac21-05d555566c46 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: Successful
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
user_id: 3bdc0bd9-fc46-433b-ac21-05d555566c46
consumes:
- application/json
produces:
- application/json
"/leave_project":
post:
description: |
This API is used to leave a project
| Field |
Possible values |
Mandatory/Optional |
| project_id |
384f6666-3b7d-4381-b5b5-bfc4c3dedbc8 |
Mandatory |
| user_id |
3bdc0bd9-fc46-433b-ac21-05d555566c46 |
Mandatory |
responses:
"200":
description: OK
examples:
application/json:
message: Successful
schema:
type: object
parameters:
- name: body
in: body
schema:
type: object
example:
project_id: 384f6666-3b7d-4381-b5b5-bfc4c3dedbc8
user_id: 3bdc0bd9-fc46-433b-ac21-05d555566c46
consumes:
- application/json
produces:
- application/json