> ## Documentation Index
> Fetch the complete documentation index at: https://prismeai-docs-next.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get v2workspaces events

> Retrieve events filtered with any JSON path specified in GET parameters. Can be called as websocket.



## OpenAPI

````yaml /api-reference/swagger.yml get /v2/workspaces/{workspaceId}/events
openapi: 3.0.0
info:
  version: 1.0.0
  title: Prisme.ai APIs
  description: Prisme.ai APIs specifications
  termsOfService: https://www.prisme.ai/mentions-legales
  contact:
    name: Prisme.ai Support Team
    email: support@prisme.ai
    url: https://www.prisme.ai
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.eda.prisme.ai
  - url: http://localhost:3001
security:
  - BearerAuth: []
  - WorkspaceApiKeyAuth: []
  - BearerAuth: []
    WorkspaceApiKeyAuth: []
paths:
  /v2/workspaces/{workspaceId}/events:
    get:
      tags:
        - Prisme.ai Events
      description: >-
        Retrieve events filtered with any JSON path specified in GET parameters.
        Can be called as websocket.
      operationId: eventsLongpolling
      parameters:
        - name: workspaceId
          in: path
          description: ID of workspace to listen to
          required: true
          schema:
            type: string
        - name: text
          in: query
          description: Search these keywords
          schema:
            type: string
          allowReserved: true
        - name: beforeId
          in: query
          description: Match every events created before given eventId
          schema:
            type: string
        - name: appInstanceDepth
          in: query
          description: Match only events from appInstances not exceeding that depth
          schema:
            type: number
        - in: query
          name: query
          schema:
            type: object
            additionalProperties: true
          style: form
          explode: false
          allowReserved: true
        - name: types
          in: query
          example: message,notification
          description: 'Comma separated list of listened event types '
          schema:
            type: string
          allowReserved: true
        - name: afterDate
          in: query
          description: Retrieve events created after this ISO8601 formatted date
          schema:
            type: string
        - name: beforeDate
          in: query
          description: Retrieve events created before this ISO8601 formatted date
          schema:
            type: string
        - name: page
          in: query
          description: Page number
          schema:
            type: number
        - name: limit
          in: query
          description: Page size
          required: false
          schema:
            type: number
        - name: sort
          in: query
          description: >-
            Sort order, asc for oldest first & 'desc' for earliest first.
            Earliest first by default
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
      responses:
        '200':
          description: Success Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      events:
                        $ref: '#/components/schemas/AllEventResponses'
        '400':
          description: Bad parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadParametersError'
        '401':
          description: AuthenticationError
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '403':
          description: Bad permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Object not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectNotFoundError'
