{
  "openapi": "3.1.1",
  "info": {
    "title": "Nexus hosting",
    "version": "1.1.0",
    "description": "Installed-agent pairing. Requires configured HTTPS origin and VPN/LAN or approved exception. Body limit 131072 bytes.",
    "license": {
      "name": "BSD-3-Clause",
      "identifier": "BSD-3-Clause"
    },
    "contact": {
      "name": "Procyon Systems"
    }
  },
  "servers": [
    {
      "url": "https://nexus.example.test",
      "description": "Placeholder; use the configured feature origin."
    }
  ],
  "tags": [
    {
      "name": "Hosting",
      "description": "Pairing and signed certificate operations."
    }
  ],
  "paths": {
    "/api/v1/hosting/configurator": {
      "get": {
        "operationId": "get_configurator",
        "summary": "Download the pairing helper",
        "description": "Configured-host and approved-network checks apply. See the pairing/signature guide.",
        "tags": [
          "Hosting"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "text/x-python": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Credentials required or invalid. Empty body may be returned.",
            "headers": {}
          },
          "403": {
            "description": "Scope, account or network denied.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource or disabled feature. Empty body may be returned."
          },
          "405": {
            "description": "Method not allowed. Empty body may be returned."
          },
          "409": {
            "description": "State, revision or ownership conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Request body too large. Empty body may be returned."
          },
          "415": {
            "description": "Use application/json. Empty body may be returned."
          },
          "421": {
            "description": "Host is not configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "502": {
            "description": "Upstream artifact error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hosting/enroll": {
      "post": {
        "operationId": "post_enroll",
        "summary": "Claim a pairing token",
        "description": "Configured-host and approved-network checks apply. See the pairing/signature guide.",
        "tags": [
          "Hosting"
        ],
        "security": [
          {
            "pairingToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrollment"
                }
              }
            }
          },
          "400": {
            "description": "Malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Credentials required or invalid. Empty body may be returned.",
            "headers": {}
          },
          "403": {
            "description": "Scope, account or network denied.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource or disabled feature. Empty body may be returned."
          },
          "405": {
            "description": "Method not allowed. Empty body may be returned."
          },
          "409": {
            "description": "State, revision or ownership conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Request body too large. Empty body may be returned."
          },
          "415": {
            "description": "Use application/json. Empty body may be returned."
          },
          "421": {
            "description": "Host is not configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "502": {
            "description": "Upstream artifact error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrollmentRequest"
              }
            }
          }
        }
      }
    },
    "/api/v1/hosting/progress": {
      "post": {
        "operationId": "post_progress",
        "summary": "Report signed progress",
        "description": "Configured-host and approved-network checks apply. See the pairing/signature guide. Authentication is in the signed body, not an HTTP header. Expired certificates cannot authenticate.",
        "tags": [
          "Hosting"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "const": true
                    }
                  },
                  "required": [
                    "accepted"
                  ]
                },
                "example": {
                  "accepted": true
                }
              }
            }
          },
          "400": {
            "description": "Malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Credentials required or invalid. Empty body may be returned.",
            "headers": {}
          },
          "403": {
            "description": "Scope, account or network denied.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource or disabled feature. Empty body may be returned."
          },
          "405": {
            "description": "Method not allowed. Empty body may be returned."
          },
          "409": {
            "description": "State, revision or ownership conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Request body too large. Empty body may be returned."
          },
          "415": {
            "description": "Use application/json. Empty body may be returned."
          },
          "421": {
            "description": "Host is not configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "502": {
            "description": "Upstream artifact error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "x-signed-payload-schema": {
          "$ref": "#/components/schemas/ProgressPayload"
        }
      }
    },
    "/api/v1/hosting/renew": {
      "post": {
        "operationId": "post_renew",
        "summary": "Renew with the enrolled key",
        "description": "Configured-host and approved-network checks apply. See the pairing/signature guide. Authentication is in the signed body, not an HTTP header. Expired certificates cannot authenticate.",
        "tags": [
          "Hosting"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Certificate"
                }
              }
            }
          },
          "400": {
            "description": "Malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Credentials required or invalid. Empty body may be returned.",
            "headers": {}
          },
          "403": {
            "description": "Scope, account or network denied.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource or disabled feature. Empty body may be returned."
          },
          "405": {
            "description": "Method not allowed. Empty body may be returned."
          },
          "409": {
            "description": "State, revision or ownership conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Request body too large. Empty body may be returned."
          },
          "415": {
            "description": "Use application/json. Empty body may be returned."
          },
          "421": {
            "description": "Host is not configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "502": {
            "description": "Upstream artifact error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Delay in seconds before retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "x-signed-payload-schema": {
          "$ref": "#/components/schemas/RenewalPayload"
        }
      }
    },
    "/api/v1/hosting/installer": {
      "get": {
        "operationId": "get_installer",
        "summary": "Retired installation endpoint",
        "description": "Returns 410 on the configured host; use configurator pairing.",
        "deprecated": true,
        "security": [],
        "tags": [
          "Hosting"
        ],
        "responses": {
          "410": {
            "description": "Installation retired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Feature disabled."
          },
          "421": {
            "description": "Wrong host."
          }
        }
      },
      "post": {
        "operationId": "post_installer",
        "summary": "Retired installation endpoint",
        "description": "Returns 410 on the configured host; use configurator pairing.",
        "deprecated": true,
        "security": [],
        "tags": [
          "Hosting"
        ],
        "responses": {
          "410": {
            "description": "Installation retired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Feature disabled."
          },
          "421": {
            "description": "Wrong host."
          }
        }
      }
    },
    "/api/v1/hosting/package": {
      "get": {
        "operationId": "get_package",
        "summary": "Retired installation endpoint",
        "description": "Returns 410 on the configured host; use configurator pairing.",
        "deprecated": true,
        "security": [],
        "tags": [
          "Hosting"
        ],
        "responses": {
          "410": {
            "description": "Installation retired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Feature disabled."
          },
          "421": {
            "description": "Wrong host."
          }
        }
      },
      "post": {
        "operationId": "post_package",
        "summary": "Retired installation endpoint",
        "description": "Returns 410 on the configured host; use configurator pairing.",
        "deprecated": true,
        "security": [],
        "tags": [
          "Hosting"
        ],
        "responses": {
          "410": {
            "description": "Installation retired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Feature disabled."
          },
          "421": {
            "description": "Wrong host."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Certificate": {
        "type": "object",
        "properties": {
          "enrollment_id": {
            "type": "string",
            "description": "Public enrolment ID."
          },
          "agent_identity": {
            "type": "string",
            "description": "Agent identity."
          },
          "server_certificate": {
            "type": "string",
            "description": "PEM server certificate; never a private key."
          },
          "client_ca": {
            "type": "string",
            "description": "PEM client CA certificate."
          },
          "certificate_expires_at": {
            "type": "string",
            "description": "UTC timestamp YYYY-MM-DD HH:MM:SS."
          }
        },
        "required": [
          "enrollment_id",
          "agent_identity",
          "server_certificate",
          "client_ca",
          "certificate_expires_at"
        ]
      },
      "Platform": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "os": {
                "const": "debian"
              },
              "version": {
                "type": "string",
                "enum": [
                  "12",
                  "13"
                ]
              },
              "architecture": {
                "type": "string",
                "enum": [
                  "x86_64",
                  "aarch64"
                ]
              }
            },
            "required": [
              "os",
              "version",
              "architecture"
            ]
          },
          {
            "type": "object",
            "properties": {
              "os": {
                "const": "ubuntu"
              },
              "version": {
                "type": "string",
                "enum": [
                  "24.04",
                  "26.04"
                ]
              },
              "architecture": {
                "type": "string",
                "enum": [
                  "x86_64",
                  "aarch64"
                ]
              }
            },
            "required": [
              "os",
              "version",
              "architecture"
            ]
          },
          {
            "type": "object",
            "properties": {
              "os": {
                "const": "fedora"
              },
              "version": {
                "type": "string",
                "enum": [
                  "43",
                  "44"
                ]
              },
              "architecture": {
                "type": "string",
                "enum": [
                  "x86_64",
                  "aarch64"
                ]
              }
            },
            "required": [
              "os",
              "version",
              "architecture"
            ]
          }
        ]
      },
      "EnrollmentRequest": {
        "type": "object",
        "properties": {
          "csr": {
            "type": "string",
            "description": "PEM CSR generated with the locally retained key.",
            "maxLength": 16384
          },
          "platform": {
            "$ref": "#/components/schemas/Platform"
          }
        },
        "required": [
          "csr",
          "platform"
        ],
        "examples": [
          {
            "csr": "PEM CSR PLACEHOLDER",
            "platform": {
              "os": "debian",
              "version": "13",
              "architecture": "x86_64"
            }
          }
        ]
      },
      "Enrollment": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Certificate"
          },
          {
            "type": "object",
            "properties": {
              "roles": {
                "type": "array",
                "items": {
                  "enum": [
                    "web",
                    "mail"
                  ]
                }
              },
              "configuration_only": {
                "const": true
              },
              "web_roots": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "port": {
                "type": "integer",
                "minimum": 1024,
                "maximum": 65535
              },
              "hostname": {
                "type": "string"
              }
            },
            "required": [
              "roles",
              "configuration_only",
              "web_roots",
              "port",
              "hostname"
            ]
          }
        ]
      },
      "SignedRequest": {
        "type": "object",
        "properties": {
          "enrollment_id": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "description": "Unix seconds, maximum clock difference 300 seconds.",
            "pattern": "^[0-9]+$"
          },
          "nonce": {
            "type": "string",
            "description": "Single-use random nonce, replay record retained ten minutes.",
            "pattern": "^[a-f0-9]{64}$"
          },
          "payload": {
            "type": "string",
            "description": "Base64 UTF-8 JSON; signed in its encoded form.",
            "maxLength": 65536,
            "contentEncoding": "base64"
          },
          "signature": {
            "type": "string",
            "description": "Base64 OpenSSL SHA-256 signature over LF-joined ID, action, time, nonce, encoded payload; no trailing LF.",
            "contentEncoding": "base64"
          }
        },
        "required": [
          "enrollment_id",
          "timestamp",
          "nonce",
          "payload",
          "signature"
        ]
      },
      "ProgressPayload": {
        "type": "object",
        "properties": {
          "step": {
            "enum": [
              "configuring",
              "starting",
              "installed",
              "failed"
            ]
          }
        },
        "required": [
          "step"
        ],
        "examples": [
          {
            "step": "installed"
          }
        ]
      },
      "RenewalPayload": {
        "type": "object",
        "properties": {
          "csr": {
            "type": "string",
            "description": "CSR using the enrolled public key."
          }
        },
        "required": [
          "csr"
        ],
        "examples": [
          {
            "csr": "PEM CSR PLACEHOLDER"
          }
        ]
      }
    },
    "securitySchemes": {
      "pairingToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "One-time ne_ pairing token, 30-minute validity."
      }
    }
  }
}
