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

# Change workflow mailing list

> Change a workflow's mailing list.

Use this endpoint to change a workflow's mailing list.

Make a dry run request using `dryRun: true`.

If queued contacts would be removed from the workflow due to the change of mailing list, Loops returns with `"status": "queuedContactsFound"` instead of applying the change. Retry with `queuedContactPolicy: "discard"` to apply the change and discard those contacts.


## OpenAPI

````yaml /openapi.json post /v1/workflows/{workflowId}/mailing-list
openapi: 3.1.0
info:
  title: Loops OpenAPI Spec
  description: This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
  version: 1.20.0
servers:
  - url: https://app.loops.so/api
security: []
tags:
  - name: API key
  - name: Audience segments
    description: View audience segments
  - name: Campaigns
    description: Create and manage email campaigns
  - name: Campaign groups
    description: Organize campaigns into groups
  - name: Components
    description: View email components
  - name: Configuration
    description: View configuration settings
  - name: Contacts
    description: Manage contacts in your audience
  - name: Contact properties
    description: Manage contact properties
  - name: Email messages
    description: Manage email message content for campaigns
  - name: Events
    description: Trigger workflows with events
  - name: Event patterns
    description: View workflow event patterns
  - name: Mailing lists
    description: View mailing lists
  - name: Themes
    description: View email themes
  - name: Transactional emails
    description: Create, manage, and send transactional emails
  - name: Transactional groups
    description: Organize transactional emails into groups
  - name: Uploads
    description: Upload image assets
  - name: Workflows
    description: View and mutate workflow graphs
  - name: Workflow nodes
    description: View and mutate workflow nodes
paths:
  /v1/workflows/{workflowId}/mailing-list:
    parameters:
      - name: workflowId
        in: path
        required: true
        description: The ID of the workflow.
        schema:
          type: string
    post:
      tags:
        - Workflows
      summary: Change workflow mailing list
      description: >-
        Dry run or apply a workflow mailing list change. If queued contacts
        would be removed from the workflow due to the change of mailing list,
        Loops returns with `"status": "queuedContactsFound"` instead of applying
        the change. Retry with `queuedContactPolicy: "discard"` to apply the
        change and discard those contacts.
      operationId: changeWorkflowMailingList
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeWorkflowMailingListRequest'
      responses:
        '200':
          description: Mailing-list dry run, queued-contact warning, or update result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeWorkflowMailingListResponse'
        '400':
          description: Invalid `workflowId`, request body, mailing list, or workflow state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowFailureResponse'
        '401':
          description: Invalid API key or workflow API not enabled for this team.
        '404':
          description: Workflow not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowFailureResponse'
        '405':
          description: Wrong HTTP request method.
        '409':
          description: '`expectedRevisionId` is stale.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowFailureResponse'
      security:
        - apiKey: []
components:
  schemas:
    ChangeWorkflowMailingListRequest:
      type: object
      properties:
        expectedRevisionId:
          $ref: '#/components/schemas/WorkflowExpectedRevisionId'
        mailingListId:
          type:
            - string
            - 'null'
          description: >-
            The mailing list to use for the workflow. When assigning a mailing
            list, queued contacts excluded by the new list can return
            `queuedContactsFound`; retry with `queuedContactPolicy: "discard"`
            to apply the change and discard those contacts. Use `null` to clear
            the workflow mailing list; clearing does not discard queued
            contacts.
        dryRun:
          type: boolean
          description: >-
            If `true`, the request will be validated but the workflow will not
            be modified.
        queuedContactPolicy:
          $ref: '#/components/schemas/WorkflowQueuedContactPolicy'
      required:
        - expectedRevisionId
        - mailingListId
      additionalProperties: false
    ChangeWorkflowMailingListResponse:
      oneOf:
        - $ref: '#/components/schemas/WorkflowMailingListPreview'
        - $ref: '#/components/schemas/WorkflowMailingListUpdatedResponse'
    WorkflowFailureResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
    WorkflowExpectedRevisionId:
      type: string
      description: >-
        The workflow revision token returned by the latest workflow read or
        mutation. Mutations reject stale values.
    WorkflowQueuedContactPolicy:
      type: string
      enum:
        - fail
        - discard
      default: fail
      description: >-
        `fail` returns queued-contact impact instead of mutating. `discard`
        confirms that matching queued contacts should be discarded. Defaults to
        `fail` when omitted.
    WorkflowMailingListPreview:
      type: object
      properties:
        status:
          type: string
          enum:
            - dryRun
            - queuedContactsFound
        mailingListId:
          type:
            - string
            - 'null'
        queuedContactCount:
          type: number
          description: >-
            The number of queued contacts that would be removed from the
            workflow due to the mailing list changing.
        queuedContactLimitReached:
          type: boolean
          description: >-
            Whether the queued contact limit would be reached if the mailing
            list was changed.
      required:
        - status
        - mailingListId
        - queuedContactCount
        - queuedContactLimitReached
    WorkflowMailingListUpdatedResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - updated
        mailingListId:
          type:
            - string
            - 'null'
        workflowRevisionId:
          $ref: '#/components/schemas/WorkflowRevisionId'
        queuedContactCount:
          type: number
          description: >-
            The number of queued contacts that were removed from the workflow
            due to the mailing list changing.
        queuedContactLimitReached:
          type: boolean
          description: >-
            Whether the queued contact limit was reached due to the mailing list
            changing.
      required:
        - status
        - mailingListId
        - workflowRevisionId
        - queuedContactCount
        - queuedContactLimitReached
    WorkflowRevisionId:
      type:
        - string
      description: >-
        The current workflow revision token. Pass the latest value as
        `expectedRevisionId` on the next workflow mutation.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````