components:
  schemas:
    AllEventResponses:
      type: array
      items:
        anyOf:
          - $ref: '#/components/schemas/PrismeEvent'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/GenericErrorEvent'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/FailedLogin'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/SucceededLogin'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/ExecutedAutomation'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/UpdatedContexts'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/CreatedWorkspace'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/UpdatedWorkspace'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/DeletedWorkspace'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/AppInstance'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/ConfiguredAppInstance'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/InstalledAppInstance'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/UninstalledAppInstance'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/CreatedAutomation'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/UpdatedAutomation'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/DeletedAutomation'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/CreatedPage'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/UpdatedPage'
          - allOf:
              - $ref: '#/components/schemas/PrismeEvent'
              - $ref: '#/components/schemas/DeletedPage'
    BadParametersError:
      type: object
      properties:
        error:
          type: string
          example: BadParameters
        message:
          type: string
        details: {}
    AuthenticationError:
      type: object
      properties:
        error:
          type: string
          example: AuthenticationError
        message:
          type: string
          example: Unauthenticated
    ForbiddenError:
      type: object
      properties:
        error:
          type: string
          example: ForbiddenError
        message:
          type: string
          example: Forbidden
    ObjectNotFoundError:
      type: object
      properties:
        error:
          type: string
          example: ObjectNotFound
        message:
          type: string
    PrismeEvent:
      type: object
      required:
        - type
        - source
        - createdAt
        - id
        - size
      properties:
        type:
          type: string
          example: apps.someApp.someCustomEvent
        source:
          type: object
          properties:
            appSlug:
              type: string
            appInstanceFullSlug:
              type: string
            appInstanceDepth:
              type: number
            automationSlug:
              type: string
            automationDepth:
              type: number
            userId:
              type: string
            ip:
              type: string
            sessionId:
              type: string
            workspaceId:
              type: string
            socketId:
              type: string
            host:
              type: object
              required:
                - service
              properties:
                service:
                  type: string
            correlationId:
              type: string
            serviceTopic:
              type: string
        payload:
          $ref: '#/components/schemas/AnyValue'
        target:
          $ref: '#/components/schemas/PrismeEventTarget'
        options:
          $ref: '#/components/schemas/PrismeEventOptions'
        error:
          type: object
          properties:
            error:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/AnyValue'
            level:
              type: string
              enum:
                - warning
                - error
                - fatal
              example: warning
        createdAt:
          type: string
          description: Creation date (ISO8601)
        id:
          type: string
        size:
          type: number
    GenericErrorEvent:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: error
        payload:
          type: object
          required:
            - message
          properties:
            type:
              type: string
            message:
              type: string
            details: {}
          additionalProperties: true
    FailedLogin:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: gateway.login.failed
          enum:
            - gateway.login.failed
        payload:
          type: object
          properties:
            ip:
              type: string
            email:
              type: string
            provider:
              type: string
    SucceededLogin:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: gateway.login.succeeded
          enum:
            - gateway.login.succeeded
        payload:
          type: object
          required:
            - id
            - session
            - authData
          properties:
            ip:
              type: string
            email:
              type: string
            id:
              type: string
            provider:
              type: string
            authData:
              additionalProperties:
                $ref: '#/components/schemas/AuthData'
            session:
              type: object
              required:
                - id
                - expiresIn
                - expires
              properties:
                id:
                  type: string
                expiresIn:
                  type: number
                  description: Expires in N seconds
                expires:
                  type: string
                  description: Expires ISODate
    ExecutedAutomation:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: runtime.automations.executed
          enum:
            - runtime.automations.executed
        payload:
          type: object
          required:
            - slug
            - trigger
            - payload
            - output
            - duration
            - startedAt
            - break
          properties:
            slug:
              type: string
            trigger:
              type: object
              properties:
                type:
                  type: string
                value:
                  type: string
            payload:
              type: object
            output:
              $ref: '#/components/schemas/AnyValue'
            duration:
              type: number
            throttled:
              type: number
            startedAt:
              type: string
            break:
              type: boolean
    UpdatedContexts:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: runtime.contexts.updated
          enum:
            - runtime.contexts.updated
        payload:
          type: object
          required:
            - emitterId
            - updates
          properties:
            emitterId:
              type: string
              description: >-
                Internal id to avoid applying these updates to the worker which
                emitted them
            updates:
              type: array
              items:
                type: object
                required:
                  - type
                  - path
                  - fullPath
                  - context
                properties:
                  type:
                    $ref: '#/components/schemas/ContextSetType'
                  path:
                    type: array
                    items:
                      oneOf:
                        - type: string
                        - type: number
                  fullPath:
                    type: string
                  context:
                    type: string
                  value: {}
                  cacheId:
                    type: string
    CreatedWorkspace:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.created
          enum:
            - workspaces.created
        payload:
          type: object
          required:
            - workspace
          properties:
            workspace:
              $ref: '#/components/schemas/Workspace'
            reason:
              type: object
              properties:
                type:
                  type: string
    UpdatedWorkspace:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.updated
          enum:
            - workspaces.updated
        payload:
          type: object
          required:
            - workspace
          properties:
            workspace:
              $ref: '#/components/schemas/Workspace'
            oldSlug:
              type: string
            migrated:
              type: string
            reason:
              type: object
              properties:
                type:
                  type: string
    DeletedWorkspace:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.deleted
          enum:
            - workspaces.deleted
        payload:
          type: object
          required:
            - workspaceId
          properties:
            workspaceId:
              type: string
            name:
              type: string
            workspaceSlug:
              type: string
    AppInstance:
      type: object
      required:
        - appSlug
      additionalProperties: false
      properties:
        appSlug:
          type: string
          description: App unique id
        appName:
          $ref: '#/components/schemas/LocalizedText'
        appVersion:
          type: string
          description: Defaults to the latest known app version
        slug:
          type: string
          description: >-
            Unique & human readable id across current workspace's appInstances,
            which will be used to call this app automations
        disabled:
          type: boolean
          description: If disabled, this appInstance will be ignored during execution
        labels:
          type: array
          items:
            type: string
            pattern: ^[0-9A-Za-z._:-]{2,60}$
        updatedAt:
          type: string
        createdAt:
          type: string
        updatedBy:
          type: string
        createdBy:
          type: string
        checksum:
          type: string
        config: {}
    ConfiguredAppInstance:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.apps.configured
          enum:
            - workspaces.apps.configured
        payload:
          type: object
          required:
            - appInstance
            - slug
          properties:
            appInstance:
              type: object
              required:
                - appSlug
              properties:
                appSlug:
                  type: string
                  description: App unique id
                appName:
                  $ref: '#/components/schemas/LocalizedText'
                appVersion:
                  type: string
                  description: Defaults to the latest known app version
                slug:
                  type: string
                  description: >-
                    Unique & human readable id across current workspace's
                    appInstances, which will be used to call this app
                    automations
                disabled:
                  type: boolean
                  description: >-
                    If disabled, this appInstance will be ignored during
                    execution
                labels:
                  type: array
                  items:
                    type: string
                    pattern: ^[0-9A-Za-z._:-]{2,60}$
                updatedAt:
                  type: string
                createdAt:
                  type: string
                updatedBy:
                  type: string
                createdBy:
                  type: string
                checksum:
                  type: string
                config: {}
                oldConfig: {}
            slug:
              type: string
            oldSlug:
              type: string
              description: Filled with the previous appInstance slug when renamed
            events:
              $ref: '#/components/schemas/ProcessedEvents'
            reason:
              type: object
              properties:
                type:
                  type: string
    InstalledAppInstance:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.apps.installed
          enum:
            - workspaces.apps.installed
        payload:
          type: object
          required:
            - appInstance
            - slug
          properties:
            appInstance:
              $ref: '#/components/schemas/AppInstance'
            slug:
              type: string
            events:
              $ref: '#/components/schemas/ProcessedEvents'
            reason:
              type: object
              properties:
                type:
                  type: string
    UninstalledAppInstance:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.apps.uninstalled
          enum:
            - workspaces.apps.uninstalled
        payload:
          type: object
          required:
            - slug
          properties:
            slug:
              type: string
            reason:
              type: object
              properties:
                type:
                  type: string
    CreatedAutomation:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.automations.created
          enum:
            - workspaces.automations.created
        payload:
          type: object
          required:
            - automation
            - slug
          properties:
            slug:
              type: string
            automation:
              $ref: '#/components/schemas/Automation'
            events:
              $ref: '#/components/schemas/ProcessedEvents'
    UpdatedAutomation:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.automations.updated
          enum:
            - workspaces.automations.updated
        payload:
          type: object
          required:
            - automation
            - slug
          properties:
            automation:
              $ref: '#/components/schemas/Automation'
            slug:
              type: string
            oldSlug:
              type: string
              description: Filled with the previous automation slug when renamed
            events:
              $ref: '#/components/schemas/ProcessedEvents'
    DeletedAutomation:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.automations.deleted
          enum:
            - workspaces.automations.deleted
        payload:
          type: object
          required:
            - automationSlug
          properties:
            automationSlug:
              type: string
    CreatedPage:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.pages.created
          enum:
            - workspaces.pages.created
        payload:
          type: object
          required:
            - page
          properties:
            page:
              $ref: '#/components/schemas/Page'
            events:
              $ref: '#/components/schemas/ProcessedEvents'
    UpdatedPage:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.pages.updated
          enum:
            - workspaces.pages.updated
        payload:
          type: object
          required:
            - page
            - slug
          properties:
            page:
              $ref: '#/components/schemas/Page'
            slug:
              type: string
            oldSlug:
              type: string
              description: Filled with the previous page slug when renamed
            events:
              $ref: '#/components/schemas/ProcessedEvents'
    DeletedPage:
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          example: workspaces.pages.deleted
          enum:
            - workspaces.pages.deleted
        payload:
          type: object
          required:
            - pageSlug
          properties:
            pageSlug:
              type: string
    AnyValue: {}
    PrismeEventTarget:
      type: object
      properties:
        userTopic:
          type: string
        userId:
          type: string
        sessionId:
          type: string
        currentSocket:
          type: boolean
          default: true
          description: >-
            If emitted in response to an active socket (i.e source.socketId is
            set), this event is only visible to this same socket. Defaults to
            true
    PrismeEventOptions:
      type: object
      properties:
        persist:
          type: boolean
          description: Whether to persist this event or not. Defaults to true
          default: true
        aggPayload:
          type: boolean
          default: false
          description: >-
            Populate advanced aggregation payload for custom mappings &
            analytics. This is automatically enabled for events mapped in
            config.events.types.*
        async:
          type: boolean
          default: false
          description: >-
            If true, the instruction will return control without waiting for the
            event to be emitted. Defaults to false
    AuthData:
      type: object
      required:
        - id
      additionalProperties: true
      properties:
        id:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
        language: {}
    ContextSetType:
      type: string
      enum:
        - replace
        - merge
        - push
        - delete
    Workspace:
      $ref: '#/components/schemas/DSUL'
    LocalizedText:
      oneOf:
        - type: object
          additionalProperties:
            type: string
          example:
            fr: Bonjour
            en: Hello
        - type: string
          example: Bonjour
    ProcessedEvents:
      type: object
      properties:
        emit:
          type: array
          items:
            type: string
        listen:
          type: array
          items:
            type: string
        autocomplete:
          type: array
          items:
            type: object
            required:
              - event
            properties:
              event:
                type: string
                example: prismeaiMessenger.message
              autocomplete:
                $ref: '#/components/schemas/EmitAutocomplete'
    Automation:
      type: object
      required:
        - do
        - name
      additionalProperties: false
      properties:
        description:
          $ref: '#/components/schemas/LocalizedText'
        private:
          type: boolean
          description: >-
            Set this to true if you don't want your automation to be accessible
            outside of your app. Default is false.
          example: false
        disabled:
          type: boolean
          description: Set this to true if you want to turn off this automation.
          example: true
        name:
          $ref: '#/components/schemas/LocalizedText'
        slug:
          type: string
          description: Unique & human readable id across current workspace's automations
        arguments:
          additionalProperties:
            $ref: '#/components/schemas/TypedArgument'
        validateArguments:
          type: boolean
        when:
          $ref: '#/components/schemas/When'
        labels:
          type: array
          items:
            type: string
            pattern: ^[0-9A-Za-z._:-]{2,60}$
        events:
          $ref: '#/components/schemas/ProcessedEvents'
        updatedAt:
          type: string
        createdAt:
          type: string
        updatedBy:
          type: string
        createdBy:
          type: string
        checksum:
          type: string
        do:
          $ref: '#/components/schemas/InstructionList'
        output:
          description: >-
            Automation result expression. Might be a variable reference, an
            object/array with variables inside ...
          example: '{{result}}'
        authorizations:
          type: object
          properties:
            action:
              type: string
    Page:
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/LocalizedText'
        description:
          $ref: '#/components/schemas/LocalizedText'
        workspaceId:
          type: string
        workspaceSlug:
          type: string
        id:
          type: string
        slug:
          type: string
        blocks:
          type: array
          items:
            type: object
            required:
              - slug
            properties:
              slug:
                type: string
              appInstance:
                type: string
              onInit:
                oneOf:
                  - type: string
                  - type: object
                    properties:
                      event:
                        type: string
                      payload:
                        $ref: '#/components/schemas/AnyValue'
              updateOn:
                type: string
              automation:
                oneOf:
                  - type: string
                  - type: object
                    properties:
                      slug:
                        type: string
                      payload:
                        $ref: '#/components/schemas/AnyValue'
            additionalProperties: true
        labels:
          type: array
          items:
            type: string
            pattern: ^[0-9A-Za-z._:-]{2,60}$
        events:
          $ref: '#/components/schemas/ProcessedEvents'
        createdBy:
          type: string
        updatedBy:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
        permissions:
          $ref: '#/components/schemas/PermissionsMap'
        customDomains:
          type: array
          items:
            type: string
        colorScheme:
          type: string
          enum:
            - auto
            - light
            - dark
        checksum:
          type: string
        favicon:
          type: string
        styles:
          type: string
        onInit:
          oneOf:
            - type: string
            - type: object
              properties:
                event:
                  type: string
                payload:
                  $ref: '#/components/schemas/AnyValue'
        updateOn:
          type: string
        notifyOn:
          type: string
        automation:
          oneOf:
            - type: string
            - type: object
              properties:
                slug:
                  type: string
                payload:
                  $ref: '#/components/schemas/AnyValue'
    DSUL:
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        name:
          type: string
          pattern: "^[0-9A-Za-zÀ-ÖØ-öø-ÿ ,.'-\_]{1,60}$"
        description:
          $ref: '#/components/schemas/LocalizedText'
        photo:
          type: string
        config:
          $ref: '#/components/schemas/Config'
        blocks:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Block'
        slug:
          type: string
        id:
          type: string
        labels:
          type: array
          items:
            type: string
            pattern: ^[0-9A-Za-z._:-]{2,60}$
        customDomains:
          type: array
          items:
            type: string
        registerWorkspace:
          type: boolean
          description: >-
            If true, make this workspace metadata available to all workspaces
            with this variable : {{global.workspacesRegistry[WORKSPACE_SLUG]}}
        repositories:
          type: object
          description: Remote versioning repositories
          additionalProperties:
            $ref: '#/components/schemas/WorkspaceRepository'
        platformRepositories:
          type: object
          description: Platform remote versioning repositories
          additionalProperties:
            $ref: '#/components/schemas/WorkspaceRepository'
        secrets:
          type: object
          additionalProperties: false
          properties:
            schema:
              additionalProperties:
                $ref: '#/components/schemas/TypedArgument'
        events:
          $ref: '#/components/schemas/WorkspaceEventsConfiguration'
        writeLock:
          $ref: '#/components/schemas/WorkspaceWriteLock'
    EmitAutocomplete:
      type: object
      additionalProperties:
        type: object
        properties:
          from:
            type: string
          path:
            type: string
          template:
            type: string
    TypedArgument:
      type: object
      properties:
        type:
          type: string
          enum:
            - string
            - number
            - object
            - array
            - boolean
            - localized:string
            - localized:number
            - localized:boolean
        format:
          type: string
        properties:
          additionalProperties:
            $ref: '#/components/schemas/TypedArgument'
        title:
          $ref: '#/components/schemas/LocalizedText'
        description:
          $ref: '#/components/schemas/LocalizedText'
        items:
          $ref: '#/components/schemas/TypedArgument'
        ui:widget:
          type: string
        ui:options:
          type: object
        secret:
          type: boolean
        event:
          type: boolean
    When:
      type: object
      anyOf:
        - required:
            - events
        - required:
            - schedules
        - required:
            - endpoint
        - {}
      properties:
        events:
          type: array
          items:
            type: string
          example:
            - prismeaiMessenger.event
        schedules:
          $ref: '#/components/schemas/Schedules'
        endpoint:
          oneOf:
            - type: boolean
              example: >-
                Set to true in order to activate HTTP endpoint. Slug will be
                trigger name by default
            - type: string
              example: Slug name
    InstructionList:
      type: array
      items:
        $ref: '#/components/schemas/Instruction'
    PermissionsMap:
      type: object
      additionalProperties:
        type: object
        properties:
          role:
            $ref: '#/components/schemas/Role'
          policies:
            $ref: '#/components/schemas/Policies'
    Config:
      type: object
      additionalProperties: false
      properties:
        schema:
          additionalProperties:
            $ref: '#/components/schemas/TypedArgument'
        block:
          type: string
        value: {}
    Block:
      type: object
      description: Block
      additionalProperties: false
      properties:
        description:
          $ref: '#/components/schemas/LocalizedText'
        name:
          $ref: '#/components/schemas/LocalizedText'
        photo:
          type: string
        url:
          type: string
          description: >-
            A block can be a javascript bundled file. Host it on the internet
            and put its url here.
          deprecated: true
        edit:
          $ref: '#/components/schemas/TypedArgument'
          deprecated: true
        block:
          type: string
          description: A block can extends another one by giving its name here
          deprecated: true
        config:
          $ref: '#/components/schemas/AnyValue'
          description: default config applied to the Block. Usefull for extended Blocks.
          deprecated: true
        automation:
          oneOf:
            - type: string
            - type: object
              properties:
                slug:
                  type: string
                payload:
                  $ref: '#/components/schemas/AnyValue'
        blocks:
          type: array
          items:
            type: object
            required:
              - slug
            properties:
              slug:
                type: string
              appInstance:
                type: string
              onInit:
                oneOf:
                  - type: string
                  - type: object
                    properties:
                      event:
                        type: string
                      payload:
                        $ref: '#/components/schemas/AnyValue'
              updateOn:
                type: string
              automation:
                oneOf:
                  - type: string
                  - type: object
                    properties:
                      slug:
                        type: string
                      payload:
                        $ref: '#/components/schemas/AnyValue'
            additionalProperties: true
        css:
          type: string
          description: Css applied to Block
        schema:
          $ref: '#/components/schemas/TypedArgument'
    WorkspaceRepository:
      type: object
      required:
        - name
        - config
      additionalProperties: false
      properties:
        name:
          type: string
        type:
          type: string
          enum:
            - git
            - archive
            - filesystem
        mode:
          type: string
          enum:
            - read-write
            - read-only
        config:
          anyOf:
            - $ref: '#/components/schemas/WorkspaceGitRepositoryConfig'
            - $ref: '#/components/schemas/WorkspaceFilesystemRepositoryConfig'
            - type: object
        groups:
          type: array
          description: >-
            Only for platform repositories fetched from the Platform workspaces
            ; indicates which groups can be pulled/pushed
          items:
            type: string
        pull:
          type: object
          properties:
            exclude:
              type: array
              items:
                type: object
                required:
                  - path
                properties:
                  path:
                    type: string
    WorkspaceEventsConfiguration:
      type: object
      additionalProperties: false
      properties:
        mapping:
          type: object
          additionalProperties: true
          description: >-
            Custom mapping which will be directly sent to underlying database
            (Elasticsearch/Opensearch)
        types:
          description: Custom configuration per event type
          additionalProperties:
            $ref: '#/components/schemas/WorkspaceEventConfiguration'
    WorkspaceWriteLock:
      type: object
      description: >-
        Lock preventing writes during versioning operations or unresolved merge
        conflicts
      additionalProperties: false
      properties:
        lockedAt:
          type: string
        lockedBy:
          type: string
          description: User ID who initiated the lock
        reason:
          type: string
          description: Reason for the lock (e.g., pull_in_progress, merge_conflict)
    Schedules:
      type: array
      items:
        type: string
      example:
        - 2021-12-25T00:00
        - '* * 1 * *'
    Instruction:
      anyOf:
        - $ref: '#/components/schemas/Emit'
        - $ref: '#/components/schemas/Wait'
        - $ref: '#/components/schemas/Set'
        - $ref: '#/components/schemas/Delete'
        - $ref: '#/components/schemas/Conditions'
        - $ref: '#/components/schemas/Repeat'
        - $ref: '#/components/schemas/All'
        - $ref: '#/components/schemas/Break'
        - $ref: '#/components/schemas/Fetch'
        - $ref: '#/components/schemas/Comment'
        - $ref: '#/components/schemas/RateLimit'
        - $ref: '#/components/schemas/Run'
        - type: object
          additionalProperties: true
          minProperties: 1
          maxProperties: 1
    Role:
      type: string
    Policies:
      properties:
        read:
          type: boolean
        write:
          type: boolean
        update:
          type: boolean
        create:
          type: boolean
        manage_permissions:
          type: boolean
    WorkspaceGitRepositoryConfig:
      type: object
      required:
        - url
        - branch
      properties:
        url:
          type: string
        branch:
          type: string
        dirpath:
          type: string
          description: >-
            Sub-directory path within the repository where the workspace is
            stored
        auth:
          type: object
          properties:
            user:
              type: string
            password:
              type: string
            sshkey:
              type: string
    WorkspaceFilesystemRepositoryConfig:
      type: object
      required:
        - dirpath
      properties:
        dirpath:
          type: string
          description: Absolute path to the directory containing workspace folders
    WorkspaceEventConfiguration:
      type: object
      additionalProperties: false
      properties:
        schema:
          additionalProperties:
            $ref: '#/components/schemas/TypedArgument'
    Emit:
      type: object
      required:
        - emit
      maxProperties: 1
      properties:
        emit:
          type: object
          required:
            - event
          properties:
            event:
              type: string
              example: prismeaiMessenger.message
            payload:
              $ref: '#/components/schemas/AnyValue'
            target:
              $ref: '#/components/schemas/PrismeEventTarget'
            private:
              type: boolean
            autocomplete:
              $ref: '#/components/schemas/EmitAutocomplete'
            options:
              $ref: '#/components/schemas/PrismeEventOptions'
    Wait:
      type: object
      required:
        - wait
      maxProperties: 1
      properties:
        wait:
          type: object
          required:
            - oneOf
          properties:
            oneOf:
              type: array
              items:
                type: object
                required:
                  - event
                properties:
                  event:
                    type: string
                    example: prismeaiMessenger.message
                  filters:
                    type: object
                    description: >-
                      Only match the next event fulfilling these filters.
                      Multiple filters will be joined with an 'AND' operator 
                    additionalProperties:
                      type: string
                    example:
                      automationSlug: someId
                      someObjectField.someNestedField: foo
                  cancelTriggers:
                    type: boolean
                    description: If true, do not send this event to the the usual triggers
            timeout:
              type: number
              description: >-
                After N seconds, timeout & outputs an empty result. Defaults to
                20
            output:
              type: string
              description: Will save the caught event inside this variable
              example: nameOfResultVariable
    Set:
      type: object
      required:
        - set
      maxProperties: 1
      properties:
        set:
          type: object
          required:
            - name
            - value
          properties:
            name:
              type: string
              description: >-
                Variable name, might be "foo", "session.sessionScopedFoo",
                "global.globalScopedFoo", "user.userScopedFoo", ...
            interface:
              type: string
              description: >-
                The ID of the schema form representing the structure of the
                value
            value:
              $ref: '#/components/schemas/AnyValue'
              description: variable value
            clone:
              type: boolean
              description: >-
                If true, will clone the provided object variable instead of a
                reference
            type:
              type: string
              enum:
                - replace
                - merge
                - push
              description: >-
                Choose merge in order to merge target variable with value. Value
                takes precedence.
    Delete:
      type: object
      required:
        - delete
      maxProperties: 1
      properties:
        delete:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: Variable name to remove
    Conditions:
      type: object
      required:
        - default
      properties:
        default:
          $ref: '#/components/schemas/InstructionList'
      additionalProperties:
        $ref: '#/components/schemas/InstructionList'
      minProperties: 2
    Repeat:
      type: object
      required:
        - repeat
      maxProperties: 1
      properties:
        repeat:
          type: object
          oneOf:
            - required:
                - 'on'
                - do
              properties:
                'on':
                  type: string
                do:
                  $ref: '#/components/schemas/InstructionList'
                  hidden: true
                until:
                  type: number
                batch:
                  $ref: '#/components/schemas/RepeatBatch'
            - required:
                - until
                - do
              properties:
                until:
                  type: number
                do:
                  $ref: '#/components/schemas/InstructionList'
                  hidden: true
                batch:
                  $ref: '#/components/schemas/RepeatBatch'
          description: One of "on" or "until" is required
    All:
      type: object
      required:
        - all
      maxProperties: 1
      properties:
        all:
          description: >-
            Execute each instruction in parallel. Pause current automation
            execution until all instructions are processed.
          type: array
          items:
            $ref: '#/components/schemas/Instruction'
    Break:
      type: object
      required:
        - break
      maxProperties: 1
      properties:
        break:
          description: >-
            Stop current automation execution. Have one option that allow a
            break to break all parent automations.
          type: object
          properties:
            scope:
              type: string
              enum:
                - all
                - automation
                - repeat
              description: >-
                The scope argument defines in which scope the break will take
                effect. It only breaks the current automation by default, it can
                also break all parent automations. More options might become
                available in the future.
            payload:
              type: object
              additionalProperties: true
              description: An optional payload
    Fetch:
      type: object
      required:
        - fetch
      maxProperties: 1
      properties:
        fetch:
          description: Send an HTTP request
          type: object
          required:
            - url
          properties:
            url:
              type: string
            method:
              type: string
              enum:
                - get
                - post
                - put
                - patch
                - delete
            headers:
              type: object
              additionalProperties:
                type: string
            prismeaiApiKey:
              type: object
              description: >-
                Only for requests towards prisme.ai API. Grants additional
                permissions using api keys
              properties:
                name:
                  type: string
                  description: >-
                    Use one of the DSUL Security defined api keys, referred by
                    its name.
            query:
              type: object
              description: Object defining querystring parameters
              additionalProperties:
                type: string
            body:
              $ref: '#/components/schemas/AnyValue'
              description: HTTP request body
            emitErrors:
              description: >-
                If HTTP response status code is 4xx or 5xx, emits a
                runtime.fetch.failed event by default
              type: boolean
              default: true
            multipart:
              description: Sends a multipart/form-data HTTP request
              type: array
              items:
                type: object
                required:
                  - fieldname
                  - value
                properties:
                  fieldname:
                    type: string
                  value:
                    type: string
                    description: Must be a string. Raw files must be given as base64
                  filename:
                    type: string
                    description: Filename is required when value is a base64 encoded file
                  contentType:
                    type: string
                    description: Optional MIME content-type
            allowSelfSignedCert:
              description: Allow self signed https certificates
              type: boolean
            output:
              type: string
              description: Name of the variable which will hold the result
            stream:
              type: object
              description: >-
                By default, SSE chunks are written to the output variable which
                can be read in real time using repeat instruction. Change this
                behaviour to emit chunks as individual events instead.
              required:
                - event
              properties:
                event:
                  type: string
                endChunk:
                  description: Allows to configure a custom ending chunk
                concatenate:
                  type: object
                  properties:
                    path:
                      type: string
                    throttle:
                      type: number
                payload:
                  type: object
                  additionalProperties: true
                target:
                  $ref: '#/components/schemas/PrismeEventTarget'
                options:
                  $ref: '#/components/schemas/PrismeEventOptions'
            outputMode:
              type: string
              default: body
              enum:
                - body
                - detailed_response
                - data_url
                - base64
            auth:
              type: object
              title: Authentication
              properties:
                prismeai:
                  type: object
                  title: Prisme.ai
                  properties:
                    forwardWorkspaceAuth:
                      type: boolean
                      description: >-
                        Enable in order to forward previously authenticated
                        workspace in this fetch
                awsv4:
                  type: object
                  additionalProperties: true
                  title: AWS Signature V4
                  properties:
                    accessKeyId:
                      type: string
                      title: Access Key ID
                    secretAccessKey:
                      type: string
                      title: Secret Access Key
                    service:
                      type: string
                    region:
                      type: string
    Comment:
      type: object
      required:
        - comment
      maxProperties: 1
      properties:
        comment:
          description: Do nothing but display a comment in instructions list
          type: string
    RateLimit:
      type: object
      required:
        - rateLimit
      maxProperties: 1
      properties:
        rateLimit:
          type: object
          required:
            - name
            - consumer
            - window
            - limit
          properties:
            name:
              type: string
              description: Name your rate limit
              example: ApiCall
            consumer:
              description: 'Consumer identifying key like user id, ip, ... '
              type: string
            window:
              type: number
              description: Fixed time window length in seconds.
            limit:
              type: number
              description: >-
                Maximum number of points which can be consumed over the given
                window
            consume:
              type: number
              description: Number of points consumed for 1 rateLimit call, defaults to 1
            break:
              type: boolean
              description: >-
                Set to false in order to return reached limit error instead of
                breaking current automation
            output:
              type: string
              description: Will save the caught event inside this variable
              example: nameOfResultVariable
    Run:
      type: object
      required:
        - run
      maxProperties: 1
      properties:
        run:
          type: object
          description: Generic run instruction to execute various function modules
          required:
            - module
            - function
          properties:
            module:
              type: string
            function:
              type: string
            parameters:
              $ref: '#/components/schemas/AnyValue'
            onError:
              type: string
              default: break
              enum:
                - break
                - emit
                - continue
    RepeatBatch:
      type: object
      title: Async
      description: Allows parallel execution in batches
      properties:
        size:
          type: number
          title: Batch size
          description: >-
            Number of iterations executed at the same time. Each batch is only
            started after all iterations from previous batch are done
        interval:
          type: number
          title: Interval
          description: Wait interval in ms between each batch
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key

````