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

# Update Automation

> Update an automation



## OpenAPI

````yaml /api-reference/swagger.yml patch /v2/workspaces/{workspaceId}/automations/{automationSlug}
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.studio.prisme.ai
    description: Prisme.ai Cloud
  - url: https://{customDomain}
    description: Self-hosted Prisme.ai instance
    variables:
      customDomain:
        default: api.your-prisme-instance.com
        description: API hostname of your self-hosted Prisme.ai deployment
  - url: http://localhost:3001
    description: Local development
security:
  - BearerAuth: []
  - OrgApiKeyAuth: []
  - BearerAuth: []
    OrgApiKeyAuth: []
tags:
  - name: API Gateway
    description: >-
      Authentication, session management, SSO providers, and user profile
      endpoints.
  - name: Prisme.ai Workspaces
    description: >-
      CRUD operations for workspaces and their resources (pages, apps,
      automations, imports, variables).
  - name: Prisme.ai Runtime
    description: Execute workspace automations and manage their runtime lifecycle.
  - name: Prisme.ai Events
    description: Event ingestion, delivery, and subscription filtering across the platform.
  - name: Organizations
    description: >-
      Manage organizations, members, roles, invites, groups, and org-level
      service accounts.
  - name: Subscriptions
    description: >-
      Manage organization subscription plans and tier assignments (SuperAdmin
      only).
  - name: Secrets
    description: Read and patch encrypted key-value secrets scoped to a workspace.
  - name: ApiKeys
    description: Create, list, rotate, and validate workspace-scoped API keys.
  - name: Permissions
    description: >-
      Share or unshare resources (workspaces, pages, …) with users via roles or
      fine-grained rules.
  - name: Monitoring
    description: Platform readiness checks across services (SuperAdmin only).
  - name: AuthProviders
paths:
  /v2/workspaces/{workspaceId}/automations/{automationSlug}:
    patch:
      tags:
        - Prisme.ai Workspaces
      summary: Update Automation
      description: Update an automation
      operationId: updateAutomation
      parameters:
        - name: workspaceId
          in: path
          description: Workspace id
          required: true
          schema:
            type: string
        - name: automationSlug
          in: path
          description: Automation slug
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Automation'
      responses:
        '200':
          description: Success Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Automation'
        '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:
    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
      example:
        slug: send-welcome-email
        name:
          en: Send welcome email
          fr: Envoyer email de bienvenue
        description:
          en: Sends a welcome email when a user signs up
        arguments:
          userId:
            type: string
        do:
          - set:
              name: user.welcomed
              value: true
          - emit:
              event: user.welcomed
              payload:
                userId: '{{userId}}'
        output: '{{result}}'
    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
    LocalizedText:
      oneOf:
        - type: object
          additionalProperties:
            type: string
          example:
            fr: Bonjour
            en: Hello
        - type: string
          example: Bonjour
    TypedArgument:
      type: object
      properties:
        type:
          type: string
          enum:
            - string
            - number
            - object
            - array
            - boolean
            - localized:string
            - localized:number
            - localized:boolean
        format:
          type: string
        properties:
          additionalProperties:
            type: object
            description: >-
              Recursive reference to `TypedArgument` — nesting is truncated here
              to avoid the infinite expansion that crashes the API reference
              renderer.
        title:
          $ref: '#/components/schemas/LocalizedText'
        description:
          $ref: '#/components/schemas/LocalizedText'
        items:
          type: object
          description: >-
            Recursive reference to `TypedArgument` — nesting is truncated here
            to avoid the infinite expansion that crashes the API reference
            renderer.
        ui:widget:
          type: string
        ui:options:
          type: object
      example:
        type: string
        title:
          en: User ID
        description:
          en: The unique identifier of the user
        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
    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'
    InstructionList:
      type: array
      items:
        $ref: '#/components/schemas/Instruction'
      example:
        - set:
            name: user.welcomed
            value: true
        - emit:
            event: user.welcomed
            payload:
              userId: '{{userId}}'
    Schedules:
      type: array
      items:
        type: string
      example:
        - 2021-12-25T00:00
        - '* * 1 * *'
    EmitAutocomplete:
      type: object
      additionalProperties:
        type: object
        properties:
          from:
            type: string
          path:
            type: string
          template:
            type: string
    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
      example:
        set:
          name: user.welcomed
          value: true
    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:
          type: array
          items:
            type: object
          description: >-
            Recursive reference to `InstructionList` — nesting is truncated here
            to avoid the infinite expansion that crashes the API reference
            renderer.
      additionalProperties:
        type: array
        items:
          type: object
        description: >-
          Recursive reference to `InstructionList` — nesting is truncated here
          to avoid the infinite expansion that crashes the API reference
          renderer.
      minProperties: 2
    Repeat:
      type: object
      required:
        - repeat
      maxProperties: 1
      properties:
        repeat:
          type: object
          oneOf:
            - required:
                - 'on'
                - do
              properties:
                'on':
                  type: string
                do:
                  type: array
                  items:
                    type: object
                  description: >-
                    Recursive reference to `InstructionList` — nesting is
                    truncated here to avoid the infinite expansion that crashes
                    the API reference renderer.
                until:
                  type: number
                batch:
                  $ref: '#/components/schemas/RepeatBatch'
            - required:
                - until
                - do
              properties:
                until:
                  type: number
                do:
                  type: array
                  items:
                    type: object
                  description: >-
                    Recursive reference to `InstructionList` — nesting is
                    truncated here to avoid the infinite expansion that crashes
                    the API reference renderer.
                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:
            type: object
            description: >-
              Recursive reference to `Instruction` — nesting is truncated here
              to avoid the infinite expansion that crashes the API reference
              renderer.
    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
    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
    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
    OrgApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key

````