Skip to main content

API

Minnit's API allows you to automate various tasks on your Organization by making requests to our servers. This page will cover how to get started using the API.

The API is available for Organizations on the Basic plan or higher.

Getting Started

To get your API Endpoint & Key, go to your Organization, and click "Organization Settings", then select "API".

You are able to type any key of your choosing; we recommend using a randomizer of your choice for maximum security, rather than hand-inputting a key.

Required parameters

All requests must include your API key as the X-Key header.

Actions are sent via the action parameter. For instance, creating a chatroom will have the key action with value createchat.

Read on to learn more about what each action can do.

createchat - Creating a chatroom POST

You are able to create chatrooms using the API.

NameDescriptionRequiredConstraints
actionMust be set to createchatYes
chatnameThe name of the chat you want to create, e.g. SecondChatYesMax length: 50 characters
copyfromAllows you to copy settings from an existing chat. You can create multiple chatrooms to act as templates, and copy those settings over to the newly-created chatrooms.NoMax length: 50 characters
managerkeyIf set to true this will generate, store, and return a "Manager Key" for the chatroom. Click here to learn more about staff keys.No
maxusersThe maximum number of users that can connect to this specific chat. Use this if you want to reduce the ability for a single chat to take up your entire Organization's allotment of users.NoNumber only

cURL (example)

curl -X POST -d "action=createchat&chatname=SecondChat" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"chatname": "SecondChat",
"response": "Chat created"
}

deletechat - Delete a chatroom POST

You can instantly delete a chatroom using the API.

NameDescriptionRequiredConstraints
actionMust be set to deletechatYes
chatnameThe name of the chat you want to delete, e.g. SecondChatYesMax length: 50 characters

cURL (example)

curl -X POST -d "action=deletechat&chatname=SecondChat" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "Chat deleted"
}

pause - Pause your chat POST

You can permanently pause your chat using the API.

NameDescriptionRequiredConstraints
actionMust be set to pauseYes
chatnameThe name of the chat you'd like the notice to be placed on, e.g. MainYesMax length: 50 characters

cURL (example)

curl -X POST -d "action=pause&chatname=Main" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"chatname": "main",
"response": "Chat paused"
}

unpause - Unpause your chat POST

You can unpause your chat using the API.

NameDescriptionRequiredConstraints
actionMust be set to unpauseYes
chatnameThe name of the chat you'd like the notice to be placed on, e.g. MainYesMax length: 50 characters

cURL (example)

curl -X POST -d "action=unpause&chatname=Main" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"chatname": "main",
"response": "Chat paused"
}

setnotice - Set a pinned notice POST

You can set pinned notices in the chatroom using the API.

NameDescriptionRequiredConstraints
actionMust be set to setnoticeYes
chatnameThe name of the chat you'd like the notice to be placed on, e.g. MainYesMax length: 50 characters
noticetextThe text you'd like placed in the notice, e.g. hello world. URLs will automatically be parsed in the user's browser so they may click on them. HTML will not render.YesMax length: 2000 characters

cURL (example)

curl -X POST -d "action=setnotice&chatname=Main&noticetext=hello%20world" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"chatname": "main",
"response": "Notice set"
}

kick - Kick a user POST

You can kick users using the API.

You can combine webhooks with this API to create your own bot that moderates your chat.

NameDescriptionRequiredConstraints
actionMust be set to kickYes
chatnameThe name of the chat you'd like to kick the user from, e.g. MainRequiredMax length: 50 characters
channelThe channel the user is currently signed into (if any). Will default to the main channel if not includedNoMax length: 50 characters
usernameThe username of the user you're trying to kick.Required (if userid is not provided)
useridThe user ID of the user you're trying to kick.Required (if username is not provided)
reasonThe reason for the kick.No

cURL (example)

curl -X POST -d "action=kick&chatname=Main&username=testuser&reason=inappropriate%20language" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "User kicked"
}

ban - Ban a user POST

You can ban users for a specific amount of time using the API.

You can combine webhooks with this API to create your own bot that moderates your chat.

NameDescriptionRequiredConstraints
actionMust be set to banRequired
chatnameThe name of the chat you'd like to ban the user on, e.g. MainRequiredMax length: 50 characters
channelThe channel the user is currently signed into (if any). Will default to the main channel if not includedOptionalMax length: 50 characters
usernameThe username of the user you're trying to ban. This or the user ID must be included.Required (if userid is not provided)
useridThe user ID of the user you're trying to ban. This or the username must be included.Required (if username is not provided)
durationYou can send a duration in hours. Values from 0.01 to 8760 are accepted. If you do not send a duration, or the duration you send is invalid, it will default to a permanent ban.Optional
reasonThe reason for the ban.Optional
msgidThe ID of the message that you're banning the user for.Optional
deletemessagesSet to true if you'd like all of the user's messages to be deletedOptional
silentbanSet to true if you'd like to silently ban the userOptional

cURL (example)

curl -X POST -d "action=ban&chatname=Main&username=testuser&duration=12&reason=inappropriate%20language" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "User banned"
}

unban - UnBan a user POST

You can unban users using the API.

You can combine webhooks with this API to create your own bot that moderates your chat.

NameDescriptionRequiredConstraints
actionMust be set to unbanRequired
chatnameThe name of the chat you'd like to unban the user from, e.g. MainRequiredMax length: 50 characters
channelThe channel the user is was signed into (if any). Will default to the main channel if not includedOptionalMax length: 50 characters
usernameThe username of the user you're trying to unban.Required (if userid is not provided)
useridThe user ID of the user you're trying to unban.Required (if username is not provided)

