openapi: 3.0.0
info:
  version: 1.0.0
  title: Signaloid Cloud Compute Engine API
  description: |
    This is the Signaloid Cloud Compute Engine API OpenAPI specification.
    Signaloid provides a computing platform to quantify, transmit, and track
    data uncertainty dynamically and throughout computations in unmodified
    computing workloads. The Signaloid Cloud Compute Engine API enables you
    to interface with the Signaloid Cloud Compute Engine programmatically.

    # Authentication
    The Signaloid Cloud Compute Engine API currently offers authentication
    using API keys. Authentication is required for all API requests and the
    request must include the API key it in the `Authentication` header.
    Read more about how to obtain a API key in the
    [Authentication](/docs/api/guides/authentication) guide.

    # API Versioning
    The Signaloid Cloud Compute Engine API is in beta. We make every
    effort to maintain backwards compatibility, but we reserve the right to make
    breaking changes to the API while still in beta. We will announce breaking
    changes in the [Signaloid Cloud Platform Release
    Notes](https://headwayapp.co/signaloid-cloud-platform-release-notes).

    # API Guides
    The current page is the API reference. For more information about how to use
    the Signaloid Cloud API in your application and combine different requests,
    see the [API Guides](/docs/api/guides).
  termsOfService: https://legal.signaloid.io/terms-of-service.html
  contact:
    name: Signaloid Developer Support
    email: developer-support@signaloid.com
servers:
  - url: https://api.signaloid.io
security:
  - ApiKey: []
paths:
  /cores:
    get:
      summary: List Cores
      description: |
        Returns the list of custom Signaloid cores available to the account. The
        response does not include the default cores available to all accounts.
      operationId: ListCores
      tags:
        - Cores
      parameters:
        - in: query
          name: default
          description: >
            By default this API will return your custom cores.

            By providing this parameter you will get back the default cores,
            created and managed by Signaloid for you.
          allowEmptyValue: true
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - UserID
                  - Cores
                  - Count
                properties:
                  UserID:
                    $ref: '#/components/schemas/UserID'
                  Cores:
                    type: array
                    items:
                      $ref: '#/components/schemas/Core'
                  Count:
                    type: integer
                    minimum: 0
                  ContinuationKey:
                    description: |
                      A continuation token that can be used to get the next page
                      of results. When this field is not present, there are no
                      more results to return.
                    $ref: '#/components/schemas/CoreID'
              examples:
                CoresGetResponseOK:
                  value:
                    UserID: usr_b0bf834b1ec54d6cb332cc1300efdcba
                    Count: 3
                    ContinuationKey: cor_051481609fe04665b576ab066e378257
                    Cores:
                      - Object: Core
                        CoreID: cor_051481609fe04665b576ab066e378257
                        Owner: usr_b0bf834b1ec54d6cb332cc1300efdcba
                        CreatedAt: 1670405103
                        UpdatedAt: 1670405103
                        Name: My Custom Athens Core
                        Class: C0
                        Microarchitecture: Athens
                        CorrelationTracking: disable
                        MemorySize: 2000000
                        Precision: 32
                      - Object: Core
                        CoreID: cor_3c336f8d8dd343a2b91ca278de0ba32c
                        Owner: usr_b0bf834b1ec54d6cb332cc1300efdcba
                        CreatedAt: 1669821723
                        UpdatedAt: 1669908393
                        Name: Custom Reference Core
                        Class: C0
                        Microarchitecture: Reference
                        CorrelationTracking: disable
                        MemorySize: 32000000
                        Precision: 8
                      - Object: Core
                        CoreID: cor_cd6071a8c67f4a8caad3a8950417d703
                        Owner: usr_b0bf834b1ec54d6cb332cc1300efdcba
                        CreatedAt: 1669822394
                        UpdatedAt: 1669822394
                        Name: Enceladus
                        Class: C0
                        Microarchitecture: Athens
                        CorrelationTracking: autocorrelation
                        MemorySize: 2000000
                        Precision: 512
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    post:
      summary: Create Core
      description: |
        Creates a new custom Signaloid Core. The new Core becomes available to
        the account and is returned in the response.
      operationId: CreateCore
      tags:
        - Cores
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CorePost'
            examples:
              CoresPostRequest:
                value:
                  Name: My New Custom Core
                  Class: C0
                  Microarchitecture: Athens
                  CorrelationTracking: autocorrelation
                  MemorySize: 256000
                  Precision: 128
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Core'
              examples:
                CoresPostResponseOK:
                  value:
                    Object: Core
                    CoreID: cor_3ff9395ee9494f3d91a8e1b5999d737e
                    Owner: usr_b0bf834b1ec54d6cb332cc1300efdcba
                    CreatedAt: 1677025457
                    UpdatedAt: 1677025457
                    Name: My New Custom Core
                    Class: C0
                    Microarchitecture: Athens
                    CorrelationTracking: autocorrelation
                    MemorySize: 256000
                    Precision: 128
          links:
            get:
              operationId: GetCore
              parameters:
                coreID: $response.body#/CoreID
            edit:
              operationId: EditCore
              parameters:
                coreID: $response.body#/CoreID
            delete:
              operationId: DeleteCore
              parameters:
                coreID: $response.body#/CoreID
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Empty request body
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Forbidden
                    message: >-
                      Custom Core limit reached. Please upgrade your account to
                      create more cores.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /cores/{CoreID}:
    parameters:
      - $ref: '#/components/parameters/CoreID'
    get:
      summary: Get Core
      description: |
        Returns the custom Signaloid core identified by the `CoreID` path
        parameter.
      operationId: GetCore
      tags:
        - Cores
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Core'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Missing path parameter 'CoreID'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    delete:
      summary: Delete Core
      description: |
        Permanently deletes the custom Signaloid core identified by the `CoreID`
        parameter.
      operationId: DeleteCore
      tags:
        - Cores
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Missing path parameter 'CoreID'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    patch:
      summary: Update Core
      description: |
        Updates the custom Signaloid core identified by the `CoreID` parameter.
        This method is useful for updating the core of a specific `CoreID`
        without having to edit integrations that use this core. The request must
        change at least one of the editable Core properties for the Signaloid
        Cloud API to accept it. The response is the edited core.
      operationId: UpdateCore
      tags:
        - Cores
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CorePatch'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Nothing to update
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Forbidden
                    message: Requested resources exceed your current tier limits
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Not Found
                    message: Core not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /repositories:
    get:
      summary: List connected repositories
      description: |
        Returns the list of git repositories available to the account.
      operationId: GetConnectedRepositories
      tags:
        - Repositories
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - UserID
                  - Repositories
                  - Count
                properties:
                  UserID:
                    $ref: '#/components/schemas/UserID'
                  Repositories:
                    type: array
                    items:
                      $ref: '#/components/schemas/Repository'
                  Count:
                    type: integer
                    minimum: 0
                  ContinuationKey:
                    description: |
                      A continuation token that can be used to get the next page
                      of results. When this field is not present, there are no
                      more results to return.
                    $ref: '#/components/schemas/RepositoryID'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    post:
      summary: Connect a Repository
      description: >
        Creates a new connection to a git repository. The request must contain

        the URL of the repository, commit, branch, and build directory. The
        response

        is the created connected repository resource.
      operationId: ConnectRepository
      tags:
        - Repositories
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RepositoryPost'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Repository'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Missing or malformed 'RemoteURL' field
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Forbidden
                    message: >-
                      Repositories limit reached. Please upgrade your account to
                      create more repositories.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                repositoryPostRequest:
                  $ref: '#/components/examples/InternalServerError'
  /repositories/{RepositoryID}:
    parameters:
      - $ref: '#/components/parameters/RepositoryID'
    get:
      summary: Get Repository
      description: |
        Returns the connected git repository resource identified by the
        `RepositoryID` parameter.
      operationId: GetRepository
      tags:
        - Repositories
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Repository'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Missing path parameter 'RepositoryID'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    delete:
      summary: Delete Repository
      description: |
        Permanently deletes the connected git repository resource identified by
        the `RepositoryID` parameter.
      operationId: DeleteRepository
      tags:
        - Repositories
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: OK
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    patch:
      summary: Update Repository
      description: |
        Updates the connected git repository resource identified by the
        `RepositoryID` parameter. This method is useful for updating the
        connected repository resource of a specific `RepositoryID` (e.g., to
        change the branch it points at) without having to edit integrations that
        use this repository. The request must change at least one of the
        editable repository properties for the Signaloid Cloud API to accept it.
        The response is the edited repository resource.
      operationId: UpdateRepository
      tags:
        - Repositories
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                RemoteURL:
                  type: string
                  format: uri
                Commit:
                  type: string
                Branch:
                  type: string
                BuildDirectory:
                  type: string
                  description: |
                    The directory in the repository where the Signaloid Cloud
                    Engine should use as working directory when attempting to
                    build the repository application. This directory is relative
                    to the root of the repository.
                Arguments:
                  type: string
                  description: |
                    Default command-line arguments that the Signaloid Cloud
                    Engine should pass when executing the built repository
                    application.
                Core:
                  $ref: '#/components/schemas/CoreID'
                DataSources:
                  $ref: '#/components/schemas/DataSources'
                TraceVariables:
                  description: >
                    The default variables that the Signaloid Cloud Compute
                    Engine should

                    trace when executing the Repository application.
                  type: array
                  items:
                    $ref: '#/components/schemas/TraceVariableRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Repository'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Nothing to update
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /repositories/{RepositoryID}/builds:
    parameters:
      - $ref: '#/components/parameters/RepositoryID'
    post:
      summary: Create Build from Repository
      description: |
        Creates a new build from the specified repository.
      operationId: CreateRepositoryBuild
      tags:
        - Repositories
        - Builds
      parameters:
        - in: query
          name: DiscoverVariables
          description: >
            If set to "true", the build will attempt to discover variables that
            can be traced.
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                CoreID:
                  $ref: '#/components/schemas/CoreID'
                TraceVariables:
                  type: array
                  items:
                    $ref: '#/components/schemas/TraceVariableRequest'
                  description: >
                    Variables to trace in the built application. If not
                    provided, will use the repository's defaults.
                DataSources:
                  $ref: '#/components/schemas/DataSources'
                  description: >
                    Data sources to use with this build. If not provided, will
                    use the repository's defaults.
                Arguments:
                  type: string
                  description: >
                    Command-line arguments to pass to the application. If not
                    provided, will use the repository's defaults.
                IsPublic:
                  type: boolean
                  description: >
                    Marks the build as publicly accessible. When enabled, other
                    users can run tasks based on this build without requiring
                    authorization.
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  BuildID:
                    $ref: '#/components/schemas/BuildID'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Resource limits reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
  /tasks:
    get:
      summary: List Tasks
      description: >
        Returns the list of Tasks in the account. The list is sorted by field

        `CreatedAt` in descending order. To learn more about Tasks, see the
        Tasks section

        in the Signaloid Cloud Platform Documentation.
      operationId: GetTasks
      tags:
        - Tasks
      parameters:
        - in: query
          name: status
          description: |
            Filter the list of Tasks by status. Required to expand Tasks. By
            default the list includes all Tasks. To filter the list by status
            set the status query parameter to a valid Status value.
          schema:
            $ref: '#/components/schemas/TaskStatus'
        - in: query
          name: startKey
          description: |
            The TaskID to start from when returning the list of Tasks. Use for
            paginating responses.
          schema:
            $ref: '#/components/schemas/TaskID'
        - in: query
          name: from
          description: >
            Filter tasks by creation date - only include tasks created on or
            after this date.
          schema:
            type: string
            format: date-time
        - in: query
          name: to
          description: >
            Filter tasks by creation date - only include tasks created on or
            before this date.
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - UserID
                  - Tasks
                  - Count
                properties:
                  UserID:
                    $ref: '#/components/schemas/UserID'
                  Count:
                    type: integer
                    minimum: 0
                    description: The number of Tasks in the list.
                  ContinuationKey:
                    type: string
                    description: |
                      The identifier of the last Task returned. Use for
                      paginating responses.
                  Tasks:
                    oneOf:
                      - type: array
                        items:
                          $ref: '#/components/schemas/Task'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}:
    parameters:
      - $ref: '#/components/parameters/TaskID'
    get:
      summary: Get Task
      description: |
        Returns the Task resource identified by the `TaskID` path parameter. To
        learn more about Tasks, see the Tasks section in the Signaloid Cloud
        Developer Platform Documentation.
      operationId: GetTask
      tags:
        - Tasks
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Empty request body
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      summary: Delete Task
      description: |
        Permanently deletes the Task identified by the `TaskID` path parameter.
        This operation cannot be performed on active tasks.
      operationId: DeleteTask
      tags:
        - Tasks
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict - Cannot remove active task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/public:
    parameters:
      - $ref: '#/components/parameters/TaskID'
    get:
      summary: Open (authentication-free) Get Task
      description: >
        Returns the Task resource identified by the `TaskID` path parameter.  

        You can only use this authentication-free endpoint for tasks created
        from public builds.  

        To learn more about Tasks, see the Tasks section in the Signaloid Cloud
        Developer Platform Documentation.
      operationId: PublicGetTask
      tags:
        - Tasks
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Empty request body
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/cancel:
    parameters:
      - $ref: '#/components/parameters/TaskID'
    post:
      summary: Cancel Task
      description: |
        Cancels the active Task identified by the `TaskID` path parameter.
      operationId: CancelTask
      tags:
        - Tasks
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  Message:
                    type: string
                    example: Cancel Task Signal sent
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: Missing path parameter 'TaskID'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '409':
          description: Conflict - Task already terminated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/outputs:
    parameters:
      - $ref: '#/components/parameters/TaskID'
    get:
      summary: Get Task Outputs
      description: |
        Returns URLs to the output files associated with the task.
      operationId: GetTaskOutputs
      tags:
        - Tasks
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskOutputReturn'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/outputs/public:
    parameters:
      - $ref: '#/components/parameters/TaskID'
    get:
      summary: Open (authentication-free) Get Task Outputs
      description: >
        Returns URLs to the output files for the specified task. This endpoint
        is authentication-free and you can only use it for tasks created from
        public builds.
      operationId: PublicGetTaskOutputs
      security: []
      tags:
        - Tasks
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskOutputReturn'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/output/{Stream}:
    get:
      description: >-
        Returns the requested output (Stdout or Stderr) for a specific task.
        Returns the plain text output, or a redirect to a download URL if output
        is larger than 5 MB. Optional query param to skip cache.
      summary: Get Task Stream Output
      tags:
        - Tasks
      parameters:
        - description: Task ID
          in: path
          name: TaskID
          required: true
          schema:
            type: string
        - description: Output stream (Stdout or Stderr)
          in: path
          name: Stream
          required: true
          schema:
            type: string
        - description: If true, bypass cache
          in: query
          name: skipCache
          schema:
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
            text/plain:
              schema:
                type: string
          description: Plain text stream output
        '302':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Redirect, see header" Header:"Location
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request (missing or invalid parameters)
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
  /tasks/{TaskID}/output/public:
    parameters:
      - description: Task ID
    get:
      description: >-
        Returns the requested output stream (Stdout or Stderr) for a task from a
        public build. This endpoint is authentication-free. It returns the
        output as plain text, or redirects to a download URL if the output
        exceeds 5 MB. Supports an optional query parameter to bypass the cache.
      summary: Open (authentication-free) Get Task Stream Output
      tags:
        - Tasks
      security: []
      parameters:
        - description: Task ID
          in: path
          name: TaskID
          required: true
          schema:
            type: string
        - description: Output stream (Stdout or Stderr)
          in: path
          name: Stream
          required: true
          schema:
            type: string
        - description: If true, bypass cache
          in: query
          name: skipCache
          schema:
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
            text/plain:
              schema:
                type: string
          description: Plain text stream output
        '302':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Redirect, see header" Header:"Location
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request (missing or invalid parameters)
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
  /tasks/{TaskID}/values/{ValueID}/samples:
    get:
      summary: List of generated samples in Reference Core runs
      description: >
        Returns the list of samples that were generated for the provided ValueID
        during the Reference Core task with the provided TaskID.

        In Reference Core Tasks, the Value identifiers (ValueID) are part of the
        standard output streams.
      operationId: GetTaskValueSamplesFromValueID
      tags:
        - Samples
      parameters:
        - in: query
          name: count
          description: >
            By default this API will return up to 1000 samples.

            By providing this parameter you can specify the number of samples
            returned.

            This parameter has a maximum limit of 100000.
          schema:
            type: integer
            default: 1000
            minimum: 0
            maximum: 100000
        - $ref: '#/components/parameters/TaskID'
        - $ref: '#/components/parameters/ValueID'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generateSamplesGetReply'
              examples:
                GenerateSamplesGetReply:
                  value:
                    Samples: &ref_0
                      - -1.0824527064791272
                      - -1.1310969119258107
                      - -1.0961994836548592
                      - -1.0720671348781252
                      - -1.1521749654880011
                      - -1.1528152657116664
                      - -1.1087047905171288
                      - -1.1326621923296623
                      - -1.0653820188992815
                      - -1.0858505883930254
                      - -1.1296963560287887
                      - -1.1013858150162135
                      - -1.0817764623439143
                      - -1.1775805891128661
                      - -1.070222023706863
                      - -1.0750953816720847
                      - -1.1568745145008779
                      - -1.1036719268767403
                      - -1.0878985057236494
                      - -1.0993357638716614
                      - -1.1407131752971837
                      - -1.1437027951679817
                      - -1.0901123548429996
                      - -1.0891835247279822
                      - -1.1566131594680455
                      - -1.1163989797228004
                      - -1.1022456684084043
                      - -1.1367967100453717
                      - -1.0960555317070564
                      - -1.112673925381313
                      - -1.1045915034476725
                      - -1.1336645059101502
                    Count: 32
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Not Found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /tasks/{TaskID}/values/{ValueID}/plot:
    parameters:
      - $ref: '#/components/parameters/taskID'
      - $ref: '#/components/parameters/valueID'
    post:
      summary: Plot Value ID
      operationId: PlotValueID
      description: >
        Plot a Reference Core run output value identified by the `TaskID` and
        `ValueID` query parameters.

        Returns a `PlotID` and a direct URL that can be used to retrieve the

        plot image.
      tags:
        - Plots
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/plotPostReply'
              examples:
                plotPostReply:
                  $ref: '#/components/examples/plotPostReply'
  /samples:
    get:
      summary: Random samples from hexadecimal ("Ux") data
      description: >
        Returns a list of random samples from the provided Hexadecimal ("Ux")
        Data Format (Ux string).

        In non-Reference Core Tasks, distributions encoded as Ux strings are
        part of the standard output streams."
      operationId: GetTaskValueSamplesFromUxString
      tags:
        - Samples
      parameters:
        - in: query
          name: count
          description: >
            By default this API will return up to 1000 samples.

            By providing this parameter you can specify the number of samples
            returned.

            This parameter has a maximum limit of 100000.
          schema:
            type: integer
            minimum: 0
            default: 1000
            maximum: 100000
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SamplesGenerateByUxStringRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generateSamplesGetReply'
              examples:
                GenerateSamplesGetReply:
                  value:
                    Samples: *ref_0
                    Count: 32
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /plot:
    post:
      summary: Plot Ux String
      operationId: PlotUxString
      description: >
        Plot a Laplace Core run Ux string by passing into the body of the
        request.

        Returns a `PlotID` and a direct URL that can be used to retrieve the

        plot image.
      tags:
        - Plots
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlotUxStringRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/plotPostReply'
              examples:
                plotPostReply:
                  $ref: '#/components/examples/plotPostReply'
  /files:
    get:
      summary: List Files or Directories
      operationId: listFiles
      tags:
        - Cloud Storage
      parameters:
        - name: path
          in: query
          required: false
          description: >-
            Directory to list. Defaults to the root directory (`/`) for the
            authenticated user.
          schema:
            type: string
        - name: startKey
          in: query
          required: false
          description: Continuation token for paginated results.
          schema:
            type: string
      responses:
        '200':
          description: List of files and directories.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    description: Number of items returned.
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                          description: Relative path to the file or directory.
                        last_modified:
                          type: integer
                          description: Timestamp of the last modification.
                        size:
                          type: integer
                          description: Size of the file in bytes.
                        etag:
                          type: string
                          description: ETag of the file.
                  nextContinuationToken:
                    type: string
                    description: Token for fetching the next page of results.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /files/{path}:
    parameters:
      - $ref: '#/components/parameters/path'
    get:
      summary: Download a file or list a directory
      operationId: GetStorageFile
      tags:
        - Cloud Storage
      parameters:
        - name: download
          in: query
          description: If provided, downloads the specified file.
          schema:
            type: boolean
          required: false
        - name: path
          in: path
          description: The relative path to the file or directory.
          schema:
            type: string
          required: true
      responses:
        '200':
          description: File metadata or directory contents.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/fileList'
                  - $ref: '#/components/schemas/fileDownload'
              examples:
                fileList:
                  $ref: '#/components/examples/fileList'
                fileDownload:
                  $ref: '#/components/examples/fileDownload'
        '400':
          description: Bad Request - Invalid or malformed path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found - File or directory does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    put:
      summary: Upload a file or create a directory
      operationId: PutStorageFile
      tags:
        - Cloud Storage
      parameters:
        - name: directory
          in: query
          description: If provided, creates a directory at the specified path.
          schema:
            type: boolean
          required: false
        - name: size
          in: query
          description: >-
            The size of the file to be uploaded, in bytes. Required for file
            uploads.
          schema:
            type: integer
          required: false
        - name: path
          in: path
          description: The relative path where the file or directory will be created.
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Success - Directory created or pre-signed URL generated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  upload_url:
                    type: string
                    description: Pre-signed URL for uploading the file.
        '400':
          description: Bad Request - Invalid or malformed path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '403':
          description: Forbidden - Storage limit exceeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    delete:
      summary: Delete a file or directory
      operationId: DeleteStorageFile
      tags:
        - Cloud Storage
      parameters:
        - name: recursive
          in: query
          description: >-
            If provided, deletes directories and their contents recursively.
            Valid only for directories.
          schema:
            type: boolean
          required: false
        - name: directory
          in: query
          description: If provided, specifies that the path refers to a directory.
          schema:
            type: boolean
          required: false
        - name: path
          in: path
          description: The relative path to the file or directory to delete.
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Success - File or directory deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '400':
          description: Bad Request - Invalid query parameter or malformed path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found - File or directory does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /builds:
    get:
      summary: List Builds
      description: |
        Returns the list of builds.
      operationId: ListBuilds
      tags:
        - Builds
      parameters:
        - in: query
          name: startKey
          description: >
            The BuildID to start from when returning the list of builds. Used
            for paginating responses.
          schema:
            type: string
        - in: query
          name: from
          description: >
            Filter builds by creation date - only include builds created on or
            after this date.
          schema:
            type: string
            format: date-time
        - in: query
          name: to
          description: >
            Filter builds by creation date - only include builds created on or
            before this date.
          schema:
            type: string
            format: date-time
        - in: query
          name: status
          description: |
            Filter the list of builds by status.
          schema:
            $ref: '#/components/schemas/BuildStatus'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - UserID
                  - Builds
                  - Count
                properties:
                  UserID:
                    $ref: '#/components/schemas/UserID'
                  Builds:
                    type: array
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/Build'
                        - type: object
                          properties:
                            BuildID:
                              $ref: '#/components/parameters/BuildID'
                            Owner:
                              $ref: '#/components/parameters/UserID'
                            CreatedAt:
                              type: integer
                  Count:
                    type: integer
                    minimum: 0
                  ContinuationKey:
                    type: string
                    description: >
                      The identifier of the last Build returned. Use for
                      paginating responses.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    get:
      summary: Get Build
      description: |
        Returns the build resource identified by the `BuildID` path parameter.
      operationId: GetBuild
      tags:
        - Builds
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Build'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      summary: Delete Build
      description: >
        Permanently deletes the build asset identified by the `BuildID` path
        parameter.

        This operation cannot be performed on active builds.
      operationId: DeleteBuild
      tags:
        - Builds
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict - Cannot remove active build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/binary:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    get:
      summary: Get Build Binary
      description: >
        Returns a pre-signed URL to download the binary artifact for the build
        identified by the `BuildID` path parameter.

        This is only available for builds with C0-microSD core class.
      operationId: GetBuildBinary
      tags:
        - Builds
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
                    description: Presigned URL to download the binary
        '400':
          description: >-
            Bad Request - Binary download is only available for C0-microSD core
            class
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/outputs:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    get:
      summary: Get Build Outputs
      description: |
        Returns URLs to the output files associated with the build.
      operationId: GetBuildOutputs
      tags:
        - Builds
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildOutputReturn'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/variables:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    get:
      summary: Get Build Variables
      description: |
        Returns the list of variables discovered in the build.
      operationId: GetBuildVariables
      tags:
        - Builds
      parameters:
        - in: query
          name: startKey
          description: >
            The key to start from when returning the list of variables. Used for
            paginating responses.
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  BuildID:
                    type: string
                  Variables:
                    type: array
                    items:
                      $ref: '#/components/schemas/Variable'
                  Count:
                    type: integer
                    minimum: 0
                  ContinuationKey:
                    type: string
                    description: |
                      Token for paginating responses.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/cancel:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    post:
      summary: Cancel Build
      description: |
        Cancels an active build identified by the `BuildID` path parameter.
      operationId: CancelBuild
      tags:
        - Builds
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  Message:
                    type: string
                    example: Cancel Build Signal sent
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict - Build already terminated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/tasks:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    get:
      summary: List Build Tasks
      description: |
        Returns the list of tasks associated with the specified build.
      operationId: GetBuildTasks
      tags:
        - Builds
      parameters:
        - in: query
          name: startKey
          description: >
            The key to start from when returning the list of tasks. Used for
            paginating responses.
          schema:
            type: string
        - in: query
          name: from
          description: >
            Filter tasks by creation date - only include tasks created on or
            after this date.
          schema:
            type: string
            format: date-time
        - in: query
          name: to
          description: >
            Filter tasks by creation date - only include tasks created on or
            before this date.
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  BuildID:
                    $ref: '#/components/schemas/BuildID'
                  Tasks:
                    type: array
                    items:
                      $ref: '#/components/schemas/Task'
                  Count:
                    type: integer
                    minimum: 0
                  ContinuationKey:
                    type: string
                    description: |
                      Token for paginating responses.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      summary: Create Task from Build
      description: |
        Creates a new task using the specified build.
      operationId: CreateBuildTask
      tags:
        - Builds
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                Arguments:
                  type: string
                  description: Command-line arguments to pass to the application.
                DataSources:
                  $ref: '#/components/schemas/DataSources'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  TaskID:
                    $ref: '#/components/schemas/TaskID'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Resource limits reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /sourcecode/builds:
    post:
      summary: Create Build From Single-file Source Code
      description: >
        Creates a new build from a single-file source code. The source code is
        compiled and built using the specified core.
      operationId: CreateSourceCodeBuild
      tags:
        - Builds
      parameters:
        - in: query
          name: DiscoverVariables
          description: >
            If set to "true", the build will attempt to discover variables that
            can be traced.
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - Code
                - Language
              properties:
                Code:
                  type: string
                  description: >
                    The source code to build. Can be provided as plain text or
                    Base64 encoded.
                Language:
                  type: string
                  enum:
                    - C
                    - C++
                    - Fortran
                  description: |
                    The programming language of the source code.
                CoreID:
                  type: string
                  description: >
                    The ID of the core to use for building. If not provided, a
                    default core will be used.
                TraceVariables:
                  type: array
                  items:
                    $ref: '#/components/schemas/TraceVariableRequest'
                IsPublic:
                  type: boolean
                  description: >-
                    Marks the build as publicly accessible. When enabled, other
                    users can run tasks based on this build without requiring
                    authorization.
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  BuildID:
                    $ref: '#/components/schemas/BuildID'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /health:
    get:
      summary: Get system health status
      description: |
        Returns the health status of Signaloid Cloud services.

        The health check system monitors:
        - Signaloid Cloud Developer Platform (SCDP)
        - Signaloid Cloud Compute Engine (SCCE) API
        - SCCE Compute Engine
        - SCCE Build Engine
      tags:
        - Health
      responses:
        '200':
          description: System health status
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/healthStatus'
                  - $ref: '#/components/schemas/serviceHealth'
              examples:
                allServices:
                  value:
                    timestamp: '2025-05-16T13:55:25.605Z'
                    services:
                      - service: scdp
                        status: healthy
                        timestamp: '2025-05-16T13:55:13.205Z'
                        details:
                          responseTime: 147
                      - service: scce-api
                        status: healthy
                        timestamp: '2025-05-16T13:54:55.718Z'
                        details:
                          responseTime: 1103
                          endpoints:
                            builds:
                              status: 200
                              responseTime: 810
                            tasks:
                              status: 200
                              responseTime: 182
                      - service: scce-compute
                        status: healthy
                        timestamp: '2025-05-16T13:45:51.347Z'
                        details:
                          responseTime: 5660
                          taskStatus:
                            id: tsk_54b1033f215343ecb714c687eee74220
                            status: Completed
                            duration: 5506
                      - service: scce-build
                        status: healthy
                        timestamp: '2025-05-16T13:45:44.654Z'
                        details:
                          responseTime: 14263
                          buildStatus:
                            id: bld_2858641292e34c3186ae0058526fcccd
                            status: Completed
                            duration: 14170
                          repoBuildStatus:
                            id: bld_765567fee84f4f47838ffee7e16c9ca7
                            status: Completed
                            duration: 13423
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
              description: CORS header
            Content-Type:
              schema:
                type: string
                enum:
                  - application/json
              description: Response content type
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
              example:
                error: Internal server error while fetching health check results
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
            Content-Type:
              schema:
                type: string
                enum:
                  - application/json
  /keys:
    get:
      summary: List API Keys
      description: |
        Returns the list of API keys for the authenticated user.
      operationId: ListKeys
      tags:
        - Keys
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/keysGetReply'
              examples:
                keysGetReply:
                  value:
                    UserID: usr_000000000000000000000000000000ab
                    Keys:
                      - Object: Key
                        KeyID: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
                        Name: My API Key
                        Owner: usr_000000000000000000000000000000ab
                        CreatedAt: 1698241879
                        ValidUntil: null
                    Count: 1
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
    post:
      summary: Create API Key
      description: |
        Creates a new API key for the authenticated user. The full API key is
        only returned once upon creation and cannot be retrieved again.
      operationId: CreateKey
      tags:
        - Keys
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/keysPostRequest'
            examples:
              keysPostRequest:
                value:
                  Name: My New API Key
                  ValidUntil: 1735689600
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/keysPostReply'
              examples:
                keysPostReply:
                  value:
                    Object: Key
                    Key: >-
                      scce_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2_12345678
                    KeyID: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
                    Name: My New API Key
                    Owner: usr_000000000000000000000000000000ab
                    ValidUntil: 1735689600
                    CreatedAt: 1698241879
          links:
            delete:
              operationId: DeleteKey
              parameters:
                KeyID: $response.body#/KeyID
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: >-
                      The 'Name' field is required. Please provide a string
                      value.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Forbidden
                    message: >-
                      You have reached the API Key limit for your account.
                      Please upgrade your account to create more keys.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /keys/{KeyID}:
    parameters:
      - $ref: '#/components/parameters/KeyID'
    delete:
      summary: Delete API Key
      description: |
        Deletes an API key for the authenticated user. The key will be
        immediately invalidated and can no longer be used for authentication.
      operationId: DeleteKey
      tags:
        - Keys
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/keysDeleteReply'
              examples:
                keysDeleteReply:
                  value:
                    message: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Bad Request
                    message: The 'KeyID' path parameter is required.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  value:
                    error: Not Found
                    message: The requested API Key was not found.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/InternalServerError'
  /webhooks:
    post:
      summary: Create a new webhook
      description: >
        Creates a new webhook endpoint for receiving event notifications.


        ## Available Webhook Events


        The infrastructure API supports webhook notifications for the following
        events:


        ### 1. Task Status Changed (`task-status`)

        Triggered when a task's status changes through any of these states:

        - `Initializing` - Task is being set up

        - `In Progress` - Task is actively running

        - `Completed` - Task finished successfully

        - `Cancelled` - Task was cancelled by user

        - `Stopped` - Task was stopped by system

        - `Failed` - Task encountered an error


        **Payload includes:** `taskId`, `status`, `message`, and `updatedAt`.


        ### 2. Build Status Changed (`build-status`)

        Triggered when a build's status changes through any of these states:

        - `Initializing` - Build is being set up

        - `In Progress` - Build is actively running

        - `Completed` - Build finished successfully

        - `Cancelled` - Build was cancelled by user

        - `Stopped` - Build was stopped by system

        - `Failed` - Build encountered an error


        **Payload includes:** `buildId`, `status`, `message`, and `updatedAt`.


        ### 3. Task Count Changed (`task-count`)

        Triggered when a user's task count changes (tasks created or completed).


        **Payload includes:** `userId`, `IncrementTaskCount`, and
        `DecrementTaskCount`.


        ### 4. Build Count Changed (`build-count`)

        Triggered when a user's build count changes (builds created or
        completed).


        **Payload includes:** `userId`, `IncrementBuildCount`, and
        `DecrementBuildCount`.


        ### 5. Task Stats Changed (`task-stats`)

        Triggered when a user's task execution stats are updated.


        **Payload includes:** `userId`, `TotalDynamicInstructions`, and
        `TotalExecutionTime`.


        ### 6. Build Stats Changed (`build-stats`)

        Triggered when a user's build stats are updated.


        **Payload includes:** `userId`, `TotalBuildSize`, and `TotalBuildTime`.


        ## Webhook Payload Structure


        All webhook payloads follow this consistent structure:


        ```json

        {
          "version": "1.0",
          "eventType": "task-status|build-status|task-count|build-count|task-stats|build-stats",
          "userId": "usr_[32-char-alphanumeric]",
          "timestamp": "2024-03-20T10:00:00Z",
          "data": {
            // Event-specific data varies by event type
          }
        }

        ```


        ## Security


        - All webhooks include a signature header for verification

        - Webhooks support retry logic for failed deliveries

        - Rate limiting applies to webhook deliveries
      operationId: CreateWebhook
      tags:
        - Webhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCreateRequest'
      responses:
        '201':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Bad Request
                message: URL and at least one event are required
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      summary: List all webhooks
      description: Retrieves a list of all webhooks for the authenticated user
      operationId: ListWebhooks
      tags:
        - Webhooks
      responses:
        '200':
          description: List of webhooks retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookList'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /builds/{BuildID}/tasks/public:
    parameters:
      - $ref: '#/components/parameters/BuildID'
    post:
      summary: Open (authentication-free) Create Task from Build
      description: >
        Creates a new task from a publicly accessible build. You can use this
        endpoint only with builds marked as public and does not require
        authorization.
      operationId: CreatePublicBuildTask
      security: []
      tags:
        - Builds
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                Arguments:
                  type: string
                  description: Command-line arguments to pass to the application.
                DataSources:
                  $ref: '#/components/schemas/DataSources'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  TaskID:
                    $ref: '#/components/schemas/TaskID'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Resource limits reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /webhooks/{WebhookID}:
    parameters:
      - name: WebhookID
        in: path
        required: true
        schema:
          type: string
        description: The webhook ID
    get:
      summary: Get a webhook
      description: Retrieves details of a specific webhook.
      operationId: GetWebhook
      tags:
        - Webhooks
      responses:
        '200':
          description: Webhook details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      summary: Update a webhook
      description: Updates the configuration of an existing webhook.
      operationId: UpdateWebhook
      tags:
        - Webhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookUpdateRequest'
      responses:
        '200':
          description: Webhook updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      summary: Delete a webhook
      description: Deletes a webhook endpoint.
      operationId: DeleteWebhook
      tags:
        - Webhooks
      responses:
        '204':
          description: Webhook deleted successfully
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                error:
                  $ref: '#/components/examples/UnauthorizedError'
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  realtime:
    get:
      tags:
        - WebSockets
      summary: WebSockets
      description: >
        WebSocket connections to receive real-time events.

        This is a WebSocket-only endpoint that supports both JWT and API Key
        authentication.


        ## Available Channels


        The infrastructure API supports real-time events through the following
        channels:


        ### 1. Build Status (`build-status/{userId}`)

        Notifies about build lifecycle state changes:

        - `Accepted` - Build request has been accepted

        - `Initializing` - Build environment is being set up

        - `In Progress` - Build is actively running

        - `Rescheduled` - Build has been rescheduled

        - `Completed` - Build finished successfully

        - `Cancelled` - Build was cancelled by user

        - `Stopped` - Build was stopped by system


        **Payload includes:** `buildId`, `status`, `message`, and `timestamp`.


        ### 2. Task Status (`task-status/{userId}`)

        Notifies about task lifecycle state changes:

        - `Accepted` - Task request has been accepted

        - `Initializing` - Task environment is being set up

        - `In Progress` - Task is actively running

        - `Rescheduled` - Task has been rescheduled

        - `Completed` - Task finished successfully

        - `Cancelled` - Task was cancelled by user

        - `Stopped` - Task was stopped by system


        **Payload includes:** `taskId`, `status`, `message`, and `timestamp`.


        ### 3. Build Stats (`build-stats/{userId}`)

        Provides build stats updates:

        - `TotalBuildSize` - Size of the build in bytes

        - `TotalBuildTime` - Total build time in seconds


        **Payload includes:** `buildId`, `TotalBuildSize`, and `TotalBuildTime`.


        ### 4. Task Stats (`task-stats/{userId}`)

        Provides task stats updates:

        - `TotalDynamicInstructions` - Number of dynamic instructions executed

        - `TotalExecutionTime` - Total execution time in milliseconds


        **Payload includes:** `taskId`, `TotalDynamicInstructions`, and
        `TotalExecutionTime`.


        ### 5. Build Count (`build-count/{userId}`)

        Updates about build count changes:

        - `IncrementBuildCount` - Number of builds added

        - `DecrementBuildCount` - Number of builds removed


        **Payload includes:** `userId`, `IncrementBuildCount`, and
        `DecrementBuildCount`.


        ### 6. Task Count (`task-count/{userId}`)

        Updates about task count changes:

        - `IncrementTaskCount` - Number of tasks added

        - `DecrementTaskCount` - Number of tasks removed


        **Payload includes:** `userId`, `IncrementTaskCount`, and
        `DecrementTaskCount`.


        ## Channel ID Helper

        Use the following helper function to extract the correct portion of IDs:

        ```javascript

        function idToChannel(signaloidUserId) {
            return id.split("_")[1];
        }

        ```


        ## Connection Protocol

        1. Connect with authorization header

        2. Send connection_init message

        3. Receive connection_ack

        4. Subscribe to channels


        ## Authentication

        The WebSocket endpoint must be configured with a valid API key or JWT
        token.

        All messages are signed for verification.


        ## Message Structure

        All WebSocket messages follow this consistent structure:

        ```json

        {
          "type": "connection_init|connection_ack|subscribe|subscribe_success|data|error|ka",
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "channel": "builds/bld_123/status",
          "payload": {
            // Channel-specific data varies by event type
          }
        }

        ```

        ## Quick Start (Node.js)


        ```js

        const WebSocket = require("ws");

        const { v4: uuidv4 } = require("uuid");


        const HTTP_DOMAIN = "realtime.signaloid.io";

        const REALTIME_ENDPOINT = "wss://realtime.signaloid.io/event/realtime";

        const SIGNALOID_API_KEY = "scce_xxx";

        const USER_ID = "usr_xxx";


        function getBase64URLEncoded(obj) {
          return Buffer.from(JSON.stringify(obj)).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
        }


        function getAuthProtocol() {
          const header = getBase64URLEncoded({ host: HTTP_DOMAIN, authorization: SIGNALOID_API_KEY });
          return [`header-${header}`, "aws-appsync-event-ws"];
        }


        function idToChannel(id) { return id.split("_")[1]; }


        let ws = null; 

        let ready = false;


        function subscribe(channel) {
          if (!ws || !ready) return;
          ws.send(JSON.stringify({
            id: uuidv4(),
            type: "subscribe",
            channel,
            authorization: { host: HTTP_DOMAIN, authorization: SIGNALOID_API_KEY }
          }));
          console.log("Subscribed:", channel);
        }


        async function connect() {
          return new Promise((resolve, reject) => {
            ws = new WebSocket(REALTIME_ENDPOINT, getAuthProtocol());
            ws.on("open", () => ws.send(JSON.stringify({ type: "connection_init" })));
            ws.on("message", (buf) => {
              const msg = JSON.parse(buf.toString());
              if (msg.type === "connection_ack") {
                ready = true;
                const uid = idToChannel(USER_ID);
                subscribe(`build-status/${uid}`);
                subscribe(`task-status/${uid}`);
                subscribe(`build-stats/${uid}`);
                subscribe(`task-stats/${uid}`);
                subscribe(`build-count/${uid}`);
                subscribe(`task-count/${uid}`);
                resolve();
              }
              if (msg.type === "data") console.log("Event:", msg.payload || msg.event || msg);
            });
            ws.on("error", reject);
          });
        }


        (async () => { await connect(); })();

        ```
      security:
        - JWTAuth: []
        - APIKeyAuth: []
      parameters:
        - in: header
          name: Authorization
          required: true
          schema:
            type: string
          description: |
            Base64 URL encoded authorization header. Format:
            {
              "host": "realtime.signaloid.io",
              "authorization": "Bearer <jwt_token>" or "scce_<api_key>"
            }
        - in: header
          name: Sec-WebSocket-Protocol
          required: true
          schema:
            type: string
          description: |
            WebSocket protocol header. Must include:
            - header-{base64_encoded_auth}
            - aws-appsync-event-ws
      responses:
        '101':
          description: WebSocket connection established
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSocketMessage'
              examples:
                connection_init:
                  value:
                    type: connection_init
                connection_ack:
                  value:
                    type: connection_ack
                subscribe:
                  value:
                    type: subscribe
                    id: 123e4567-e89b-12d3-a456-426614174000
                    channel: builds/bld_123/status
                subscribe_success:
                  value:
                    type: subscribe_success
                    id: 123e4567-e89b-12d3-a456-426614174000
                build_status:
                  value:
                    type: data
                    payload:
                      $ref: '#/components/schemas/BuildStatusEvent'
                task_status:
                  value:
                    type: data
                    payload:
                      $ref: '#/components/schemas/TaskStatusEvent'
                user_metadata:
                  value:
                    type: data
                    payload:
                      $ref: '#/components/schemas/UserMetadataEvent'
                error:
                  value:
                    type: error
                    errors:
                      - message: Authentication failed
                keep_alive:
                  value:
                    type: ka
  public.realtime:
    get:
      tags:
        - WebSockets
      summary: WebSockets Public
      description: >
        WebSocket connections to receive real-time events.


        ## Available Channels


        The infrastructure API supports real-time events through the following
        channels:


        ### Task Status (`task-status/{taskId}`)

        Notifies about task lifecycle state changes:

        - `Accepted` - Task request has been accepted

        - `Initializing` - Task environment is being set up

        - `In Progress` - Task is actively running

        - `Rescheduled` - Task has been rescheduled

        - `Completed` - Task finished successfully

        - `Cancelled` - Task was cancelled by user

        - `Stopped` - Task was stopped by system


        **Payload includes:** `taskId`, `status`, `message`, and `timestamp`.


        ## Channel ID Helper

        Use the following helper function to extract the correct portion of IDs:

        ```javascript

        function idToChannel(signaloidUserId) {
            return id.split("_")[1];
        }

        ```


        ## Connection Protocol

        1. Connect with authorization header

        2. Send connection_init message

        3. Receive connection_ack

        4. Subscribe to channels


        ## Message Structure

        All WebSocket messages follow this consistent structure:

        ```json

        {
          "type": "connection_init|connection_ack|subscribe|subscribe_success|data|error|ka",
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "channel": "builds/bld_123/status",
          "payload": {
            // Channel-specific data varies by event type
          }
        }

        ```

        ## Quick Start (Node.js)


        ```js

        const WebSocket = require("ws");

        const { v4: uuidv4 } = require("uuid");


        const HTTP_DOMAIN = "public.realtime.signaloid.io";

        const REALTIME_ENDPOINT =
        "wss://public.realtime.signaloid.io/event/realtime";

        const TASK_ID = "tsk_xxx";

        const SIGNALOID_API_KEY = "scce_xxx";


        function getBase64URLEncoded(obj) {
          return Buffer.from(JSON.stringify(obj)).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
        }


        function getAuthProtocol() {
          const header = getBase64URLEncoded({ host: HTTP_DOMAIN, authorization: "public" });
          return [`header-${header}`, "aws-appsync-event-ws"];
        }


        function idToChannel(id) { return id.split("_")[1]; }


        let ws = null; 

        let ready = false;


        function subscribe(channel) {
          if (!ws || !ready) return;
          ws.send(JSON.stringify({
            id: uuidv4(),
            type: "subscribe",
            channel,
            authorization: { host: HTTP_DOMAIN, authorization: "public" }
          }));
          console.log("Subscribed:", channel);
        }


        async function connect() {
          return new Promise((resolve, reject) => {
            ws = new WebSocket(REALTIME_ENDPOINT, getAuthProtocol());
            ws.on("open", () => ws.send(JSON.stringify({ type: "connection_init" })));
            ws.on("message", (buf) => {
              const msg = JSON.parse(buf.toString());
              if (msg.type === "connection_ack") {
                ready = true;
                const taskId = idToChannel(TASK_ID);
                subscribe(`task-status/${taskId}`);
                resolve();
              }
              if (msg.type === "data") console.log("Event:", msg.payload || msg.event || msg);
            });
            ws.on("error", reject);
          });
        }


        (async () => { await connect(); })();

        ```
      parameters:
        - in: header
          name: Authorization
          required: true
          schema:
            type: string
          description: |
            Base64 URL encoded authorization header. Format:
            {
              "host": "public.realtime.signaloid.io",
              "authorization": "public"
            }
        - in: header
          name: Sec-WebSocket-Protocol
          required: true
          schema:
            type: string
          description: |
            WebSocket protocol header. Must include:
            - header-{base64_encoded_auth}
            - aws-appsync-event-ws
      responses:
        '101':
          description: WebSocket connection established
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSocketMessage'
              examples:
                connection_init:
                  value:
                    type: connection_init
                connection_ack:
                  value:
                    type: connection_ack
                subscribe:
                  value:
                    type: subscribe
                    id: 123e4567-e89b-12d3-a456-426614174000
                    channel: builds/bld_123/status
                subscribe_success:
                  value:
                    type: subscribe_success
                    id: 123e4567-e89b-12d3-a456-426614174000
                task_status:
                  value:
                    type: data
                    payload:
                      $ref: '#/components/schemas/TaskStatusEvent'
                keep_alive:
                  value:
                    type: ka
  webhooks:
    taskStatusChanged:
      post:
        summary: Task Status Changed
        description: >
          Sent when the status of a task changes. This webhook is triggered for
          all task status transitions.


          ## Event Types

          - Initializing

          - In Progress

          - Completed

          - Cancelled

          - Stopped

          - Failed


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: task-status
                  userId:
                    type: string
                    description: ID of the user who owns the task
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - taskId
                      - status
                    properties:
                      taskId:
                        type: string
                        pattern: ^tsk_[a-zA-Z0-9]{32}$
                        example: tsk_1234567890abcdef1234567890abcdef
                      status:
                        type: string
                        enum:
                          - Initializing
                          - In Progress
                          - Completed
                          - Cancelled
                          - Stopped
                          - Failed
                        example: In Progress
                      message:
                        type: string
                        description: Optional status message
                        example: Task started successfully
                      updatedAt:
                        type: string
                        format: date-time
                        example: '2024-03-20T10:00:00Z'
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
    buildStatusChanged:
      post:
        summary: Build Status Changed
        description: >
          Sent when the status of a build task changes. This webhook is
          triggered for all build status transitions.


          ## Event Types

          - Initializing

          - In Progress

          - Completed

          - Cancelled

          - Stopped

          - Failed


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: build-status
                  userId:
                    type: string
                    description: ID of the user who owns the build
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - buildId
                      - status
                    properties:
                      buildId:
                        type: string
                        pattern: ^bld_[a-zA-Z0-9]{32}$
                        example: bld_1234567890abcdef1234567890abcdef
                      status:
                        type: string
                        enum:
                          - Initializing
                          - In Progress
                          - Completed
                          - Cancelled
                          - Stopped
                          - Failed
                        example: In Progress
                      message:
                        type: string
                        description: Optional status message
                        example: Build started successfully
                      updatedAt:
                        type: string
                        format: date-time
                        example: '2024-03-20T10:00:00Z'
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
    taskCountChanged:
      post:
        summary: Task Count Changed
        description: >
          Sent when a user's task count changes. This webhook is triggered when
          tasks are created or completed.


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: task-count
                  userId:
                    type: string
                    description: ID of the user whose task count changed
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - UserID
                      - Object
                      - ResourceUsage
                    properties:
                      UserID:
                        type: string
                        pattern: ^usr_[a-zA-Z0-9]{32}$
                        example: usr_1234567890abcdef1234567890abcdef
                      Object:
                        type: string
                        example: User
                      ResourceUsage:
                        type: object
                        required:
                          - IncrementTaskCount
                          - DecrementTaskCount
                        properties:
                          IncrementTaskCount:
                            type: integer
                            description: Number of tasks added
                            example: 1
                          DecrementTaskCount:
                            type: integer
                            description: Number of tasks completed/cancelled
                            example: 0
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
    buildCountChanged:
      post:
        summary: Build Count Changed
        description: >
          Sent when a user's build task count changes. This webhook is triggered
          when build tasks are created or completed.


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: build-count
                  userId:
                    type: string
                    description: ID of the user whose build count changed
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - UserID
                      - Object
                      - ResourceUsage
                    properties:
                      UserID:
                        type: string
                        pattern: ^usr_[a-zA-Z0-9]{32}$
                        example: usr_1234567890abcdef1234567890abcdef
                      Object:
                        type: string
                        example: User
                      ResourceUsage:
                        type: object
                        required:
                          - IncrementBuildCount
                          - DecrementBuildCount
                        properties:
                          IncrementBuildCount:
                            type: integer
                            description: Number of builds added
                            example: 1
                          DecrementBuildCount:
                            type: integer
                            description: Number of builds completed/cancelled
                            example: 0
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
    taskStatsChanged:
      post:
        summary: Task Stats Changed
        description: >
          Sent when a user's task stats are updated. This webhook is triggered
          when task execution metrics change.


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: task-stats
                  userId:
                    type: string
                    description: ID of the user whose task stats changed
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - UserID
                      - Object
                      - ResourceUsage
                    properties:
                      UserID:
                        type: string
                        pattern: ^usr_[a-zA-Z0-9]{32}$
                        example: usr_1234567890abcdef1234567890abcdef
                      Object:
                        type: string
                        example: User
                      ResourceUsage:
                        type: object
                        required:
                          - TotalDynamicInstructions
                          - TotalExecutionTime
                        properties:
                          TotalDynamicInstructions:
                            type: integer
                            description: Total number of dynamic instructions executed
                            example: 1000000
                          TotalExecutionTime:
                            type: integer
                            description: Total execution time in milliseconds
                            example: 5000
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
    buildStatsChanged:
      post:
        summary: Build Stats Changed
        description: >
          Sent when a user's build task stats are updated. This webhook is
          triggered when build metrics like size and time change.


          ## Authentication

          The webhook endpoint must be configured with a valid API key or JWT
          token.
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                required:
                  - version
                  - eventType
                  - userId
                  - timestamp
                  - data
                properties:
                  version:
                    type: string
                    description: Webhook payload version
                    example: '1.0'
                  eventType:
                    type: string
                    description: Type of the event
                    example: build-stats
                  userId:
                    type: string
                    description: ID of the user whose build stats changed
                    pattern: ^usr_[a-zA-Z0-9]{32}$
                    example: usr_1234567890abcdef1234567890abcdef
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the event occurred
                    example: '2024-03-20T10:00:00Z'
                  data:
                    type: object
                    required:
                      - UserID
                      - Object
                      - ResourceUsage
                    properties:
                      UserID:
                        type: string
                        pattern: ^usr_[a-zA-Z0-9]{32}$
                        example: usr_1234567890abcdef1234567890abcdef
                      Object:
                        type: string
                        example: User
                      ResourceUsage:
                        type: object
                        required:
                          - TotalBuildSize
                          - TotalBuildTime
                        properties:
                          TotalBuildSize:
                            type: integer
                            description: Total size of builds in bytes
                            example: 1048576
                          TotalBuildTime:
                            type: integer
                            description: Total build time in milliseconds
                            example: 5000
        responses:
          '200':
            description: Webhook processed successfully
          '401':
            description: Unauthorized - Invalid authentication
          '403':
            description: Forbidden - Invalid API key or token
          '429':
            description: Too Many Requests - Rate limit exceeded
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKey:
      type: apiKey
      name: Authorization
      in: header
  parameters:
    UserID:
      name: UserID
      description: The identifier of the User resource.
      in: path
      schema:
        $ref: '#/components/schemas/UserID'
      required: true
    bucketID:
      name: bucketID
      description: The identifier of the Bucket resource.
      in: path
      schema:
        $ref: '#/components/schemas/bucketID'
      required: true
    CoreID:
      name: CoreID
      description: The identifier of the Core resource.
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/CoreID'
    RepositoryID:
      name: RepositoryID
      description: The identifier of the connected Repository resource.
      in: path
      schema:
        $ref: '#/components/schemas/RepositoryID'
      required: true
    PipelineID:
      name: PipelineID
      description: The identifier of the Pipeline resource.
      in: path
      schema:
        $ref: '#/components/schemas/PipelineID'
      required: true
    BuildID:
      name: BuildID
      description: The identifier of the Build resource.
      in: path
      schema:
        $ref: '#/components/schemas/BuildID'
      required: true
    TaskID:
      name: TaskID
      description: The identifier of the Task resource.
      in: path
      schema:
        $ref: '#/components/schemas/TaskID'
      required: true
    ValueID:
      name: ValueID
      description: The identifier of the Value resource.
      in: path
      schema:
        $ref: '#/components/schemas/valueID'
      required: true
    driveID:
      name: driveID
      description: The identifier of the Drive resource.
      in: path
      schema:
        $ref: '#/components/schemas/driveID'
      required: true
    thingID:
      name: thingID
      description: The identifier of the Thing resource.
      in: path
      schema:
        $ref: '#/components/schemas/thingID'
      required: true
    path:
      name: path
      description: path (file/directory)
      in: path
      schema:
        type: string
      required: true
    taskID:
      name: taskID
      description: task ID
      in: query
      schema:
        $ref: '#/components/schemas/taskID'
      required: true
    valueID:
      name: valueID
      description: value ID
      in: query
      schema:
        $ref: '#/components/schemas/valueID'
      required: true
    KeyID:
      name: KeyID
      description: The identifier of the API Key resource.
      in: path
      schema:
        type: string
        pattern: ^[a-f0-9]{32}$
      required: true
  schemas:
    bucketGetReply:
      type: object
      properties:
        bucket_count:
          type: integer
          minimum: 0
        bucket_ids:
          type: array
          items:
            $ref: '#/components/schemas/bucketID'
        user_id:
          $ref: '#/components/schemas/UserID'
      required:
        - bucket_count
        - bucket_ids
        - user_id
    bucketPostRequest:
      type: object
      properties:
        Name:
          type: string
        Account:
          type: string
        MountPath:
          type: string
        Read:
          type: boolean
        Write:
          type: boolean
      required:
        - Name
        - Account
    bucketPostReply:
      type: object
      properties:
        Object:
          allOf:
            - $ref: '#/components/schemas/objectType'
            - type: string
              enum:
                - Bucket
        BucketID:
          $ref: '#/components/schemas/bucketID'
        Owner:
          $ref: '#/components/schemas/UserID'
        CreatedAt:
          type: integer
          minimum: 0
        UpdatedAt:
          type: integer
          minimum: 0
        Name:
          type: string
        Account:
          type: string
        MountPath:
          type: string
        Read:
          type: boolean
        Write:
          type: boolean
      required:
        - Object
        - BucketID
        - Owner
        - CreatedAt
        - UpdatedAt
        - Name
        - Account
        - MountPath
        - Read
        - Write
    driveGetReply:
      type: object
      properties:
        drive_count:
          type: integer
          minimum: 0
        drive_ids:
          type: array
          items:
            $ref: '#/components/schemas/driveID'
        user_id:
          $ref: '#/components/schemas/UserID'
      required:
        - drive_count
        - drive_ids
        - user_id
    thingsGetReply:
      type: object
      properties:
        thing_count:
          type: integer
          minimum: 0
        thing_ids:
          type: array
          items:
            $ref: '#/components/schemas/thingID'
        user_id:
          $ref: '#/components/schemas/UserID'
      required:
        - thing_count
        - thing_ids
        - user_id
    thingProfile:
      type: object
      properties:
        CreatedAt:
          type: integer
          minimum: 0
        Name:
          type: string
        Object:
          allOf:
            - $ref: '#/components/schemas/objectType'
            - type: string
              enum:
                - Thing
        Owner:
          $ref: '#/components/schemas/UserID'
        ThingID:
          $ref: '#/components/schemas/thingID'
        ThingStatus:
          type: object
          properties:
            local_ipv4_address:
              type: string
              format: ipv4
            updated_at:
              type: integer
              minimum: 0
        Topics:
          type: array
          items:
            type: string
        UpdatedAt:
          type: integer
          minimum: 0
      required:
        - CreatedAt
        - Name
        - Object
        - Owner
        - ThingID
        - ThingStatus
        - Topics
        - UpdatedAt
    thingFileList:
      type: object
      properties:
        items:
          type: array
          items:
            type: string
        thing_id:
          $ref: '#/components/schemas/thingID'
        user_id:
          $ref: '#/components/schemas/UserID'
      required:
        - items
        - thing_id
        - user_id
    userProfile:
      type: object
      properties:
        CreatedAt:
          type: integer
        Object:
          allOf:
            - $ref: '#/components/schemas/objectType'
            - type: string
              enum:
                - User
        Preferences:
          type: object
          properties:
            Editor_Execution_Arguments:
              type: string
            Editor_Execution_Core:
              type: string
            Editor_Execution_DataSources:
              type: string
            Editor_Layout:
              type: string
            Editor_SourceCode:
              type: string
            Editor_Theme:
              type: string
            Execution_DefaultDataSources:
              type: string
            Execution_DefaultCore:
              type: string
            Execution_DefaultReferenceCore:
              type: boolean
            PlatformTheme:
              type: string
            UpdatedAt:
              type: integer
        ResourceUsage:
          type: object
          properties:
            APIAccessCount:
              type: integer
              minimum: 0
            BucketCount:
              type: integer
              minimum: 0
            CloudStorageBytes:
              type: integer
              minimum: 0
            DataDriveCount:
              type: integer
              minimum: 0
            DynamicInstructionCount:
              type: integer
              minimum: 0
            GatewayCount:
              type: integer
              minimum: 0
            ConcurrentTaskCount:
              type: integer
              minimum: 0
            CoreCount:
              type: integer
              minimum: 0
            DataSourceCount:
              type: integer
              minimum: 0
            KeyCount:
              type: integer
              minimum: 0
            PlotCount:
              type: integer
              minimum: 0
            RepositoryCount:
              type: integer
              minimum: 0
            TaskCount:
              type: integer
              minimum: 0
            ResetsAt:
              type: integer
            UpdatedAt:
              type: integer
          required:
            - APIAccessCount
            - BucketCount
            - CloudStorageBytes
            - ConcurrentTaskCount
            - CoreCount
            - DataDriveCount
            - DataSourceCount
            - DynamicInstructionCount
            - GatewayCount
            - KeyCount
            - PlotCount
            - RepositoryCount
            - ResetsAt
            - TaskCount
            - UpdatedAt
        UserID:
          $ref: '#/components/schemas/UserID'
        Username:
          type: string
          format: email
      required:
        - CreatedAt
        - Object
        - Preferences
        - ResourceUsage
        - UserID
        - Username
    drivePostRequest:
      type: object
      properties:
        DataSources:
          $ref: '#/components/schemas/DataSources'
        Name:
          type: string
      required:
        - DataSources
        - Name
    drivePostReply:
      type: object
      properties:
        CreatedAt:
          type: integer
          minimum: 0
        DataSources:
          $ref: '#/components/schemas/DataSources'
        DriveID:
          $ref: '#/components/schemas/driveID'
        Name:
          type: string
        Object:
          allOf:
            - $ref: '#/components/schemas/objectType'
            - type: string
              enum:
                - Drive
        Owner:
          $ref: '#/components/schemas/UserID'
        UpdatedAt:
          type: integer
          minimum: 0
      required:
        - CreatedAt
        - DataSources
        - DriveID
        - Name
        - Object
        - Owner
        - UpdatedAt
    driveIdGetReply:
      type: object
      properties:
        CreatedAt:
          type: integer
          minimum: 0
        DataSources:
          $ref: '#/components/schemas/DataSources'
        DriveID:
          $ref: '#/components/schemas/driveID'
        Name:
          type: string
        Object:
          allOf:
            - $ref: '#/components/schemas/objectType'
            - type: string
              enum:
                - Drive
        Owner:
          $ref: '#/components/schemas/UserID'
        UpdatedAt:
          type: integer
          minimum: 0
      required:
        - CreatedAt
        - DataSources
        - DriveID
        - Name
        - Object
        - Owner
        - UpdatedAt
    plotPostReply:
      type: object
      properties:
        plotID:
          type: string
          format: uuid
        presignedURL:
          type: string
          format: uri
      required:
        - plotID
        - presignedURL
    generateSamplesGetReply:
      type: object
      properties:
        Count:
          type: integer
          minimum: 0
          maximum: 10000
        Samples:
          type: array
          items:
            type: integer
      required:
        - plotID
        - presignedURL
    fileDescription:
      type: object
      properties:
        etag:
          type: string
        last_modified:
          type: integer
          minimum: 0
        path:
          type: string
        size:
          type: integer
          minimum: 0
      required:
        - etag
        - last_modified
        - path
        - size
    fileList:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
        items:
          type: array
          items:
            $ref: '#/components/schemas/fileDescription'
      required:
        - count
        - items
    fileDownload:
      type: object
      properties:
        content_type:
          type: string
        download_url:
          type: string
          format: uri
        etag:
          type: string
        last_modified:
          type: integer
          minimum: 0
        size:
          type: integer
          minimum: 0
      required:
        - content_type
        - download_url
        - etag
        - last_modified
        - size
    healthStatus:
      type: object
      description: Health status for all services
      properties:
        timestamp:
          type: string
          format: date-time
          description: Current timestamp of the health check
        services:
          type: array
          items:
            $ref: '#/components/schemas/serviceHealth'
          description: Array of health status for each service
      required:
        - timestamp
        - services
    serviceHealth:
      type: object
      description: Health status for a single service
      properties:
        service:
          type: string
          enum:
            - scdp
            - scce-api
            - scce-compute
            - scce-build
          description: The service identifier
        status:
          type: string
          enum:
            - healthy
            - unhealthy
            - degraded
          description: The health status of the service
        timestamp:
          type: string
          format: date-time
          description: Timestamp of the last health check
        details:
          type: object
          properties:
            responseTime:
              type: integer
              description: Response time in milliseconds
            endpoints:
              type: object
              additionalProperties:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status code of the endpoint
                  responseTime:
                    type: integer
                    description: Response time in milliseconds
                required:
                  - status
                  - responseTime
              description: Status of individual endpoints (for SCCE API)
            buildStatus:
              type: object
              properties:
                id:
                  type: string
                  pattern: ^bld_[a-zA-Z0-9]{32}$
                  description: Build ID
                status:
                  type: string
                  description: Build status
                duration:
                  type: integer
                  description: Build duration in milliseconds
              required:
                - id
                - status
                - duration
              description: Status of the latest build (for SCCE Build)
            repoBuildStatus:
              type: object
              properties:
                id:
                  type: string
                  pattern: ^bld_[a-zA-Z0-9]{32}$
                  description: Repository build ID
                status:
                  type: string
                  description: Repository build status
                duration:
                  type: integer
                  description: Repository build duration in milliseconds
              required:
                - id
                - status
                - duration
              description: Status of the latest repository build (for SCCE Build)
            taskStatus:
              type: object
              properties:
                id:
                  type: string
                  pattern: ^tsk_[a-zA-Z0-9]{32}$
                  description: Task ID
                status:
                  type: string
                  description: Task status
                duration:
                  type: integer
                  description: Task duration in milliseconds
              required:
                - id
                - status
                - duration
              description: Status of the latest task (for SCCE Compute)
            error:
              type: string
              description: Error message if the health check failed
      required:
        - service
        - status
        - timestamp
        - details
    keysGetReply:
      type: object
      properties:
        UserID:
          $ref: '#/components/schemas/UserID'
        Keys:
          type: array
          items:
            type: object
            properties:
              Object:
                type: string
                enum:
                  - Key
              KeyID:
                type: string
                pattern: ^[a-f0-9]{32}$
              Name:
                type: string
              Owner:
                $ref: '#/components/schemas/UserID'
              CreatedAt:
                type: integer
                minimum: 0
              ValidUntil:
                type: integer
                minimum: 0
                nullable: true
            required:
              - Object
              - KeyID
              - Name
              - Owner
              - CreatedAt
              - ValidUntil
        Count:
          type: integer
          minimum: 0
      required:
        - UserID
        - Keys
        - Count
    keysPostRequest:
      type: object
      properties:
        Name:
          type: string
          minLength: 1
        ValidUntil:
          type: integer
          minimum: 0
          nullable: true
      required:
        - Name
    keysPostReply:
      type: object
      properties:
        Object:
          type: string
          enum:
            - Key
        Key:
          type: string
          description: The full API key. Only returned once upon creation.
        KeyID:
          type: string
          pattern: ^[a-f0-9]{32}$
        Name:
          type: string
        Owner:
          $ref: '#/components/schemas/UserID'
        ValidUntil:
          type: integer
          minimum: 0
          nullable: true
        CreatedAt:
          type: integer
          minimum: 0
      required:
        - Object
        - Key
        - KeyID
        - Name
        - Owner
        - ValidUntil
        - CreatedAt
    keysDeleteReply:
      type: object
      properties:
        message:
          type: string
      required:
        - message
    WebhookCreateRequest:
      type: object
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          example: https://webhook.site/1406bd34-bd36-4e83-8341-90d0bcec5b13
          description: The URL where webhook events will be sent
        events:
          type: array
          items:
            type: string
            enum:
              - task-status
              - build-status
              - task-stats
              - build-stats
              - task-count
              - build-count
          example:
            - task-status
            - build-status
          description: List of events to subscribe to
        description:
          type: string
          example: Test webhook
          description: Optional description of the webhook
    WebhookUpdateRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
          example: https://webhook.site/1406bd34-bd36-4e83-8341-90d0bcec5b13
        events:
          type: array
          items:
            type: string
            enum:
              - task-status
              - build-status
              - task-stats
              - build-stats
              - task-count
              - build-count
          example:
            - task-status
            - build-status
        description:
          type: string
          example: Updated test webhook
        status:
          type: string
          enum:
            - active
            - disabled
          example: disabled
    Webhook:
      type: object
      properties:
        WebhookID:
          type: string
          example: wh-1234567890abcdef1234567890abcdef
        URL:
          type: string
          format: uri
          example: https://webhook.site/1406bd34-bd36-4e83-8341-90d0bcec5b13
        Events:
          type: array
          items:
            type: string
            enum:
              - task-status
              - build-status
              - task-stats
              - build-stats
              - task-count
              - build-count
          example:
            - task-status
            - build-status
        Description:
          type: string
          example: Test webhook
        Status:
          type: string
          enum:
            - active
            - disabled
          example: active
        Secret:
          type: string
          example: whsec_1234567890abcdef1234567890abcdef
          description: Secret key for webhook signature verification
        CreatedAt:
          type: string
          format: date-time
          example: '2025-05-19T16:37:44.962Z'
        UpdatedAt:
          type: string
          format: date-time
          example: '2025-05-19T16:37:44.962Z'
        FailureCount:
          type: integer
          minimum: 0
          example: 0
        LastDeliveryStatus:
          type: string
          nullable: true
          example: null
          enum:
            - success
            - failed-429
            - null
        LastDeliveryTime:
          type: string
          format: date-time
          nullable: true
          example: null
        Object:
          type: string
          example: webhook
    WebhookList:
      type: object
      properties:
        webhooks:
          type: array
          items:
            $ref: '#/components/schemas/Webhook'
        count:
          type: integer
          example: 4
    WebSocketMessage:
      type: object
      description: Base WebSocket message structure
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - connection_init
            - connection_ack
            - subscribe
            - subscribe_success
            - data
            - error
            - ka
          description: Message type identifier
        id:
          type: string
          description: Unique message ID (for subscribe messages)
          example: 123e4567-e89b-12d3-a456-426614174000
        channel:
          type: string
          description: Channel name for subscription
          example: builds/bld_123/status
        payload:
          type: object
          description: Message payload (for data messages)
        errors:
          type: array
          description: Error details (for error messages)
          items:
            type: object
    BuildStatusEvent:
      type: object
      description: Build status update event
      properties:
        status:
          type: string
          enum:
            - Initializing
            - In Progress
            - Completed
            - Cancelled
            - Stopped
          example: In Progress
        buildId:
          type: string
          pattern: ^bld_[a-zA-Z0-9]{32}$
          example: bld_1234567890abcdef1234567890abcdef
        data:
          type: object
          description: Additional build status data
          properties:
            message:
              type: string
              example: Build started successfully
            timestamp:
              type: string
              format: date-time
              example: '2024-03-20T10:00:00Z'
    TaskStatusEvent:
      type: object
      description: Task status update event
      properties:
        status:
          type: string
          enum:
            - Initializing
            - In Progress
            - Completed
            - Cancelled
            - Stopped
          example: In Progress
        taskId:
          type: string
          pattern: ^tsk_[a-zA-Z0-9]{32}$
          example: tsk_1234567890abcdef1234567890abcdef
        data:
          type: object
          description: Additional task status data
          properties:
            message:
              type: string
              example: Task started successfully
            timestamp:
              type: string
              format: date-time
              example: '2024-03-20T10:00:00Z'
    UserMetadataEvent:
      type: object
      description: User metadata update event
      properties:
        channel:
          type: string
          pattern: ^user-metadata/usr_[a-zA-Z0-9]{32}$
          example: user-metadata/usr_1234567890abcdef1234567890abcdef
        data:
          type: object
          description: User metadata update data
          properties:
            ResourceUsage:
              type: object
              properties:
                TotalDynamicInstructions:
                  type: integer
                  example: 123456789
                TotalExecutionTime:
                  type: integer
                  example: 98765
            timestamp:
              type: string
              format: date-time
              example: '2024-03-20T10:00:00Z'
    errorResponse:
      type: object
      description: Error response
      properties:
        error:
          type: string
          description: Error message
      required:
        - error
    UserID:
      type: string
      pattern: usr_[a-z0-9]{32}
    CoreID:
      type: string
      pattern: cor_[a-z0-9]{32}
    Microarchitecture:
      type: string
      enum:
        - Athens
        - Bypass
        - Reference
    CorrelationTracking:
      type: string
      description: The value is case-insensitive.
      enum:
        - Autocorrelation
        - Disable
    Core:
      type: object
      required:
        - Object
        - CoreID
        - Owner
        - Name
        - Class
        - Precision
        - Microarchitecture
        - MemorySize
        - CorrelationTracking
        - CreatedAt
        - UpdatedAt
      properties:
        Object:
          type: string
          enum:
            - Core
        CoreID:
          $ref: '#/components/schemas/CoreID'
        Owner:
          $ref: '#/components/schemas/UserID'
        Name:
          type: string
          minLength: 1
        Class:
          type: string
          enum:
            - C0
            - C0Pro
        Precision:
          type: integer
          minimum: 4
          maximum: 1000000
          description: >
            The precision of the core. The

            minimum value is 4. The maximum value is

            8000 for the Athens Microarchitecture, and 1000000 (1M) for the
            Reference Microarchitecture.
        Microarchitecture:
          $ref: '#/components/schemas/Microarchitecture'
        MemorySize:
          type: integer
        CorrelationTracking:
          $ref: '#/components/schemas/CorrelationTracking'
        CreatedAt:
          type: integer
          format: timestamp
        UpdatedAt:
          type: integer
          format: timestamp
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: A short, machine-readable error type
          enum:
            - Bad Request
            - Unauthorized
            - Forbidden
            - Not Found
            - Conflict
            - Internal Server Error
        message:
          type: string
          description: >-
            A human-readable message explaining the error and potential
            solutions
    CorePost:
      type: object
      required:
        - Name
        - Class
        - Precision
        - MemorySize
        - Microarchitecture
        - CorrelationTracking
      properties:
        Name:
          type: string
          minLength: 1
        Class:
          type: string
          enum:
            - C0
            - C0Pro
        Precision:
          type: integer
          minimum: 4
          maximum: 1000000
          description: >
            The precision of the core. The

            minimum value is 4. The maximum value is

            8000 for the Athens Microarchitecture, and 1000000 (1M) for the
            Reference Microarchitecture.
        MemorySize:
          type: integer
          minimum: 256000
          maximum: 4000000000
        Microarchitecture:
          $ref: '#/components/schemas/Microarchitecture'
        CorrelationTracking:
          $ref: '#/components/schemas/CorrelationTracking'
    CorePatch:
      type: object
      required:
        - Name
        - Class
        - Precision
        - MemorySize
        - Microarchitecture
        - CorrelationTracking
      properties:
        Name:
          type: string
          minLength: 1
        Class:
          type: string
          enum:
            - C0
            - C0Pro
        Precision:
          type: integer
          minimum: 4
          maximum: 1000000
          description: >
            The precision of the core. The

            minimum value is 4. The maximum value is

            8000 for the Athens Microarchitecture, and 1000000 (1M) for the
            Reference Microarchitecture.
        MemorySize:
          type: integer
          minimum: 256000
          maximum: 4000000000
        Microarchitecture:
          $ref: '#/components/schemas/Microarchitecture'
        CorrelationTracking:
          $ref: '#/components/schemas/CorrelationTracking'
    resourceType:
      type: string
      enum:
        - Gateway
        - Bucket
        - Drive
        - SignaloidCloudStorage
    DataSources:
      type: array
      items:
        type: object
        minItems: 0
        maxItems: 5
        properties:
          Location:
            type: string
          ResourceID:
            type: string
          ResourceType:
            $ref: '#/components/schemas/resourceType'
        required:
          - Location
          - ResourceID
          - ResourceType
    TraceVariableRequest:
      type: object
      required:
        - File
        - LineNumber
        - Expression
      properties:
        File:
          type: string
        LineNumber:
          type: integer
          minimum: 0
        Expression:
          description: |
            The expression to trace. E.g., `x[0]`. To learn more about tracing
            expressions, see the Tracing Variables section in the API Guides.
          type: string
    Repository:
      type: object
      properties:
        Object:
          type: string
          enum:
            - Repository
        RepositoryID:
          type: string
        Owner:
          type: string
        RemoteURL:
          type: string
          format: uri
        Commit:
          type: string
        Branch:
          type: string
        BuildDirectory:
          type: string
        Arguments:
          type: string
        Core:
          type: string
        DataSources:
          $ref: '#/components/schemas/DataSources'
        TraceVariables:
          type: array
          items:
            $ref: '#/components/schemas/TraceVariableRequest'
        CreatedAt:
          type: integer
        UpdatedAt:
          type: integer
      required:
        - Object
        - RepositoryID
        - Owner
        - RemoteURL
        - Commit
        - Branch
        - BuildDirectory
        - CreatedAt
    RepositoryID:
      type: string
      pattern: rep_[a-z0-9]{32}
    RepositoryPost:
      type: object
      required:
        - RemoteURL
        - Commit
        - Branch
        - BuildDirectory
      properties:
        RemoteURL:
          type: string
          format: uri
          description: |
            The URL of the git repository.
        Commit:
          type: string
          description: |
            The commit hash to check out.
        Branch:
          type: string
          description: |
            The branch name to check out.
        BuildDirectory:
          type: string
          description: |
            The directory in the repository where the Signaloid Cloud
            Engine should use as working directory when attempting to
            build the repository application. This directory is relative
            to the root of the repository.
        Arguments:
          type: string
          description: |
            Default command-line arguments that the Signaloid Cloud
            Engine should pass when executing the built repository
            application.
        Core:
          $ref: '#/components/schemas/CoreID'
          description: |
            The ID of the core to use for building.
        DataSources:
          $ref: '#/components/schemas/DataSources'
          description: |
            Default data sources to use with this repository.
        TraceVariables:
          description: |
            The default variables that the Signaloid Cloud Compute Engine should
            trace when executing the Repository application.
          type: array
          items:
            $ref: '#/components/schemas/TraceVariableRequest'
    BuildID:
      type: string
      pattern: bld_[a-z0-9]{32}
    TaskStatus:
      type: string
      enum:
        - Accepted
        - Initialising
        - Rescheduled
        - In Progress
        - Completed
        - Cancelled
        - Stopped
      description: >
        - **Accepted:** The Task is accepted and queued for execution. The Task
        is _inactive_.

        - **Initialising:** The Signaloid Cloud Compute Engine has picked up the
        Task and is initialising the infrastructure to execute it. The Task is
        _active_.

        - **Rescheduled:** The Signaloid Cloud Compute Engine scheduling the
        Task to another worker, due to an interruption on the previous worker.
        The Task is _active_.

        - **In Progress:** The Task is running. The Task is _active_.

        - **Completed:** The Task exited with a zero exit code. The Task is
        _inactive_.

        - **Cancelled:** The Task exited with a non-zero exit code and . The
        Task is _inactive_.

        - **Stopped:** The Task exited with a non-zero exit code. The Task is
        _inactive_.
    TaskID:
      type: string
      pattern: tsk_[a-z0-9]{32}
    Task:
      type: object
      properties:
        TaskID:
          type: string
        BuildID:
          type: string
        Owner:
          type: string
        Status:
          $ref: '#/components/schemas/TaskStatus'
        StatusTransitions:
          type: array
          items:
            type: object
            properties:
              Status:
                type: string
              Timestamp:
                type: integer
              Message:
                type: string
        Arguments:
          type: string
        DataSources:
          $ref: '#/components/schemas/DataSources'
        StartedAt:
          type: integer
        UpdatedAt:
          type: integer
        CreatedAt:
          type: integer
        FinishedAt:
          type: integer
        Stats:
          type: object
          properties:
            DynamicInstructions:
              type: integer
            ProcessorTime:
              type: number
            ExecutionTimeInMilliseconds:
              type: integer
      required:
        - Object
        - TaskID
        - Owner
        - Status
        - CreatedAt
    TaskOutputReturn:
      type: object
      description: >
        The returned object is a list of URLs providing direct access to the
        content streams related to the executed task.
      properties:
        Stdout:
          type: string
          description: >-
            The URL to the stream content of the standard output (stdout) file.
            This file captures all the standard output generated by executed
            task.
          format: Url string
        Stderr:
          type: string
          description: >-
            The URL to the stream content of the standard error (stderr) file.
            This file contains all error messages and diagnostics emitted by
            executed task.
          format: Url string
        StdoutChunks:
          type: array
          description: >-
            A list of URLs pointing to the compressed chunks of the stdout file
            stream. For large stdout files, the content is split into manageable
            chunks and compressed using GZIP to facilitate easier download and
            handling.
          format: Array of URL strings
          items:
            type: string
    valueID:
      type: string
      pattern: val_[a-z0-9]{32}
    taskID:
      type: string
      pattern: tsk_[a-z0-9]{32}
    SamplesGenerateByUxStringRequest:
      type: object
      required:
        - payload
      properties:
        payload:
          type: string
    PlotUxStringRequest:
      type: object
      required:
        - payload
      properties:
        payload:
          type: string
    BuildStatus:
      type: string
      enum:
        - Accepted
        - Initialising
        - Rescheduled
        - In Progress
        - Completed
        - Cancelled
        - Stopped
      description: >
        - **Accepted:** The Build is accepted and queued for execution. The
        Build is _inactive_.

        - **Initialising:** The Signaloid Cloud Compute Engine has picked up the
        Build and is initialising the infrastructure to execute it. The Build is
        _active_.

        - **Rescheduled:** The Signaloid Cloud Compute Engine scheduling the
        Build to another worker, due to an interruption on the previous worker.
        The Build is _active_.

        - **In Progress:** The Build is running. The Build is _active_.

        - **Completed:** The Build exited with a zero exit code. The Build is
        _inactive_.

        - **Cancelled:** The Build exited with a non-zero exit code and . The
        Build is _inactive_.

        - **Stopped:** The Build exited with a non-zero exit code. The Build is
        _inactive_.
    SourceCode:
      type: object
      required:
        - Object
        - Code
      properties:
        Code:
          type: string
        Language:
          type: string
          enum:
            - C
            - C++
          description: >
            The programming language that the source code is written in. If not

            specified, the Signaloid Cloud Compute Engine will attempt to
            compile the source

            code as C and C++.
        Arguments:
          type: string
    Build:
      type: object
      properties:
        BuildID:
          $ref: '#/components/schemas/BuildID'
        Owner:
          $ref: '#/components/schemas/UserID'
        Status:
          $ref: '#/components/schemas/BuildStatus'
        StatusTransitions:
          type: array
          items:
            type: object
            properties:
              Status:
                type: string
              Timestamp:
                type: integer
              Message:
                type: string
        StartedAt:
          type: integer
        DefaultArguments:
          type: string
        DefaultDataSources:
          $ref: '#/components/schemas/DataSources'
        Application:
          type: object
          properties:
            Type:
              type: string
              enum:
                - SourceCode
                - Repository
            SourceCode:
              $ref: '#/components/schemas/SourceCode'
            Repository:
              $ref: '#/components/schemas/Repository'
        UpdatedAt:
          type: integer
        CreatedAt:
          type: integer
        FinishedAt:
          type: integer
        BuildArtifactAvailable:
          type: boolean
        BuildCoreSpecs:
          type: object
          properties:
            Class:
              type: string
            Precision:
              type: integer
            MemorySize:
              type: integer
            Microarchitecture:
              type: string
            CorrelationTracking:
              type: string
        TraceVariables:
          type: array
          items:
            $ref: '#/components/schemas/TraceVariableRequest'
        Stats:
          type: object
          properties:
            BuildTimeInMilliseconds:
              type: integer
            BuildSizeInBytes:
              type: integer
            CreatedAt:
              type: integer
      required:
        - Object
        - BuildID
        - Owner
        - Status
        - CreatedAt
    BuildOutputReturn:
      type: object
      description: >
        The returned object is a list of URLs providing direct access to the
        content streams related to the executed build.
      properties:
        Build:
          type: string
          description: >-
            The URL to the stream content of the build file. This file includes
            comprehensive details about the build process, useful for debugging
            and verification of build steps.
          format: Url string
    Variable:
      type: object
      properties:
        Object:
          type: string
          enum:
            - Variable
        Name:
          type: string
          pattern: '[a-zA-Z][a-zA-Z0-9]*'
        Type:
          type: string
          enum:
            - Variable
            - FormalParameter
        File:
          type: string
        Line:
          type: integer
          format: int
          minimum: 0
        Function:
          type: string
      required:
        - Object
        - Name
        - Kind
        - File
        - Line
        - Function
    bucketID:
      type: string
      pattern: bkt_[a-z0-9]{32}
    PipelineID:
      type: string
      pattern: pip_[a-z0-9]{32}
    driveID:
      type: string
      pattern: drv_[a-z0-9]{32}
    thingID:
      type: string
      pattern: thg_[a-z0-9]{32}
    objectType:
      type: string
      enum:
        - User
        - Thing
        - Gateway
        - Bucket
        - Drive
        - SignaloidCloudStorage
  examples:
    bucketGetReply:
      value:
        bucket_count: 0
        bucket_ids: []
        user_id: usr_000000000000000000000000000000ab
    driveGetReply:
      value:
        drive_count: 0
        drive_ids: []
        user_id: usr_000000000000000000000000000000ab
    thingsGetReply:
      value:
        thing_count: 1
        thing_ids:
          - thg_2cb6173b9248462d8c5c21e5e683cadc
        user_id: usr_000000000000000000000000000000ab
    thingProfile:
      value:
        CreatedAt: 1641031200
        Name: My Signaloid Test Thing (John Doe)
        Object: Thing
        Owner: usr_000000000000000000000000000000ab
        ThingID: thg_2cb6173b9248462d8c5c21e5e683cadc
        ThingStatus:
          local_ipv4_address: 172.22.22.66
          updated_at: 1645177974
        Topics:
          - thg_2cb6173b9248462d8c5c21e5e683cadc/stream
          - thg_2cb6173b9248462d8c5c21e5e683cadc/device
        UpdatedAt: 0
    thingFileList:
      value:
        items: []
        thing_id: thg_2cb6173b9248462d8c5c21e5e683cadc
        user_id: usr_000000000000000000000000000000ab
    userProfile:
      value:
        CreatedAt: 1642170191405
        Object: User
        Preferences:
          Editor_Execution_Arguments: ''
          Editor_Execution_Core: cor_0d65d1e8f57459079c0a036a3e09ae1d
          Editor_Execution_DataSources: >-
            {"Location":"sd0","ResourceID":"signaloid-cloud-storage:/usr_000000000000000000000000000000ab","ResourceType":"SignaloidCloudStorage"}
          Editor_Layout: vertical
          Editor_Layout_VariableViewer: false
          Editor_SourceCode: >-
            CiNpbmNsdWRlIDxzdGRpby5oPgojaW5jbHVkZSA8dXhody5oPgoKaW50Cm1haW4oaW50IGFyZ2MsIGNoYXIgKiAgYXJndltdKQp7Cglkb3VibGUJYSwgYiwgYzsKCglhID0gVXhId0RvdWJsZUdhdXNzRGlzdCgxMCwyKTsKCWIgPSBVeEh3RG91YmxlVW5pZm9ybURpc3QoMiwxMik7CglwcmludGYoImEgPSAlbGZcbiIsIGEpOwoJcHJpbnRmKCJiID0gJWxmXG4iLCBiKTsKCXByaW50ZigiYSA9ICVsZlxuIiwgYSk7CglwcmludGYoImIgPSAlbGZcbiIsIGIpOwoJcHJpbnRmKCJhID0gJWxmXG4iLCBhKTsKCXByaW50ZigiYiA9ICVsZlxuIiwgYik7CglwcmludGYoImEgPSAlbGZcbiIsIGEpOwoJcHJpbnRmKCJiID0gJWxmXG4iLCBiKTsKCgljID0gKGErYikvKGEtYik7CglwcmludGYoImMgPSAlbGZcbiIsIGMpOwoKCXJldHVybiAwOwp9
          Editor_Theme: dawn
          Execution_DefaultCore: cor_0d65d1e8f57459079c0a036a3e09ae1d
          Execution_DefaultDataSources: >-
            {"Location":"sd0","ResourceID":"signaloid-cloud-storage:/usr_000000000000000000000000000000ab","ResourceType":"SignaloidCloudStorage"}
          Execution_DefaultReferenceCore: cor_9a3efb0094405df5aeb61cf1f29606a0
          UpdatedAt: 1666627357
        ResourceUsage:
          APIAccessCount: 1
          BucketCount: 0
          CloudStorageBytes: 16738
          ConcurrentTaskCount: 0
          CoreCount: 1
          DataDriveCount: 1
          DataSourceCount: 0
          DynamicInstructionCount: 32507228791
          GatewayCount: 0
          KeyCount: 1
          PlotCount: 127
          RepositoryCount: 0
          ResetsAt: 1698800400
          TaskCount: 181
          UpdatedAt: 1698241879
        UserID: usr_000000000000000000000000000000ab
        Username: firstname.lastname@example.com
    drivePostRequest:
      value:
        DataSources:
          - Location: /mountPoint
            Object: DataSource
            ResourceID: signaloid-cloud-storage:/usr_000000000000000000000000000000ab
            ResourceType: SignaloidCloudStorage
        Name: sampleDrive
    drivePatchRequest:
      value:
        DataSources: []
        Name: sampleDrive
    drivePostReply:
      value:
        CreatedAt: 1666947436
        DataSources:
          - Location: /mountPoint
            Object: DataSource
            ResourceID: signaloid-cloud-storage:/usr_000000000000000000000000000000ab
            ResourceType: SignaloidCloudStorage
        DriveID: drv_c5ef68a00ba445ca8b191e4d24224002
        Name: sampleDrive
        Object: Drive
        Owner: usr_000000000000000000000000000000ab
        UpdatedAt: 1666947436
    driveIdGetReply:
      value:
        CreatedAt: 1666947436
        DataSources: []
        DriveID: drv_c5ef68a00ba445ca8b191e4d24224002
        Name: sampleDrive
        Object: Drive
        Owner: usr_000000000000000000000000000000ab
        UpdatedAt: 1666947455
    plotPostReply:
      value:
        plotID: c6900a71-fe4f-4ebd-b2c0-8fc25f5b3a35
        presignedURL: >-
          https://plotbucket97cc3f04-1ow0gt1t9hif2.s3.amazonaws.com/c6900a71-fe4f-4ebd-b2c0-8fc25f5b3a35.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA42JDQETPVD7OWCXF%2F20221028%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221028T085959Z&X-Amz-Expires=604799&X-Amz-SignedHeaders=host&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEEEaCWV1LXdlc3QtMiJFMEMCHyP7bcPbr%2B4D7DuBeGeQshs952XFrvm2oeSFUrykfGMCIHrd0C3bvvBsTdZEfVz4UBgszsO2YLBpj%2BE%2Fm8ltFDtiKr0DCCoQAhoMODgxMDc5NjI0OTI3Igyuspu6If32vY4su00qmgN7MslY41LQvvJAqeK76NvAXXjyjr6rGMuPX1Gs27dXGkDeAMMOVgs9fdYP3c9CnpJ%2FA7jrDiwcAZsIgppC3o1Q%2FaLLt99Du9NGNGyObyZJcK1q%2BdWXN649c9fhNOnAjHH3Kc6OqZNbKmGRfSenvEdSeDLo%2BW90oqfSyXi2xfBtjiNHrnWksM%2BN79d4ZV8X1i0PX9DAaTp9GJeh06SmkwoSR9CJqkNdy%2BttcH7THTb63%2F0nK8fuEck5Y9SKru9spmc2TcdDEmBduD4W%2B3uNcrpbclhyd8702ZCbg4eITmoCvcXjkvL33Y65%2BSlVMK7W3Bm4iDfbjxmpKe2bq1Xy7oDWE37xbRD7VNodKX28ExTPhlNG9Iy50qghxXoVMh4cs6RD%2Bw8Ds5%2BuGrWNl3GY0q2jsbvLD1ERb4EidMCZFydWPMP3ir4cxNlz8dpvAlbq9r9UpM8VdW4rKXru8AxEmGRvVs3mafA%2FZje1q7JJddnKk3dFg%2B4fyx7OqDUvFwiEiUZSXemGEmKnq6xLLF59CgPH5evQ0MdCEuJKojCLtO6aBjqgAQ8NOqM%2FligH%2FCyznqzWENFhAVy516KLmqq%2B77iZsaIeR64Pl2FmaRxKc5tyX6Of2dURAw%2BtIjRVKTgBROKu%2B0CyIrlyP%2Fz%2BG%2BDMKChfX9WlEwoTR%2B0uLvI4R%2FCYLciTWbNfBUciBpDvU7IyJI%2Bv79p%2F6bvwkbt6e4b88yBLKssuterABiOKTlM%2BfDNfd9jPZuVLkGrDKe18TLPHyJsSk30%3D&X-Amz-Signature=111d24ed3f49e31599ccb1d5fd2756947b61d9b5b972aa9efc8ffec18aa673a4
    fileList:
      value:
        count: 6
        items:
          - etag: '"d41d8cd98f00b204e9800998ecf8427e"'
            last_modified: 1665672906000
            path: ''
            size: 0
          - etag: '"d41d8cd98f00b204e9800998ecf8427e"'
            last_modified: 1665672906000
            path: Signaloid/
            size: 0
          - etag: '"d41d8cd98f00b204e9800998ecf8427e"'
            last_modified: 1665672906000
            path: Signaloid/example-loadDistFromFile/
            size: 0
          - etag: '"18cedf0c989594d5d7b66d58ac2a499d"'
            last_modified: 1665672906000
            path: Signaloid/example-loadDistFromFile/example.csd
            size: 4205
          - etag: '"3c41b0823f05cf86da0d560b0e033c03"'
            last_modified: 1665672907000
            path: Signaloid/example-loadDistFromFile/example.csv
            size: 21
          - etag: '"d41d8cd98f00b204e9800998ecf8427e"'
            last_modified: 1666947334000
            path: sampleDir/
            size: 0
    fileDownload:
      value:
        content_type: text/csv
        download_url: >-
          https://signaloid-cloud-storage-staging.s3.eu-west-2.amazonaws.com/usr_000000000000000000000000000000ab/Signaloid/example-loadDistFromFile/example.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIA42JDQETPSMT4S3WA%2F20221028%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221028T085331Z&X-Amz-Expires=900&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEEEaCWV1LXdlc3QtMiJGMEQCIBEYvuHfr47Wj7CTekvcphD0yrTEBZSuOwhnaIncTdBoAiBRg04QrE0SSWcf9ewuDtDNJGXX76Tgs2aoZ73MpDLrzirHAwgqEAIaDDg4MTA3OTYyNDkyNyIM9EsTjt6yFHdWaj3gKqQDFZTcOmyobhK%2FpzH8Y5iFSsQeoGhZYroC7vX8xdaipWiZ2uqAoOZpsU%2FI0zAVhtdm0YBfbW5%2B6RVx7Tohn2Reiux7Gl5juKPc6PhQD%2BZjC7ta3awiLOCZhrCOgA4qrdvRol3%2F2PZqCryT8oruLvVH8iR5Q07ryQBbwrX19yjwy0y5bPU2qgwFFgK3ga8MjPpJ%2FTU0P8BfDywtkXS00EAotvfmM0V4rfH4UZOZEETkDZD0kR7ECMOJ8IPk8PwrUnOOZEIZ%2F559ioyBfAPIeMzV81UBM5uvVh7g%2BD4mndOcuwptlqE%2Fz7lgjxKYGpodCKNOg56sOjJZm0KTgYtk1xUx12PjzVqejBvY3Wk2G3JSreP6lFbLtbWJI%2B3bWgscKtKQMnNRmEJ5ZAg9NgweVe3Hus%2BfarAHvTqLgsFT5MzINag98VGQiQAl9E3NH8fef01SsjjpybrlrNuWxffCMP0IFPh3pABTCSrGaC%2Bc0ZE4kdMQoPpkEqPsPRiuvfshDeWI4mqPOmwECuJcA1Ofe55J%2FEObi1RxRIQAdms3KyzjyPT2L1N%2FMIqx7poGOp8BRSo3Y5CheR4dgRI1SsvMzZLZ3pJnBTsFSAR%2BiGFEfS6N0cvMSfgPuMeu9yxhCjeCDUDMZId%2Bs3Z%2BSM%2BT5eNfewIGeWM26J2dBaI3TWsA9zGpQrSJeKIIilcYzF7q1X98NU2a7K2axVCH%2FPG66Uwk5qOWkN3N0%2FCNqP3xYGT9%2Fli4Hg5MdBqKiUlZ29kpKOmSfjiyge8TT6uc%2F33DEglf&X-Amz-Signature=d1436f6d73737b7fabcd32d963136cb3422aaeda4ab5a46ac8274d949d5580cb&X-Amz-SignedHeaders=host&x-id=GetObject
        etag: '"3c41b0823f05cf86da0d560b0e033c03"'
        last_modified: 1665672907000
        size: 21
    UnauthorizedError:
      value:
        error: Unauthorized
        message: Not authorized request.
    NotFoundError:
      value:
        error: Not Found
    InternalServerError:
      value:
        error: Internal Server Error
        message: >-
          There was a database error while performing this operation. If this
          issue persists, please contact Signaloid Support at
          developer-support@signaloid.com.
    BadRequestError:
      value:
        error: Bad Request
        message: Missing or malformed 'Name' field
  api_name: SignaloidPublicRealtimeApi-{ENV}
  endpoint_ws: wss://{public_api_id}.appsync-realtime-api.{region}.amazonaws.com/event
  auth:
    subscribe: Lambda authorizer (publicAuthFn)
    publish: IAM only (backend publishers)
  channel_namespaces:
    - public-build-status
    - public-task-status
    - public-build-stats
    - public-task-stats
    - public-build-count
    - public-task-count
  example_channels:
    - public-build-status/{BuildID}
    - public-task-status/{TaskID}
  /event/realtime/:
    get:
      tags:
        - WebSockets
      summary: >-
        Open (authentication-free) WebSocket connection endpoint for real-time
        events
      description: >
        AWS AppSync Event API endpoint for WebSocket connections to receive
        real-time events.

        This is a WebSocket-only endpoint for open (authentication-free)
        subscriptions.


        ## Available Channels


        ### 1. Task Status (`public-task-status/{userId}`)

        Notifies about task lifecycle state changes:

        - `Accepted` - Task request has been accepted

        - `Initializing` - Task environment is being set up

        - `In Progress` - Task is actively running

        - `Rescheduled` - Task has been rescheduled

        - `Completed` - Task finished successfully

        - `Cancelled` - Task was cancelled by user

        - `Stopped` - Task was stopped by system


        **Payload includes:** `taskId`, `status`, `message`, and `timestamp`.


        ## Connection Protocol

        1. Connect with authorization header

        2. Send connection_init message

        3. Receive connection_ack

        4. Subscribe to channels


        ## Message Structure

        All WebSocket messages follow this consistent structure:

        ```json

        {
          "type": "connection_init|connection_ack|subscribe|subscribe_success|data|error|ka",
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "channel": "public-task-status/usr_123",
          "payload": {}
        }

        ```
      security:
        - JWTAuth: []
      parameters:
        - in: header
          name: Authorization
          required: true
          schema:
            type: string
          description: |
            Base64 URL encoded authorization header. Format:
            {
              "host": "your-appsync-domain",
              "authorization": "Bearer <jwt_token>"
            }
        - in: header
          name: Sec-WebSocket-Protocol
          required: true
          schema:
            type: string
          description: |
            WebSocket protocol header. Must include:
            - header-{base64_encoded_auth}
            - aws-appsync-event-ws
      responses:
        '101':
          description: WebSocket connection established
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSocketMessage'
              examples:
                connection_init:
                  value:
                    type: connection_init
                connection_ack:
                  value:
                    type: connection_ack
                subscribe:
                  value:
                    type: subscribe
                    id: 123e4567-e89b-12d3-a456-426614174000
                    channel: public-task-status/usr_123
                subscribe_success:
                  value:
                    type: subscribe_success
                    id: 123e4567-e89b-12d3-a456-426614174000
                task_status:
                  value:
                    type: data
                    payload:
                      $ref: '#/components/schemas/TaskStatusEvent'
                error:
                  value:
                    type: error
                    errors:
                      - message: Authentication failed
                keep_alive:
                  value:
                    type: ka
