sculk.network
Nightly Stable docs
sculkwormnightly · 39a95aaView in Stable docs

sculkworm OpenAPI specification

Download the raw specification: openapi.yaml.

yaml
openapi: 3.1.0
info:
  title: sculkworm Admin API
  version: 0.1.0
  description: Multi-tenant runtime route management API for sculkworm.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://127.0.0.1:8080
security:
  - bearerAuth: []
paths:
  /healthz:
    get:
      summary: Liveness probe
      security: []
      responses:
        "200":
          description: Service is running
          content:
            application/json:
              schema:
                type: object
                required: [status]
                additionalProperties: false
                properties:
                  status:
                    type: string
                    const: ok
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
  /v1/routes:
    get:
      summary: List routes owned by the authenticated tenant
      responses:
        "200":
          description: Caller's dynamic routes, sorted by host
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteListResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
  /v1/agents:
    get:
      summary: List connected agent sessions for the authenticated tenant's closed routes
      responses:
        "200":
          description: Connected agent sessions sorted by host
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AgentListResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "503":
          $ref: "#/components/responses/ErrorResponse"
  /v1/routes/{host}:
    parameters:
      - name: host
        in: path
        required: true
        description: Domain name (URL-decoded, lowercased, at most one trailing dot stripped)
        schema:
          type: string
    get:
      summary: Get one route owned by the authenticated tenant
      responses:
        "200":
          description: Route details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Route"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/ErrorResponse"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
    put:
      summary: Create or update a route within the authenticated tenant's domain scope
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PutRouteRequest"
      responses:
        "200":
          description: Existing route updated or unchanged
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Route"
        "201":
          description: Route created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Route"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          description: Host is outside the authenticated tenant's domain scope
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "408":
          $ref: "#/components/responses/ErrorResponse"
        "409":
          description: Host is defined as a static route or owned by another tenant
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "413":
          $ref: "#/components/responses/ErrorResponse"
        "415":
          $ref: "#/components/responses/ErrorResponse"
        "422":
          description: Invalid host, invalid mode, invalid target, invalid authorizer, target disallowed by allowed_targets, or max_routes reached
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          description: Persisting the state file failed; in-memory route table is unchanged
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "503":
          description: Closed mode is disabled (SCULKWORM_TUNNEL_LISTEN is unset)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
    delete:
      summary: Delete a route owned by the authenticated tenant
      responses:
        "204":
          description: Route deleted
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/ErrorResponse"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "500":
          description: Persisting the state file failed; in-memory route table is unchanged
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
  /v1/routes/{host}/agent-token:
    parameters:
      - name: host
        in: path
        required: true
        description: Domain name of a closed route owned by the authenticated tenant
        schema:
          type: string
    post:
      summary: Mint a new agent token for a closed route, revoking any previous token
      responses:
        "201":
          description: Agent token minted (shown once)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MintedAgentToken"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/ErrorResponse"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "409":
          description: Route is not a closed route
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
        "500":
          $ref: "#/components/responses/ErrorResponse"
        "503":
          $ref: "#/components/responses/ErrorResponse"
    delete:
      summary: Revoke the current agent token for a closed route
      responses:
        "204":
          description: Agent token revoked
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/ErrorResponse"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "409":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
        "503":
          $ref: "#/components/responses/ErrorResponse"
  /v1/routes/{host}/revoke-logins:
    parameters:
      - name: host
        in: path
        required: true
        description: Domain name of a closed route owned by the authenticated tenant
        schema:
          type: string
    post:
      summary: Revoke all logins or one subject's logins for a closed route
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeLoginsRequest"
      responses:
        "200":
          description: Revocation recorded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeLoginsResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/ErrorResponse"
        "405":
          $ref: "#/components/responses/MethodNotAllowed"
        "408":
          $ref: "#/components/responses/ErrorResponse"
        "409":
          $ref: "#/components/responses/ErrorResponse"
        "413":
          $ref: "#/components/responses/ErrorResponse"
        "415":
          $ref: "#/components/responses/ErrorResponse"
        "422":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
        "503":
          $ref: "#/components/responses/ErrorResponse"
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  responses:
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    Unauthorized:
      description: Missing or invalid bearer token
      headers:
        WWW-Authenticate:
          required: true
          schema:
            type: string
            const: Bearer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    MethodNotAllowed:
      description: Method not allowed for this path
      headers:
        Allow:
          required: true
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
  schemas:
    Authorizer:
      oneOf:
        - type: object
          required: [type, client]
          additionalProperties: false
          properties:
            type:
              type: string
              const: oidc
            client:
              type: string
            scopes:
              type: array
              items:
                type: string
            allow:
              oneOf:
                - type: object
                  required: [claim, any_of]
                  additionalProperties: false
                  properties:
                    claim:
                      type: string
                    any_of:
                      type: array
                      items:
                        type: string
                - type: object
                  required: [sculk_server]
                  additionalProperties: false
                  properties:
                    sculk_server:
                      type: string
                      minLength: 1
                      maxLength: 64
        - type: object
          required: [type, client]
          additionalProperties: false
          properties:
            type:
              type: string
              const: oauth2
            client:
              type: string
            scopes:
              type: array
              items:
                type: string
            allow:
              oneOf:
                - type: object
                  required: [field, any_of]
                  additionalProperties: false
                  properties:
                    field:
                      type: string
                    any_of:
                      type: array
                      items:
                        type: string
                - type: object
                  required: [discord_guild]
                  additionalProperties: false
                  properties:
                    discord_guild:
                      type: string
        - type: object
          required: [type, client, subjects]
          additionalProperties: false
          properties:
            type:
              type: string
              const: fixed-list
            client:
              type: string
            scopes:
              type: array
              items:
                type: string
            subjects:
              type: array
              items:
                type: string
    PutRouteRequest:
      type: object
      additionalProperties: false
      properties:
        mode:
          type: string
          enum: [open, closed]
          default: open
        target:
          type: string
          description: Backend target in host:port or [ipv6]:port format (port 1..=65535); required for open routes, forbidden for closed routes
        authorizer:
          $ref: "#/components/schemas/Authorizer"
    AgentTokenSummary:
      type: object
      required: [id, created_at]
      additionalProperties: false
      properties:
        id:
          type: string
        created_at:
          type: string
          format: date-time
    MintedAgentToken:
      type: object
      required: [token, id, created_at]
      additionalProperties: false
      properties:
        token:
          type: string
        id:
          type: string
        created_at:
          type: string
          format: date-time
    AgentSession:
      type: object
      required: [host, session, token_id, peer, software, connected_at, streams]
      additionalProperties: false
      properties:
        host:
          type: string
        session:
          type: string
        token_id:
          type: string
        peer:
          type: string
        software:
          type: string
        connected_at:
          type: string
          format: date-time
        streams:
          type: integer
          minimum: 0
    AgentListResponse:
      type: object
      required: [agents]
      additionalProperties: false
      properties:
        agents:
          type: array
          items:
            $ref: "#/components/schemas/AgentSession"
    RevokeLoginsRequest:
      type: object
      additionalProperties: false
      properties:
        subject:
          type: string
          minLength: 1
          maxLength: 255
    RevokeLoginsResponse:
      oneOf:
        - type: object
          required: [host, revoked_before]
          additionalProperties: false
          properties:
            host:
              type: string
            revoked_before:
              type: string
              format: date-time
        - type: object
          required: [host, subject, revoked_at]
          additionalProperties: false
          properties:
            host:
              type: string
            subject:
              type: string
            revoked_at:
              type: string
              format: date-time
    Route:
      type: object
      required: [host, mode, tenant]
      additionalProperties: false
      properties:
        host:
          type: string
        mode:
          type: string
          enum: [open, closed]
        target:
          type: string
        tenant:
          type: string
        authorizer:
          $ref: "#/components/schemas/Authorizer"
        authorizer_id:
          type: string
        agent_token:
          oneOf:
            - $ref: "#/components/schemas/AgentTokenSummary"
            - type: "null"
        agent_connected:
          type: boolean
        active:
          type: boolean
        inactive_reason:
          type: string
    RouteListResponse:
      type: object
      required: [routes]
      additionalProperties: false
      properties:
        routes:
          type: array
          items:
            $ref: "#/components/schemas/Route"
    ErrorEnvelope:
      type: object
      required: [error]
      additionalProperties: false
      properties:
        error:
          type: object
          required: [code, message]
          additionalProperties: false
          properties:
            code:
              type: string
            message:
              type: string