API REST v1

Automate your servers

Integrate EzServer with your scripts, deployment pipelines and internal systems. JSON responses, token authentication.

Base URL https://ezserver.app/api/v1

Prefer talking to your servers through Claude? See the MCP integration.

Quick start

1.Log in

Use your account e-mail and password. The account must have a confirmed e-mail and two-factor authentication enabled (enable it in the dashboard on your first login). The response includes a challenge_token:

curl -X POST https://ezserver.app/api/v1/auth/login \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"email":"you@company.com","password":"YOUR_PASSWORD"}'

# Response (HTTP 200)
{ "success": false, "message": "2FA requerido", "requires_2fa": true,
  "challenge_token": "hK3v…(64 characters)…Qz", "expires_in": 300 }

2.Send the authenticator app code

curl -X POST https://ezserver.app/api/v1/auth/verify-2fa \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"challenge_token":"hK3v…Qz","code":"482913"}'

# Response (HTTP 200)
{ "success": true, "data": { "user": { ... }, "token": "45|o8Xk...Zq1" } }

The challenge_token is valid for 5 minutes, can be used only once and is discarded after 5 wrong codes — in that case, log in again. Instead of the 6-digit code you can send a backup code.

Store the token somewhere safe (environment variable, secrets vault). It does not expire — revoke it with DELETE /auth/tokens/{id} when you no longer need it.

3.Call the API with the token

Always send the Authorization and Accept: application/json headers:

curl https://ezserver.app/api/v1/servers \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Endpoints

All paths are relative to the base URL. {id} is the numeric ID returned by GET /servers. Except for login, 2FA and health, all of them require a token. This is a list of the main ones — parameters, responses and the other endpoints (real-time terminal, backups, databases, files, webhooks and MCP) are in the full documentation (.md).

Authentication

  • POST /auth/login Validates e-mail and password and returns a challenge_token (valid for 5 minutes).
  • POST /auth/verify-2fa Send the challenge_token + authenticator app code (or a backup code) and receive the token.
  • GET /auth/profile Details of the token owner.
  • GET /auth/tokens Lists your active tokens.
  • DELETE /auth/tokens/{id} Revokes a token.
  • POST /auth/logout Revokes the token used in the request.
  • POST /auth/logout-all Revokes all your tokens.

Servers

  • GET /servers Lists your servers.
  • POST /servers Registers a server (password authentication).
  • GET /servers/{id} Details, detected configuration and metrics of a server.
  • PUT /servers/{id} Updates name, IP, port, user, password, type or status.
  • DELETE /servers/{id} Removes the server from EzServer (does not touch the machine).
  • POST /servers/{id}/test-connection Tests the SSH connection.
  • POST /servers/{id}/execute-command Runs a command over SSH and returns its output and exit code.
  • GET /servers/{id}/applications Applications detected on the server.
  • POST /servers/{id}/terminal Single-use ticket for the real-time SSH terminal (WebSocket).

Monitoring and account

  • GET /metrics Latest metrics (CPU, memory, disk, load) for all servers.
  • GET /dashboard Account summary: server count and plan.
  • GET /health API status (no token required).

Examples

Register a server

curl -X POST https://ezserver.app/api/v1/servers \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-store",
    "ip_address": "203.0.113.10",
    "ssh_port": 22,
    "ssh_user": "root",
    "ssh_password": "SERVER_PASSWORD",
    "type": "vps"
  }'

Required: name, ip_address (IP only), ssh_user and ssh_password (min. 6 characters). Optional: ssh_port (default 22) and type (vps, dedicated, cloud, shared). The server is created as inactive; call test-connection to validate and activate it. To use an SSH key, register the server from the dashboard. Your plan's server limit also applies to the API.

Run a command

curl -X POST https://ezserver.app/api/v1/servers/42/execute-command \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"command":"df -h /"}'

# Response
{
  "success": true,
  "data": {
    "command": "df -h /",
    "output": "Filesystem  Size  Used Avail Use% Mounted on\n/dev/sda1  80G  27G  53G  34% /\n",
    "error": "",
    "exit_code": 0
  }
}

Real-time SSH terminal (WebSocket)

To embed the terminal in your app: request a ticket with your API token and open the WebSocket. The SSH password and key never leave EzServer.

curl -X POST https://ezserver.app/api/v1/servers/42/terminal \
  -H "Authorization: Bearer YOUR_TOKEN" -H "Accept: application/json"

# { "data": { "ws_url": "wss://…/ssh-ws", "ticket": "…", "expires_in": 60 } }

// In your app (JavaScript)
const ws = new WebSocket(data.ws_url);
ws.onopen = () => ws.send(JSON.stringify({ type: "auth", ticket: data.ticket, cols: 80, rows: 24 }));
ws.onmessage = (ev) => {
  const msg = JSON.parse(ev.data);              // connected | output | error | disconnected
  if (msg.type === "output")                     // output: base64-encoded UTF-8
    term.write(new TextDecoder().decode(Uint8Array.from(atob(msg.data), (c) => c.charCodeAt(0))));
};
ws.send(JSON.stringify({ type: "input", data: "ls -la\r" }));
ws.send(JSON.stringify({ type: "resize", cols: 120, rows: 40 }));

The ticket is valid for 60 seconds and a single connection. By default the terminal uses a persistent tmux session: if the connection drops, request another ticket and reconnect to pick up where you left off. The full protocol, special keys, reconnection and examples with xterm.js and Python are in the full documentation.

Python example

import os, requests

BASE = "https://ezserver.app/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['EZSERVER_TOKEN']}", "Accept": "application/json"}

for s in requests.get(f"{BASE}/metrics", headers=HEADERS, timeout=30).json()["data"]:
    if (s.get("disk_usage") or 0) > 85:
        print(f"⚠️  {s['name']}: disk at {s['disk_usage']}%")

Errors

Validation errors return the errors field:

{
  "success": false,
  "message": "Dados de validação inválidos",
  "errors": { "ip_address": ["O campo ip address deve ser um endereço IP válido."] }
}
200 / 201Success / resource created
401Missing/invalid token or wrong credentials
403E-mail not confirmed or 2FA not enabled on the account
404Resource does not exist or does not belong to your account
422Invalid data or plan limit reached
429Too many attempts — wait and try again
500Internal error or SSH connection failure (see "message")

Limits and best practices

  • Login, 2FA and sign-up accept up to 10 attempts per minute per IP. Log in once and reuse the token.
  • The token has the same powers as your account, including running commands. Never put it in version-controlled code or in the front end.
  • execute-command waits for the command to finish. For long tasks, run it in the background (nohup … &) or use the terminal with tmux.
  • Revoke old tokens with GET /auth/tokens + DELETE /auth/tokens/{id}.

Need something the API doesn't do yet?

Tell us about your use case — it helps us prioritize the next endpoints.

Talk to us