LightYear
/Docs
DocsAPI ReferenceManage Servers via the API

Manage Servers via the API

Create, list, restart, and delete servers programmatically using the LightYear REST API.

intermediate
10 min read
LightYear Docs Team
Updated April 24, 2026
apiserversrestautomationcurl

The LightYear API provides full control over your servers. This guide covers the most common server management operations.

Base URL

All API requests use the base URL:

https://api.lightyear.host/v1

List All Servers

>_BASH
$curl https://api.lightyear.host/v1/servers \
$ -H "Authorization: Bearer YOUR_API_KEY"
OUTPUT
{
  "servers": [
    {
      "id": "srv_abc123",
      "label": "web-server-01",
      "status": "active",
      "region": "sgp-01",
      "plan": "vc2-2c-4gb",
      "main_ip": "45.77.x.x",
      "vcpu_count": 2,
      "ram": 4096,
      "disk": 80,
      "os": "Ubuntu 22.04 LTS",
      "date_created": "2026-04-01T10:00:00Z"
    }
  ],
  "meta": {
    "total": 1,
    "links": {}
  }
}

Create a Server

>_BASH
$curl -X POST https://api.lightyear.host/v1/servers \
$ -H "Authorization: Bearer YOUR_API_KEY" \
$ -H "Content-Type: application/json" \
$ -d '{
$ "region": "sgp-01",
$ "plan": "vc2-2c-4gb",
$ "os_id": 1743,
$ "label": "web-server-02",
$ "hostname": "web-server-02",
$ "ssh_key_ids": ["key_abc123"],
$ "backups": "enabled",
$ "tags": ["production", "web"]
$ }'
OUTPUT
{
  "server": {
    "id": "srv_def456",
    "status": "pending",
    "label": "web-server-02",
    "main_ip": "45.77.x.y",
    "date_created": "2026-04-24T10:00:00Z"
  }
}

Get Server Details

>_BASH
$curl https://api.lightyear.host/v1/servers/srv_abc123 \
$ -H "Authorization: Bearer YOUR_API_KEY"

Restart a Server

>_BASH
$curl -X POST https://api.lightyear.host/v1/servers/srv_abc123/reboot \
$ -H "Authorization: Bearer YOUR_API_KEY"

Halt (Power Off) a Server

>_BASH
$curl -X POST https://api.lightyear.host/v1/servers/srv_abc123/halt \
$ -H "Authorization: Bearer YOUR_API_KEY"

Delete a Server

[!WARNING] Deleting a server is permanent and cannot be undone. All data on the server's local disk is destroyed.

>_BASH
$curl -X DELETE https://api.lightyear.host/v1/servers/srv_abc123 \
$ -H "Authorization: Bearer YOUR_API_KEY"

List Available OS Images

>_BASH
$curl https://api.lightyear.host/v1/os \
$ -H "Authorization: Bearer YOUR_API_KEY"

List Available Plans

>_BASH
$curl "https://api.lightyear.host/v1/plans?type=vc2&region=sgp-01" \
$ -H "Authorization: Bearer YOUR_API_KEY"

List Available Regions

>_BASH
$curl https://api.lightyear.host/v1/regions \
$ -H "Authorization: Bearer YOUR_API_KEY"
OUTPUT
{
  "regions": [
    {"id": "sgp-01", "city": "Singapore", "country": "SG", "continent": "Asia"},
    {"id": "lax-01", "city": "Los Angeles", "country": "US", "continent": "North America"},
    {"id": "fra-01", "city": "Frankfurt", "country": "DE", "continent": "Europe"}
  ]
}

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy