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 only available on Organizations on the Business plan.

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

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"
}

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. SecondChatYesMax 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=SecondChat&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"
}

exportaccounts - Export account data POST

You can export account data using the API.

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"
}
]
}