components:
  schemas:
    ExecuteQueryResponse:
      additionalProperties: false
      properties:
        uri:
          description: The uri
          title: Uri
          type: string
      type: object
    Query:
      additionalProperties: false
      properties:
        context_id:
          title: Context
          type: string
        criteria:
          title: Criteria
          type: object
        limit:
          description: The maximum number of rows to return
          format: float
          title: Limit
          type: number
        name:
          description: Optional name of the query
          title: Name
          type: string
        offset:
          description: The starting rows
          format: float
          title: Offset
          type: number
        output_fields:
          items:
            additionalProperties: false
            properties:
              alias:
                title: Alias
                type: string
              label:
                title: Label
                type: string
              name:
                title: Name
                type: string
            required:
              - name
            type: object
          minItems: 1
          type: array
        sort_fields:
          items:
            additionalProperties: false
            properties:
              descending:
                title: Descending
                type: boolean
              name:
                title: Name
                type: string
            required:
              - name
            type: object
          type: array
      required:
        - output_fields
      type: object
    QueryDefinition:
      additionalProperties: false
      properties:
        common_table_expressions:
          items:
            additionalProperties: false
            properties:
              alias:
                title: Alias
                type: string
              materialized:
                title: Materialized
                type: boolean
              sql:
                title: Sql
                type: string
            required:
              - alias
              - sql
            type: object
          type: array
        context:
          additionalProperties: false
          properties:
            display_name:
              title: Display Name
              type: string
            field:
              title: Field
              type: string
            help_text:
              title: Help Text
              type: string
            required:
              title: Required
              type: boolean
            service:
              title: Service
              type: string
          required:
            - field
            - service
          title: Context
          type: object
        default_output_fields:
          items:
            additionalProperties: false
            properties:
              applies_when_context:
                enum:
                  - both
                  - is given
                  - is not given
                title: Applies When Context
                type: string
              label:
                title: Label
                type: string
              name:
                title: Name
                type: string
            required:
              - name
            type: object
          minItems: 1
          type: array
        default_sort_fields:
          items:
            additionalProperties: false
            properties:
              applies_when_context:
                enum:
                  - both
                  - is given
                  - is not given
                title: Applies When Context
                type: string
              descending:
                title: Descending
                type: boolean
              name:
                title: Name
                type: string
            required:
              - name
            type: object
          minItems: 1
          type: array
        description:
          title: Description
          type: string
        fields:
          items:
            additionalProperties: false
            properties:
              acceptable_values:
                items:
                  additionalProperties: false
                  properties:
                    hide_from_portal:
                      title: Hide From Portal
                      type: boolean
                    label:
                      title: Label
                      type: string
                    value:
                      title: Value
                      type: string
                  required:
                    - value
                  type: object
                type: array
              custom_sql:
                title: Custom Sql
                type: string
              database_column:
                title: Database Column
                type: string
              group_name:
                title: Group Name
                type: string
              label:
                title: Label
                type: string
              name:
                title: Name
                type: string
              path:
                title: Path
                type: string
              reference_service:
                title: Reference Service
                type: string
              service:
                description: When set, values can be pulled from this service
                title: Service
                type: string
              table_alias:
                title: Table Alias
                type: string
              type:
                title: Type
                type: string
            required:
              - group_name
              - name
              - table_alias
              - type
            type: object
          type: array
        id:
          title: ID
          type: string
        name:
          title: Name
          type: string
        perform_custom_resolution_logic:
          description: >-
            If set, the microservice must post process the query before it is
            completely resolves
          title: Perform Custom Resolution Logic
          type: boolean
        primary_table:
          title: Primary Table
          type: string
        services:
          items:
            additionalProperties: false
            properties:
              group_name:
                title: Group Name
                type: string
              hints:
                additionalProperties: false
                properties: {}
                title: Hints
                type: object
              id_column:
                title: Id Column
                type: string
              join_fragment:
                description: The fragment of sql to create on join
                oneOf:
                  - x-required: true
                title: Join Fragment
                type: string
              service:
                title: Service
                type: string
              table:
                description: >-
                  The table in the service; if omitted, the assumption is that
                  its the service with dashes converted to underscores
                title: Table
                type: string
              table_alias:
                maxLength: 445
                title: Table Alias
                type: string
            required:
              - table_alias
            type: object
          type: array
      required:
        - default_output_fields
        - default_sort_fields
        - primary_table
      type: object
    QueryDescription:
      additionalProperties: false
      properties:
        duration:
          description: The query execution time
          format: float
          title: Duration
          type: number
        has_result_set:
          description: Did this query return data?
          title: Has Result Set
          type: boolean
        id:
          description: The id of the query
          title: ID
          type: string
        metadata_uri:
          description: The location where you can download the metadata for this query
          title: Metadata Uri
          type: string
        rows:
          description: The number of rows returned by this query
          format: float
          title: Rows
          type: number
        schedule_id:
          description: The ID of the query delivery schedule that initiated this query
          title: Schedule
          type: string
        size:
          description: The size of the data returned by this query
          format: float
          title: Size
          type: number
        status:
          description: The current status of the query
          title: Status
          type: string
        sys_created_at:
          description: The date/time that this query was started
          format: date-time
          title: Sys Created At
          type: string
        sys_created_by_id:
          description: The ID of the user that created this record
          title: Sys Created By
          type: string
        sys_last_modified_at:
          description: The date/time that this query status was last updated
          format: date-time
          title: Sys Last Modified At
          type: string
        sys_last_modified_by_id:
          description: The ID of the user that last modified this record
          title: Sys Last Modified By
          type: string
        uri:
          description: The location where you can download the results of this query
          title: Uri
          type: string
      type: object
    QueryResults:
      additionalProperties: false
      properties:
        fields:
          items:
            additionalProperties: false
            properties:
              label:
                title: Label
                type: string
              name:
                title: Name
                type: string
              type:
                title: Type
                type: string
            type: object
          type: array
        query:
          additionalProperties: false
          properties: {}
          title: Query
          type: object
        rows:
          items:
            type: object
          type: array
        sql:
          title: Sql
          type: string
        target_service:
          description: The target service of the query
          title: Target Service
          type: string
        totalNumberOfRows:
          format: float
          title: Totalnumberofrows
          type: number
      type: object
    StartQueryResponse:
      additionalProperties: false
      properties:
        id:
          description: The id of the query
          title: ID
          type: string
      type: object
    StepFunctionExecutionDescription:
      additionalProperties: false
      properties:
        executionArn:
          description: The execution ARN
          title: Executionarn
          type: string
        input:
          description: The input to the execution
          title: Input
          type: string
        output:
          additionalProperties: false
          description: The ouptut of the execution
          properties: {}
          title: Output
          type: object
        start_date:
          description: When the execution started
          format: date-time
          title: Start Date
          type: string
        stateMachineArn:
          description: The arn of the state machine being run
          title: Statemachinearn
          type: string
        status:
          description: The status
          enum:
            - ABORTED
            - FAILED
            - RUNNING
            - SUBMITTED
            - SUCCEEDED
            - TIMED_OUT
          title: Status
          type: string
        stop_date:
          description: The date the execution stopped
          format: date-time
          title: Stop Date
          type: string
      type: object
  securitySchemes:
    knox-authorizer:
      bearerFormat: JWT
      scheme: bearer
      type: http
