{
  "openapi": "3.1.0",
  "info": {
    "title": "Servor Public API",
    "version": "1.0.0",
    "description": "Token-authenticated API for Servor. Send `Authorization: Bearer sv_live_...` on every request. Rate limit: 3 req/s burst, 5000 req/hour per token."
  },
  "servers": [
    {
      "url": "https://api.servor.app"
    }
  ],
  "security": [
    {
      "ApiToken": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sv_live_*"
      }
    }
  },
  "tags": [
    {
      "name": "me"
    },
    {
      "name": "servers"
    },
    {
      "name": "commands"
    },
    {
      "name": "monitors"
    },
    {
      "name": "incidents"
    },
    {
      "name": "status-pages"
    },
    {
      "name": "audit"
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "operationId": "v1Me",
        "summary": "Identify the calling token",
        "tags": [
          "me"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "teamId": "uuid",
                  "tokenId": "uuid",
                  "scopes": [
                    "servers:read",
                    "incidents:write"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/servers": {
      "get": {
        "operationId": "v1ListServers",
        "summary": "List servers",
        "tags": [
          "servers"
        ],
        "security": [
          {
            "ApiToken": [
              "servers:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "name": "web-01",
                    "host": "203.0.113.10",
                    "os": "debian",
                    "tags": [
                      "prod"
                    ],
                    "lastSeenAt": "2026-08-20T10:00:00.000Z",
                    "createdAt": "2026-08-01T00:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/servers/{id}": {
      "get": {
        "operationId": "v1GetServer",
        "summary": "Get a server",
        "tags": [
          "servers"
        ],
        "security": [
          {
            "ApiToken": [
              "servers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The server id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "uuid",
                  "name": "web-01",
                  "host": "203.0.113.10",
                  "os": "debian",
                  "tags": [
                    "prod"
                  ],
                  "lastSeenAt": "2026-08-20T10:00:00.000Z",
                  "createdAt": "2026-08-01T00:00:00.000Z"
                }
              }
            }
          }
        }
      }
    },
    "/v1/servers/{id}/commands": {
      "get": {
        "operationId": "v1ListServerCommands",
        "summary": "List command history for a server",
        "tags": [
          "commands"
        ],
        "security": [
          {
            "ApiToken": [
              "commands:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The server id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "1-based page number (default 1).",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Items per page, max 100 (default 20).",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "uuid",
                      "command": "uptime",
                      "source": "manual",
                      "status": "succeeded",
                      "exitCode": 0,
                      "durationMs": 42,
                      "startedAt": "2026-08-20T10:00:00.000Z",
                      "finishedAt": "2026-08-20T10:00:00.100Z",
                      "createdAt": "2026-08-20T10:00:00.000Z"
                    }
                  ],
                  "total": 1,
                  "page": 1,
                  "pageSize": 20
                }
              }
            }
          }
        }
      }
    },
    "/v1/monitors": {
      "get": {
        "operationId": "v1ListMonitors",
        "summary": "List monitors",
        "tags": [
          "monitors"
        ],
        "security": [
          {
            "ApiToken": [
              "monitors:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "name": "Homepage",
                    "type": "http",
                    "status": "up",
                    "enabled": true,
                    "intervalSeconds": 60,
                    "lastCheckAt": "2026-08-20T10:00:00.000Z",
                    "lastStatusChangeAt": null
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/monitors/{id}/checks": {
      "get": {
        "operationId": "v1ListMonitorChecks",
        "summary": "List check results",
        "tags": [
          "monitors"
        ],
        "security": [
          {
            "ApiToken": [
              "monitors:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The monitor id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "ISO date; defaults to the last 24 hours.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "status": "up",
                    "latencyMs": 138,
                    "checkedAt": "2026-08-20T10:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/incidents": {
      "get": {
        "operationId": "v1ListIncidents",
        "summary": "List incidents",
        "tags": [
          "incidents"
        ],
        "security": [
          {
            "ApiToken": [
              "incidents:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "title": "API degraded",
                    "status": "investigating",
                    "impact": "major",
                    "statusPageId": "uuid",
                    "isMaintenance": false,
                    "startedAt": "2026-08-20T10:00:00.000Z",
                    "resolvedAt": null,
                    "createdAt": "2026-08-20T10:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v1CreateIncident",
        "summary": "Create an incident",
        "tags": [
          "incidents"
        ],
        "security": [
          {
            "ApiToken": [
              "incidents:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "status",
                  "impact",
                  "message"
                ],
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Short incident title."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "investigating",
                      "identified",
                      "monitoring",
                      "resolved"
                    ]
                  },
                  "impact": {
                    "type": "string",
                    "enum": [
                      "none",
                      "minor",
                      "major",
                      "critical"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "description": "First update posted with the incident."
                  },
                  "statusPageId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Attach the incident to a status page."
                  },
                  "componentIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Affected components."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "uuid",
                  "title": "API degraded",
                  "status": "investigating"
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents/{id}": {
      "get": {
        "operationId": "v1GetIncident",
        "summary": "Get an incident with its timeline",
        "tags": [
          "incidents"
        ],
        "security": [
          {
            "ApiToken": [
              "incidents:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The incident id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "uuid",
                  "title": "API degraded",
                  "status": "identified",
                  "impact": "major",
                  "statusPageId": "uuid",
                  "isMaintenance": false,
                  "startedAt": "2026-08-20T10:00:00.000Z",
                  "resolvedAt": null,
                  "createdAt": "2026-08-20T10:00:00.000Z",
                  "updates": [
                    {
                      "id": "uuid",
                      "status": "investigating",
                      "message": "Looking into it.",
                      "createdAt": "2026-08-20T10:05:00.000Z"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents/{id}/updates": {
      "post": {
        "operationId": "v1AddIncidentUpdate",
        "summary": "Post an update (resolve with status=resolved)",
        "tags": [
          "incidents"
        ],
        "security": [
          {
            "ApiToken": [
              "incidents:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The incident id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status",
                  "message"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "investigating",
                      "identified",
                      "monitoring",
                      "resolved"
                    ],
                    "description": "Use \"resolved\" to close the incident."
                  },
                  "message": {
                    "type": "string"
                  },
                  "notifySubscribers": {
                    "type": "boolean",
                    "description": "Email/webhook subscribers (default true)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "uuid",
                  "status": "resolved"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status-pages": {
      "get": {
        "operationId": "v1ListStatusPages",
        "summary": "List status pages",
        "tags": [
          "status-pages"
        ],
        "security": [
          {
            "ApiToken": [
              "status-pages:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "name": "Acme Status",
                    "uniqueHostname": "acme12ab34",
                    "slug": "acme",
                    "visibility": "public",
                    "primaryColor": "#06b6d4",
                    "description": null,
                    "suspended": false,
                    "createdAt": "2026-08-01T00:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/status-pages/{id}": {
      "get": {
        "operationId": "v1GetStatusPage",
        "summary": "Get a status page with its components",
        "tags": [
          "status-pages"
        ],
        "security": [
          {
            "ApiToken": [
              "status-pages:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The status page id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "uuid",
                  "name": "Acme Status",
                  "uniqueHostname": "acme12ab34",
                  "slug": "acme",
                  "visibility": "public",
                  "primaryColor": "#06b6d4",
                  "description": null,
                  "suspended": false,
                  "createdAt": "2026-08-01T00:00:00.000Z",
                  "components": [
                    {
                      "id": "uuid",
                      "name": "API",
                      "groupName": null,
                      "position": 0
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/status-pages/{id}/incidents": {
      "get": {
        "operationId": "v1ListStatusPageIncidents",
        "summary": "List incidents shown on a status page",
        "tags": [
          "status-pages"
        ],
        "security": [
          {
            "ApiToken": [
              "status-pages:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The status page id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "title": "API degraded",
                    "status": "investigating",
                    "impact": "major",
                    "statusPageId": "uuid",
                    "isMaintenance": false,
                    "startedAt": "2026-08-20T10:00:00.000Z",
                    "resolvedAt": null,
                    "createdAt": "2026-08-20T10:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/audit": {
      "get": {
        "operationId": "v1ListAudit",
        "summary": "List audit entries",
        "tags": [
          "audit"
        ],
        "security": [
          {
            "ApiToken": [
              "audit:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "Filter by action-type prefix, e.g. \"incident.\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max entries, 1–200 (default 100).",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": [
                  {
                    "id": "uuid",
                    "actionType": "incident.created",
                    "resourceType": "incident",
                    "resourceId": "uuid",
                    "ipAddress": "203.0.113.10",
                    "createdAt": "2026-08-20T10:00:00.000Z"
                  }
                ]
              }
            }
          }
        }
      }
    }
  }
}