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.ssh.surf
You must supply an authenication header using the key: x-ssh-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
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.ssh.surf/hello')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ message: 'Hello, SSH65165165165261652!' }
This API Method allows you get the username without the hello message
Example:
var unirest = require('unirest');
unirest
.get('https://api.ssh.surf/name')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{ message: 'SSH65165165165261652' }
This API Method allows you to start your container.
Example:
var unirest = require('unirest');
unirest
.get('https://api.ssh.surf/start')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/stop')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/restart')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/info')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
name: 'SSH34457493201438',
IPAddress: '192.168.64.3',
MacAddress: '02:42:c0:a8:40:03',
memory: '2 GB',
cpus: '4',
restartPolicy: { Name: 'always', MaximumRetryCount: 0 },
restarts: 0,
state: {
Status: 'running',
Running: true,
Paused: false,
Restarting: false,
OOMKilled: false,
Dead: false,
Pid: 1649653,
ExitCode: 0,
Error: '',
StartedAt: '2023-09-11T21:51:51.213424966Z',
FinishedAt: '0001-01-01T00:00:00Z'
},
created: '2023-09-11T21:51:50.466440637Z',
image: 'sha256:673445dfc719739a14e00ccee6d3830edf31d740d98461ab3028e30e9fbef8f1'
}
This API method will allow you to get resource usage stats about your container
Example:
var unirest = require('unirest');
unirest
.get('https://api.ssh.surf/stats')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/time')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/rootpass')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/new-key')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/key-time')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/license')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-auth': 'YOURTOKENHERE'})
.then((response) => {
console.log(response.body)
})
Response:
[user@test ~]# node test
{
status: 'active',
lic_type: 'SSH.SURF Pro',
dateCreated: '12/30/2022',
dateExpire: '12/01/2024'
}
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.ssh.surf/exec')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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.ssh.surf/notify')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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"
}
This API Method allows you to send notifications to your RevoltID as a DirectMessage.
JSON Payload:
{"message": "Hello There, This is a test!\nDid this work?"}
Example:
var unirest = require('unirest');
unirest
.post('https://api.ssh.surf/notify-revolt')
.headers({'Accept': 'application/json', 'Content-Type': 'application/json',
'x-ssh-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: