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.
Name | Description | Required | Constraints |
---|---|---|---|
action | Must be set to createchat | Yes | |
chatname | The name of the chat you want to create, e.g. SecondChat | Yes | Max length: 50 characters |
copyfrom | Allows 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. | No | Max length: 50 characters |
managerkey | If 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.
Name | Description | Required | Constraints |
---|---|---|---|
action | Must be set to deletechat | Yes | |
chatname | The name of the chat you want to delete, e.g. SecondChat | Yes | Max 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.
Name | Description | Required | Constraints |
---|---|---|---|
action | Must be set to setnotice | Yes | |
chatname | The name of the chat you'd like the notice to be placed on, e.g. SecondChat | Yes | Max length: 50 characters |
noticetext | The 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. | Yes | Max length: 2000 characters |
cURL (example)
curl -X POST -d "action=setnotice&chatname=SecondChat¬icetext=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 if your Organization is on the Pro plan or higher.
Name | Description | Required | Constraints |
---|---|---|---|
action | Must be set to exportaccounts | Yes | |
beforets | Set to unix timestamp in seconds if you'd like to include accounts created before this time | No | |
afterts | Set to unix timestamp in seconds if you'd like to include accounts created after this time | No | |
withmarketingconsentonly | Set to true if you'd like to include accounts that have given marketing consent only | No | |
firstchat | Include 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 Include | At least one of the values below must be included, otherwise the export data will be empty | ||
userid | Set to true if you'd like to include the user ID in the export data | No | |
username | Set to true if you'd like to include the username in the export data | No | |
nickname | Set to true if you'd like to include the nickname in the export data | No | |
Set to true if you'd like to include the email in the export data | No | ||
emailactivated | Set to true if you'd like to include the email activation status in the export data | No | |
marketingconsent | Set to true if you'd like to include the marketing consent status in the export data | No | |
protected | Set 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 | |
avatar | Set to true if you'd like to include the avatar URL in the export data | No | |
attributes | Set to true if you'd like to include the account attributes in the export data | No | |
ssolinks | Set to true if you'd like to include the SSO services linked to this account in the export data | No | |
registrationip | Set to true if you'd like to include the registration IP in the export data | No | |
lastloginip | Set to true if you'd like to include the last login IP in the export data | No | |
createtimestamp | Set to true if you'd like to include the account creation timestamp in the export data | No | |
lastactivetimestamp | Set to true if you'd like to include the account last activity timestamp in the export data | No |
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"
}
]
}