Skip to main content

Introducing Liquid Nitrogen!

To take administrative actions like managing users, connected apps and permissions, it is recommended that you use The Nitrogen Project instead of rolling your own admin management portal. Nitrogen seamlessly connects with any Liquid instance with minimal configuration and uses the same administrative APIs under the hood.

If you still want to use the admin APIs for some reason, all of them are documented in this page.

Liquid Nitrogen  

Admin APIs

Restricted to system admins. Super Admin role has access to all these APIs. To provide access to other users, Super Admin needs to explicitly provide permissions using POST user/admin-api/access API. Needs an authorization_code grant login.

Access Provisioning


Add or remove scopes in user profiles.

Authentication

Requires delegated authentication.

Scope

admin:profile:access:write (or) role = super_admin

Before You Start

Read more about access control here.

URL

POST /user/admin-api/access

Request Body

ParameterTypeDescriptionRequired / Optional
targetsarrayArray of user IDs.Required
targetTypeenum(user, client)Type of target.Required
scopearrayArray of scope names. See full list hereRequired
operationenum(set, add, del)Specifies the type of modification.Required

Request Sample (JSON)

{
"targets": ["507f1f77bcf86cd799439011"],
"targetType": "user",
"scope": ["admin:profile:read", "admin:profile:write"],
"operation": "set"
}

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

Create Users


Creates users using a given array of user details.

Authentication

Requires delegated authentication.

Scope

admin:profile:create:write

URL

POST /user/admin-api/create

Request Body (Array Skeleton)

ParameterTypeDescriptionRequired / Optional
usernamestringUsername for the user. Contains text, numbers and _ and at least 8 lettersRequired
firstNamestringFirst name of the user.Required
lastNamestringLast name of the user.Required
emailstringEmail address of the user.Required
passwordstringPassword for the user.Required
rolestringRole of the user. Target role be ranked less than the user calling the API or must be a super admin.Optional
phoneCountryCodestringValid country code.Optional
phonestringPhone number of the user.Optional

Request Sample (JSON)

[
{
"username": "john_doe",
"firstName": "John",
"lastName": "Doe",
"role": "user",
"phoneCountryCode": "+00",
"phone": "0000000000",
"email": "user@example.com",
"password": "$uper&ecurePassw0rd"
}
]

Response Parameters

ParameterTypeDescription
okinteger0 or 1
insertedCountintegerNumber of users created.

Response Sample

{
"ok": 1,
"insertedCount": 1
}

Create Application


Creates an application client.

Authentication

Requires delegated authentication.

Scope

  • admin:system:internal-client:write
  • admin:system:external-client:write

URL

POST /client/admin-api/create

Request Body (Array Skeleton)

ParameterTypeDescriptionRequired / Optional
idstringID of the client.Required
grantsarray[enum(client_credentials, authorization_code, refresh_token, password)]Grants allowed for the clientRequired
redirectUrisarrayRedirect URIs authorized for the client.Required
secretstringThe client secret.Required
roleenum(internal_client, external_client)Role of the client.Required
scopearrayArray of scopeRequired
displayNamestringDisplay name of the client.Required

Request Sample (JSON)

[
{
"id": "external_client",
"grants": ["client_credentials"],
"redirectUris": ["https://redirect.uri"],
"secret": "super-secure-client-secret",
"role": "external_client",
"scope": ["client:profile:read", "client:social:all"],
"displayName": "My External Client"
}
]

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

Update Application


Updates an application client.

Authentication

Requires delegated authentication.

Scope

  • admin:system:internal-client:write
  • admin:system:external-client:write

URL

PATCH /client/admin-api/update

Request Body

ParameterTypeDescriptionRequired / Optional
targetstringDBID of the client.Required
idstringID of the client.Required
grantsarray[enum(client_credentials, authorization_code, refresh_token, password)]Grants allowed for the clientRequired
redirectUrisarrayRedirect URIs authorized for the client.Required
secretstringThe client secret.Required
roleenum(internal_client, external_client)Role of the client.Required
scopearrayArray of scopeRequired
displayNamestringDisplay name of the client.Required

Request Sample (JSON)

{
"target: "507f1f77bcf86cd799439011"
"id": "external_client",
"grants": ["client_credentials"],
"redirectUris": ["https://redirect.uri"],
"secret": "super-secure-client-secret",
"role": "external_client",
"scope": ["client:profile:read", "client:social:all"],
"displayName": "My External Client"
}

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

Delete Application


Deletes an application client.

Authentication

Requires delegated authentication.

Scope

  • admin:system:internal-client:delete
  • admin:system:external-client:delete

URL

DELETE /client/admin-api/delete

Request Body

ParameterTypeDescriptionRequired / Optional
targetstringDBID of the client.Required

Request Sample (JSON)

{
"target": "507f1f77bcf86cd799439011"
}

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

List Applications


List applications/clients in the system.

Authentication

Requires delegated authentication.

Scope

admin:system:client:read

URL

GET /client/admin-api/list

Query Parameters

ParameterTypeDescriptionRequired / Optional
limitintegerRecords per pageOptional
offsetinteger_id field of last record in the previous page.Optional

Response Data Parameters

ParameterTypeDescription
applicationsarrayArray of applications.

Response Sample

{
"ok": 1,
"data": [
{
"id": "external_client",
"grants": ["client_credentials"],
"redirectUris": ["https://redirect.uri"],
"secret": "super-secure-client-secret",
"role": "external_client",
"scope": ["client:profile:read", "client:social:all"],
"displayName": "My External Client"
}
]
}

List Users


List users in the system.

Authentication

Requires delegated authentication.

Scope

admin:profile:read

URL

GET /user/admin-api/list

Query Parameters

ParameterTypeDescriptionRequired / Optional
limitintegerRecords per pageOptional
offsetinteger_id field of last record in the previous page.Optional

Response Data Parameters

ParameterTypeDescription
usersarrayArray of users.

Response Sample

{
"ok": 1,
"data": {
"users": [
{
"_id": "507f1f77bcf86cd799439011",
"firstName": "John",
"middleName": null,
"lastName": "Doe",
"gender": "male",
"username": "john_doe",
"role": "user",
"bio": "Grab a straw, because you suck.",
"designation": "Software Engineer",
"profilePictureUrl": "https://image.com/url",
"pronouns": "he/him",
"verified": true,
"verifiedDate": "2023-09-09T13:45:52.505Z",
"customLink": "https://custom.link",
"followingCount": 250,
"followerCount": 1058,
"isPrivate": true,
"isSubscribed": true,
"subscriptionTier": "basic",
"subscriptionExpiry": "2023-09-09T13:45:52.505Z",
"isBanned": false,
"isRestricted": false,
"email": "john.doe@example.com",
"phone": "0000000000",
"customData": {}
}
]
}
}

Get User Info


Get information about a user from their ID.

Authentication

Requires delegated authentication.

Scope

admin:profile:read

URL

GET /user/admin-api/user-info

Query Parameters

ParameterTypeDescriptionRequired / Optional
targetsstringComma separated list of user IDsRequired

Response Data Parameters

ParameterTypeDescription
usersarrayArray of users.

Response Sample

{
"ok": 1,
"data": {
"users": [
{
"_id": "507f1f77bcf86cd799439011",
"firstName": "John",
"middleName": null,
"lastName": "Doe",
"gender": "male",
"username": "john_doe",
"role": "user",
"bio": "Grab a straw, because you suck.",
"designation": "Software Engineer",
"profilePictureUrl": "https://image.com/url",
"pronouns": "he/him",
"verified": true,
"verifiedDate": "2023-09-09T13:45:52.505Z",
"customLink": "https://custom.link",
"followingCount": 250,
"followerCount": 1058,
"isPrivate": true,
"isSubscribed": true,
"subscriptionTier": "basic",
"subscriptionExpiry": "2023-09-09T13:45:52.505Z",
"isBanned": false,
"isRestricted": false,
"email": "john.doe@example.com",
"phone": "0000000000",
"customData": {}
}
]
}
}

Update User Info


Updates a user's profile details.

Authentication

Requires delegated authentication.

Scope

  • admin:profile:write
  • admin:profile:sensitive:extreme:write
  • admin:profile:sensitive:high:write
  • admin:profile:sensitive:medium:write
  • admin:profile:sensitive:low:write

Before You Start

Read about editing users here

URL

PATCH /user/admin-api/update

Request Body

ParameterTypeDescriptionRequired / Optional
targetstring_id of the user.Optional
usernamestringUsername for the user. Contains text, numbers and _ and at least 8 lettersOptional
firstNamestringFirst name of the user.Optional
lastNamestringLast name of the user.Optional
emailstringEmail address of the user.Optional
passwordstringPassword for the user.Optional
rolestringRole of the user.Optional
phoneCountryCodestringValid country code.Optional
phonestringPhone number of the user.Optional

Request Sample (JSON)

[
{
"username": "john_doe",
"firstName": "John",
"lastName": "Doe",
"role": "user",
"phoneCountryCode": "+00",
"phone": "0000000000",
"email": "user@example.com",
"password": "$uper&ecurePassw0rd"
}
]

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

Update User Custom Data


Updates a user's custom data.

Authentication

Requires delegated authentication.

Scope

admin:profile:custom-data:write

Before You Start

Read about custom data here

URL

PUT /user/admin-api/custom-data

Request Body

ParameterTypeDescriptionRequired / Optional
targetstring_id of the user.Required
customDataobjectJSON data objectRequired

Request Sample (JSON)

{
"target": "507f1f77bcf86cd799439011",
"customData": {
"themePreference": "dark",
"nestedKey": {
"integer": 1
}
}
}

Response Parameters

ParameterTypeDescription
okinteger0 or 1

Response Sample

{
"ok": 1
}

Get Editable Fields


Get the field names you can edit while using PATCH /user/admin-api/user.

Authentication

Requires delegated authentication.

Scope

admin:configuration:read

URL

POST /user/admin-api/create

Request Body

ParameterTypeDescription
editableFieldsarrayArray of fields that are editable by the current user.

Response Sample

{
"data": {
"editableFields": ["string"]
}
}

Ban User


Suspend a user from logging into Liquid.

Authentication

Requires delegated authentication.

Scope

admin:profile:ban:write

URL

POST /user/admin-api/ban

Request Body

ParameterTypeDescription
targetarray_id of the user to be banned or unbanned.
statebooleanBan status.

Request Sample

{
"target": "507f1f77bcf86cd799439011",
"state": true
}

Response Sample

{
"ok": 1
}

Restrict User


Marks a user as restricted.

Authentication

Requires delegated authentication.

Scope

admin:profile:restrict:write

URL

POST /user/admin-api/restrict

Request Body

ParameterTypeDescription
targetarray_id of the user to be restricted or unrestricted.
statebooleanBan status.

Request Sample

{
"target": "507f1f77bcf86cd799439011",
"state": true
}

Response Sample

{
"ok": 1
}

Verify User


Marks a user as verified.

Authentication

Requires delegated authentication.

Scope

admin:profile:verifications:write

URL

POST /user/admin-api/verify

Request Body

ParameterTypeDescription
targetarray_id of the user to be verified or unverified.
statebooleanBan status.

Request Sample

{
"target": "507f1f77bcf86cd799439011",
"state": true
}

Response Sample

{
"ok": 1
}

Update User Credits


Update credits of a user. Credits are usually similar to virtual money that you can use for controlling paid features. You can also use this as a reward points system.

Authentication

Requires delegated authentication.

Scope

admin:profile:credits:write

Special Instructions

  • Adjust the number of credits that a user has while signing up using the option user.account-creation.initial-credit-count.

URL

POST /user/admin-api/credits

Request Body

ParameterTypeDescription
targetarray_id of the user to be verified or unverified.
operationenum(increment, decrement, set)Operation to be performed on the credit value.

Request Sample

{
"target": "6291396efe7079829e49b723",
"operation": "increment",
"value": 50
}

Response Sample

{
"ok": 1
}

Get Invite Codes


Retrieves invite codes for a user.

Authentication

Requires a delegated authentication

Scope

admin:social:invite-code:read

URL

GET /user/admin-api/invite-codes

Before You Start

Read more about the Invite-Only system here.

Query Parameters

ParameterTypeDescription
targetarrayArray of invite codes. Absence of targetId parameter in objects means the invite code is not used.

Response Sample

{
"ok": 1,
"data": {
"inviteCodes": [
{
"code": "GU-2526-1687389089010",
"createdAt": "2023-06-21T16:31:29.012Z",
"updatedAt": "2023-09-06T15:07:42.794Z",
"targetId": "64f895bec011931326757de6"
},
{
"code": "IE-2949-1687895089010",
"createdAt": "2023-06-21T16:31:29.012Z",
"updatedAt": "2023-06-21T16:31:29.012Z"
},
{
"code": "RN-9486-1687365089009",
"createdAt": "2023-06-21T16:31:29.012Z",
"updatedAt": "2023-06-22T16:48:48.622Z"
},
{
"code": "AX-4751-1687286989010",
"createdAt": "2023-06-21T16:31:29.012Z",
"updatedAt": "2023-06-21T16:31:29.012Z"
},
{
"code": "PJ-5631-1689673089010",
"createdAt": "2023-06-21T16:31:29.012Z",
"updatedAt": "2023-06-21T16:31:29.012Z"
}
]
}
}