info:
  description: >
    The System API is different from the other Rhythm apps because it is not
    focused on a specific area

    of association management. Instead, this API provides endpoints that are
    useful across all the other areas of the

    platform. It is most commonly used to execute Queries which may combine data
    points from several apps.
  title: System
  version: v1-2025-04-18
openapi: 3.0.0
paths:
  /queries/{tenantId}/describe/{id}:
    get:
      description: >-
        Gets the current status and results for a query that has previously been
        started
      operationId: describeQuery
      parameters:
        - in: path
          name: tenantId
          required: true
          description: Parameters to the query
          schema:
            type: string
        - in: path
          name: id
          required: true
          description: The ID of a previously started query
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryDescription'
          description: The query details were located successfully.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The query id supplied was not valid.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: The query id could not be found.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '409':
          description: >-
            The contact could not be saved because it refers to/depends on a
            non-existent object.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: Limit exceeded... unable to merge contact based on tenant limits.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: General server error.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      security:
        - knox-authorizer: []
      summary: >-
        Gets the current status and results for a query that has previously been
        started
      tags:
        - Queries
  /queries/{tenantId}/public/description/{queryType}:
    get:
      description: >-
        Gets the definition for a specific type of query including the available
        fields
      operationId: describePublicQueryType
      parameters:
        - in: path
          name: tenantId
          required: true
          description: Parameters to the query
          schema:
            type: string
        - in: path
          name: queryType
          required: true
          description: The type of query
          schema:
            type: string
        - in: query
          name: contextId
          required: false
          description: Optional query type
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryDefinition'
          description: The contact was merged successfully.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The contact supplied was not valid.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: The contact could not be found.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '409':
          description: >-
            The contact could not be saved because it refers to/depends on a
            non-existent object.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: Limit exceeded... unable to merge contact based on tenant limits.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: General server error.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      summary: >-
        Gets the definition for a specific type of query including the available
        fields
      tags:
        - Queries
  /queries/{tenantId}/start/{queryType}/{outputFormat}:
    post:
      description: Starts a new query and returns the query id and info
      operationId: startQuery
      parameters:
        - in: path
          name: tenantId
          required: true
          description: The current tenant
          schema:
            type: string
        - in: path
          name: queryType
          required: true
          description: The type of query
          schema:
            type: string
        - in: path
          name: outputFormat
          required: true
          description: The output format of the query
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Query'
        description: The query
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartQueryResponse'
          description: The query was started successfully.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The query supplied was not valid.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: The query definition could not be found.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: Limit exceeded... unable to merge contact based on tenant limits.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: General server error.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      security:
        - knox-authorizer: []
      summary: Starts a new query and returns the query id and info
      tags:
        - Queries
  /stepFunctions/{tenantId}/describe/{executionArn}:
    get:
      description: Gets the current state of an execution
      operationId: describeExecution
      parameters:
        - in: path
          name: tenantId
          required: true
          description: The id of the tenant being accessed
          schema:
            type: string
        - in: path
          name: executionArn
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StepFunctionExecutionDescription'
          description: The execution
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The request was not valid
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: State machine was not found
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: >-
            The state machine could not be started because an instance is
            already running
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: An internal server error occured.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      security:
        - knox-authorizer: []
      summary: Gets the current state of an execution
      tags:
        - Step Functions
  /stepFunctions/{tenantId}/public/describe/{executionArn}:
    get:
      description: Gets the current state of an execution
      operationId: describeExecutionPublic
      parameters:
        - in: path
          name: tenantId
          required: true
          description: The id of the tenant being accessed
          schema:
            type: string
        - in: path
          name: executionArn
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StepFunctionExecutionDescription'
          description: The execution
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The request was not valid
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: State machine was not found
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: >-
            The state machine could not be started because an instance is
            already running
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: An internal server error occured.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      summary: Gets the current state of an execution
      tags:
        - Step Functions
  /stepFunctions/{tenantId}/{stateMachineName}/{executionId}:
    delete:
      description: This method cancels a state machine execution
      operationId: cancelStateMachineExecution
      parameters:
        - in: path
          name: tenantId
          required: true
          description: The id of the tenant being accessed
          schema:
            type: string
        - in: path
          name: stateMachineName
          required: true
          description: The name of the state machine
          schema:
            type: string
        - in: path
          name: executionId
          required: true
          description: The execution ID
          schema:
            type: string
      responses:
        '200':
          description: The state machine was cancelled successfully
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          description: The request was not valid
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '401':
          description: Unauthorized
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          description: Forbidden
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          description: State machine was not found
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '429':
          description: >-
            The state machine could not be started because an instance is
            already running
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          description: An internal server error occured.
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      security:
        - knox-authorizer: []
      summary: This method cancels a state machine execution
      tags:
        - Step Functions
servers:
  - url: https://system.api.rhythmsoftware.com
tags:
  - name: Queries
    description: Queries
  - name: Step Functions
    description: Step Functions
