Skip to main content

List Locations

GET /api/locations
List all locations. Public endpoint - no authentication required.

Response

locations
array
Array of location objects
[
  {
    "id": "loc-1",
    "name": "New York",
    "description": "US East Coast datacenter",
    "country": "US",
    "city": "New York",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z",
    "_count": {
      "nodes": 3
    }
  },
  {
    "id": "loc-2",
    "name": "London",
    "description": "EU datacenter",
    "country": "GB",
    "city": "London",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z",
    "_count": {
      "nodes": 2
    }
  }
]

Get Location

GET /api/locations/{id}
Get detailed information about a specific location.

Path Parameters

id
string
required
Location UUID

Response

Returns a detailed location object including associated nodes.
{
  "id": "loc-1",
  "name": "New York",
  "description": "US East Coast datacenter",
  "country": "US",
  "city": "New York",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z",
  "nodes": [
    {
      "id": "node-1",
      "displayName": "US East 1",
      "isOnline": true,
      "lastHeartbeat": "2024-01-15T12:00:00Z"
    },
    {
      "id": "node-2",
      "displayName": "US East 2",
      "isOnline": true,
      "lastHeartbeat": "2024-01-15T12:01:00Z"
    }
  ]
}

Errors

  • 404 - Location not found

Create Location

POST /api/locations
Authorization: Bearer {token}
Content-Type: application/json
Create a new location. Admin only.

Authentication

Requires admin role.

Request Body

name
string
required
Location name (1-100 characters)
description
string
Location description
country
string
Country code (e.g., “US”, “GB”, “DE”)
city
string
City name
{
  "name": "Tokyo",
  "description": "Asia Pacific datacenter",
  "country": "JP",
  "city": "Tokyo"
}

Response

Returns the created location object with status 201.
{
  "id": "loc-3",
  "name": "Tokyo",
  "description": "Asia Pacific datacenter",
  "country": "JP",
  "city": "Tokyo",
  "createdAt": "2024-01-15T12:00:00Z",
  "updatedAt": "2024-01-15T12:00:00Z"
}

Errors

  • 400 - Validation failed

Update Location

PATCH /api/locations/{id}
Authorization: Bearer {token}
Content-Type: application/json
Update an existing location. Admin only.

Path Parameters

id
string
required
Location UUID

Authentication

Requires admin role.

Request Body

All fields are optional. Only include fields you want to update.
name
string
Location name (1-100 characters)
description
string
Location description
country
string
Country code
city
string
City name
{
  "description": "Updated datacenter description",
  "city": "Tokyo"
}

Response

Returns the updated location object.
{
  "id": "loc-3",
  "name": "Tokyo",
  "description": "Updated datacenter description",
  "country": "JP",
  "city": "Tokyo",
  "createdAt": "2024-01-15T12:00:00Z",
  "updatedAt": "2024-01-15T12:05:00Z"
}

Errors

  • 400 - Validation failed
  • 404 - Location not found

Delete Location

DELETE /api/locations/{id}
Authorization: Bearer {token}
Delete a location. Cannot delete locations with associated nodes. Admin only.

Path Parameters

id
string
required
Location UUID

Authentication

Requires admin role.

Response

{ "success": true }

Errors

  • 400 - Location has associated nodes
  • 404 - Location not found

Usage Example

Here’s a typical workflow for setting up a new datacenter location:
# 1. Create a location
curl -X POST https://api.stellarstack.io/api/locations \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Singapore",
    "description": "Southeast Asia datacenter",
    "country": "SG",
    "city": "Singapore"
  }'

# Response: { "id": "loc-sg-1", ... }

# 2. Create a node in this location
curl -X POST https://api.stellarstack.io/api/nodes \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "SG Node 1",
    "host": "node1.sg.example.com",
    "port": 8080,
    "locationId": "loc-sg-1",
    "memoryLimit": 34359738368,
    "diskLimit": 107374182400,
    "cpuLimit": 8
  }'

# 3. List all locations to verify
curl https://api.stellarstack.io/api/locations

Build docs developers (and LLMs) love