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 365 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 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
{ success: true, message: 'SSH42113405732790' }
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
{ success: true, message: 'Container started successfully' }
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
{ success: true, message: 'Container stopped successfully' }
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
{ success: true, message: 'Container restarted successfully' }
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
{
success: true,
data: {
name: 'SSH42113405732790',
IPAddress: '172.25.0.7',
MacAddress: '02:42:ac:19:00:07',
memory: '8 GB',
cpus: '8',
restartPolicy: { Name: 'always', MaximumRetryCount: 0 },
restarts: 0,
state: {
Status: 'running',
Running: true,
Paused: false,
Restarting: false,
OOMKilled: false,
Dead: false,
Pid: 2455731,
ExitCode: 0,
Error: '',
StartedAt: '2024-05-05T21:56:03.922346494Z',
FinishedAt: '2024-05-05T21:56:03.207724771Z'
},
created: '2024-05-05T20:17:28.288279722Z',
image: 'sha256:d587e06c9123337b2e5b54be44ef0f361e2d3517a8eddbea0e6f2ec2f64f0004'
}
}
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
{
success: true,
data: {
container: 'SSH42113405732790',
memory: { raw: '497.3MiB / 7.906GiB', percent: '6.14%' },
cpu: '1.73%'
}
}
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
{ success: true, expireDate: '5/12/2024' }
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
{
success: true,
message: 'Root password set successfully',
newRootPass: 'JvE403Lh9U'
}
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
{
success: true,
message: 'New API key generated successfully',
newAPIKey: 'keyhere'
}
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
{
success: true,
keyexpireString: 'Sun May 12 2024 17:29:39 GMT-0400 (Eastern Daylight Time)',
expireDate: '2024-05-12T21:29:39.000Z',
expireEpoc: 1715549379000
}
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
{
success: true,
message: 'Command executed successfully',
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
{ success: true, message: 'Notification sent successfully' }