To start things off, you will need a key, to generate a key use /api-key
within Discord-Linux.
The key will then be sent to your DirectMessages, keys will be valid for 7 days.
API URL: https://api.discord-linux.com
You must supply an authenication header using the key: x-discord-linux-auth
containing the value of your token.
Keep an eye on this page, new methods will be added over time.
An example Application for the browser can be found here:
https://git.ssh.surf/snxraven/MultiUserChatCLI
An example Application for the command-line, a fully end-to-end encrypted peer-to-peer chat service with our API built in as commands:
https://git.ssh.surf/snxraven/sshChat-CLI
Live demo:
https://chat.discord-linux.com/
Please see the below examples using UniRest:
https://www.npmjs.com/package/unirest
This API Method allows you to test and ensure the correct user is in use.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/hello')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ message: 'Hello, 65165165165261652!' }
This API Method allows you to start your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/start')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ action: 'Start', completed: 'OK' }
This API Method allows you to stop your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/stop')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ action: 'Stop', completed: 'OK' }
This API Method allows you to restart your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/restart')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ action: 'Restart', completed: 'OK' }
This API method will allow you to get information about your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/info')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
"name": "65165165165261652",
"IPAddress": "172.20.0.3",
"MacAddress": "02:42:ac:14:00:03",
"memory": "2 GB",
"cpus": "2",
"restartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"restarts": 0,
"state": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 1831488,
"ExitCode": 0,
"Error": "",
"StartedAt": "2022-07-13T16:27:28.106078098Z",
"FinishedAt": "2022-07-13T16:27:24.414870899Z"
},
"created": "2022-07-08T15:58:43.832901287Z",
"image": "sha256:e7cdc65621a2ae22a7e233ff645b90bb437c78d11561f0048f750e767d1dbc28"
}
This API method will allow you to get resource usage stats about your container
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/stats')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
action: 'stats',
completed: 'OK',
data: {
container: '65165165165261652',
memory: { raw: '144.2MiB / 2GiB', percent: '7.04%' },
cpu: '0.00%'
}
}
This API method will allow you to get information about the expire time of your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/time')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ action: 'expireCheck', completed: 'OK', expireDate: '7/20/2022' }
This API method will change the root password of your container to a random generated password.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/rootpass')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
action: 'RandomRootPass',
completed: 'OK',
newRootPass: 'T89cmBRLxJ'
}
This API method will generate a new API key for your account.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/new-key')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
"action": "NewKey",
"completed": "OK",
"newAPIKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Imw5YjZmMXkjenImWUdIbkVRTG51eDNCa1lia2tqZ09AYlpoWUk3NExmQkVqWGh6a2tWIiwiaWF0IjoxNjU3Njc4NTU5LCJleHAiOjE2NTc2Nzk3NTl9.hWiCDmOeqpD0LJnli7ekTG95ol5AuJpRI61VrX6_L7c"
}
This API method will check the time left until the key expires.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/key-time')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
"keyexpireString": "Fri Jul 22 2022 23:12:12 GMT-0500 (Central Daylight Time)",
"expireDate": "2022-07-23T04:12:12.000Z",
"expireEpoc": 1658549532000
}
This API method will allow you to get information about your license key purchased at our store.
Example:
var unirest = require('unirest');
unirest
.get('https://api.discord-linux.com/license')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
"code": 200,
"status": "active",
"lic_type": "subscription",
"maxDomains": "1",
"dateCreated": "2022-06-22",
"dateExpire": "2022-07-22",
"itemReference": "power"
}
If you have no license key:
{
"action": "expireCheck",
"completed": "OK",
"key": "Not Found. You can purchase a key at: https://store.discord-linux.com"
}
This API Method allows you to run commands your container where you can specify the working directory used.
JSON Payload:
{"cmd": "commandhere", "pwd": "/working/directory/here"}
Example:
var unirest = require('unirest');
unirest
.post('https://api.discord-linux.com/exec')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.send({"cmd": "pwd; echo test", "pwd": "/home"})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
action: 'exec',
completed: 'OK',
stdout: '/home\ntest\n',
stderr: null
}
This API Method allows you to send notifications to your DiscordID as a DirectMessage.
JSON Payload:
{"message": "Hello There, This is a test!\nDid this work?"}
Example:
var unirest = require('unirest');
unirest
.post('https://api.discord-linux.com/notify')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-discord-linux-auth': 'YOURTOKENHERE'})
.send({"message": "Hello There, This is a test!\nDid this work?"})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
"action": "notify",
"completed": "OK"
}
Result: