GET
/spaces
List all spaces

Returns all spaces with member_count and service_count. Requires Authorization: Bearer <token>.

Example response

{
  "data": [
    {
      "id": 1,
      "name": "Production",
      "slug": "production",
      "description": null,
      "enabled": true,
      "member_count": 3,
      "service_count": 5,
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}
GET
/spaces/my
My spaces

Returns spaces where the authenticated user's JWT sub is listed in space_users.

GET
/spaces/:slug
Space detail

Returns space metadata, the full user list, and services grouped by object_path.

Example response

{
  "data": {
    "id": 1,
    "name": "Production",
    "slug": "production",
    "users": [
      {
        "user_sub": "auth0|abc",
        "email": "user@example.com",
        "first_name": "Alice",
        "last_name": "Smith"
      }
    ],
    "service_groups": [
      {
        "object_path": "Backend",
        "services": [
          {
            "id": 1,
            "name": "api",
            "enabled": true
          }
        ]
      }
    ]
  }
}
POST
/spaces
Create space

Creates a new space. name and slug are required and must be unique.

Request body

{
  "name": "Production",
  "slug": "production",
  "description": "Live environment"
}
POST
/spaces/:slug/users
Add user to space

Adds a user by their JWT sub. The user's email, first_name, and last_name are populated automatically on the next authenticated request.

Request body

{
  "user_sub": "auth0|abc123"
}
POST
/spaces/:slug/services
Add service to space

Assigns a service to a space. object_path is an optional free-text grouping string (e.g. "Backend/APIs") used to organise services on the dashboard.

Request body

{
  "service_name": "my-api",
  "object_path": "Backend/APIs",
  "sort_order": 10
}
GET
/spaces/:slug/dashboard
Space dashboard

Returns the same shape as /dashboard but scoped to services in this space. Services are grouped by object_path under service_groups. Returns 403 if the authenticated user is not a member of the space.

GET
/spaces/:slug/events & /spaces/:slug/alerts
Space events & alerts

Same filter parameters as /events and /alerts but restricted to the space's services. Returns 403 if the user is not a member.