cURL (example)

curl -X POST -d "action=unban&chatname=Main&username=testuser" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "User unbanned"
}

setrank - Set the rank of a user POST

You can set a user's rank in the chat — make them an owner, manager, moderator, regular, or visitor (unranked).

Note: By giving users owner in a chatroom, they will have access to the chat settings menu for that chatroom.

Guest accounts can not be made owner.

NameDescriptionRequiredConstraints
actionMust be set to setrankRequired
chatnameThe name of the chat you'd like to set the user's rank on, e.g. MainRequiredMax length: 50 characters
usernameThe username of the user you're trying to set the rank of. This or the user ID must be included.Required (if userid is not provided)
useridThe user ID of the user you're trying to set the rank of. This or the username must be included.Required (if username is not provided)
rankDesired rank.RequiredAccepts visitor, regular, moderator, manager, or owner

cURL (example)

curl -X POST -d "action=setrank&chatname=Main&username=testuser&rank=moderator" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "Successfully set rank"
}

deletemessage - Delete a chat message POST

You can delete chat messages using the API.

You can combine webhooks with this API to create your own bot that moderates your chat.

NameDescriptionRequiredConstraints
actionMust be set to deletemessageYes
chatnameThe name of the chat you'd like to delete the message from, e.g. MainYesMax length: 50 characters
msgidThe ID of the message you'd like to deleteYes

cURL (example)

curl -X POST -d "action=deletemessage&chatname=Main&msgid=9f5bcfa7-db10-463c-8455-c456aa1131b3" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "Message deleted"
}

exportaccounts - Export account data POST

You can export account data using the API if your Organization is on the Pro plan or higher.

NameDescriptionRequiredConstraints
actionMust be set to exportaccountsYes
beforetsSet to unix timestamp in seconds if you'd like to include accounts created before this timeNo
aftertsSet to unix timestamp in seconds if you'd like to include accounts created after this timeNo
withmarketingconsentonlySet to true if you'd like to include accounts that have given marketing consent onlyNo
firstchatInclude a chat name to limit your results to only users who connected to that chatroom as their first chat. Example: If someone registers and joins "Main", their first chat will be stored as "Main".No
Data To IncludeAt least one of the values below must be included, otherwise the export data will be empty
useridSet to true if you'd like to include the user ID in the export dataNo
usernameSet to true if you'd like to include the username in the export dataNo
nicknameSet to true if you'd like to include the nickname in the export dataNo
emailSet to true if you'd like to include the email in the export dataNo
emailactivatedSet to true if you'd like to include the email activation status in the export dataNo
marketingconsentSet to true if you'd like to include the marketing consent status in the export dataNo
protectedSet to true if you'd like to include the the account data protected status in the export data. Account data may be protected if a user logs in using a social login provider if you aren't using custom credentials. Read more about using custom credentials.No
avatarSet to true if you'd like to include the avatar URL in the export dataNo
attributesSet to true if you'd like to include the account attributes in the export dataNo
ssolinksSet to true if you'd like to include the SSO services linked to this account in the export dataNo
registrationipSet to true if you'd like to include the registration IP in the export dataNo
lastloginipSet to true if you'd like to include the last login IP in the export dataNo
createtimestampSet to true if you'd like to include the account creation timestamp in the export dataNo
lastactivetimestampSet to true if you'd like to include the account last activity timestamp in the export dataNo

cURL (example)

curl -X POST -d "action=exportaccounts&userid=1&username=1&email=1&avatar=1" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"results": [
{
"avatar_url": "https://minnit.chat/images/userdefault.svg",
"email": "[email protected]",
"nickname": "Test",
"userid": "1",
"username": "Test"
},
{
"avatar_url": "https://minnit.chat/images/userdefault.svg",
"email": "[email protected]",
"nickname": "Minnit",
"userid": "2",
"username": "Minnit"
}
]
}

createaccount - Create an account POST

You can create accounts using the API.

Note: We recommend using Zero-Click SSO to automatically sign your users in using existing account credentials once the chat is loaded.

NameDescriptionRequiredConstraints
actionMust be set to createaccountYes
usernameUsername for the account (must be unique)YesMax length: 500 characters
passwordPassword for the accountYesMax length: 100 characters
nicknameNickname for the account (does not need to be unique)NoMax length: 500 characters
avatarURL for the account avatarNoMax length: 500 characters
emailEmail for the accountNoMax length: 300 characters
emailverifiedSet to true if the email has been verifiedNo

cURL (example)

curl -X POST -d "action=createaccount&username=Jeff&password=aXnLeIZ" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "Account created"
}

sendmessage - Send chat messages POST

You can send messages in main chat using the API.

You can combine webhooks with this API to create your own bot that responds to messages from users.

NameDescriptionRequiredConstraints
actionMust be set to sendmessageYesMax length: 10,000 characters
messageThe message you'd like to sendYes
chatnameThe name of the chat you'd like to send the message toYes
usernameThe username of the user you'd like the message to be sent underYes
channelThe channel you'd like to send the message to. Will default to the main channel if not includedNo

cURL (example)

curl -X POST -d "action=sendmessage&chatname=main&username=jeff&message=Hello" https://example.minnit.org/page/api \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "X-Key:12345"

Response (example)

{
"success": true,
"response": "Message sent"
}