---
title: "Bulk create assistant transfer rules"
method: POST
path: "/assistantTransferRules/bulk"
tags: ["assistantTransferRules"]
---

# Bulk create assistant transfer rules

`POST /assistantTransferRules/bulk`

## Request

- Base URL: `https://api.lumahealth.io/api/v2`
- URL: `https://api.lumahealth.io/api/v2/assistantTransferRules/bulk`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lumahealth/apis/rest-service/docs/assistantTransferRules/bulk/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates multiple AssistantTransferRules documents and syncs them with the AI service for intent routing.

This endpoint:
1. Creates AssistantTransferRules documents in MongoDB
2. Uses the created document _ids as departmentIds for intent routing sync
3. Syncs the intent routing table with the AI service
4. Rolls back created documents if sync fails

## Request body

- AssistantTransferRulesBulkRequest
  - `entries` object[], required: Array of transfer rule entries to create
    - `assistants` string[], required: Array of assistant IDs for this entry
    - `name` string, required: Name of the transfer rule (used for intent routing)
    - `metadata` object: Additional metadata
      - `city` string: City where the department is located
      - `state` string: State where the department is located
      - `zip` string: ZIP code for the department location
      - `address` string: Street address of the department
      - `suiteBuildingRoom` string: Suite, building, or room number
      - `specialty` string: Medical specialty of the department
      - `action` string: Action associated with the department
    - `enabled` boolean: Whether the transfer rule is enabled
    - `type` 'intent_routing' | 'rule_based', required: Type of transfer rule
    - `assistantNumbers` string[]: Array of outbound number IDs
    - `transferNumber` string, required: Phone number to transfer calls to
    - `transferMessage` string: Message played when transferring
    - `transferFailedMessage` string: Message played when transfer fails
    - `afterHoursEndCallMessage` string: Message played when office is closed
    - `timezone` string: Timezone for working hours (e.g., America/Los_Angeles)
    - `textPatientBackInHub` object: Configuration for texting patient back
      - `enabled` boolean: Whether text-back feature is enabled
      - `minutesBeforeClosingTime` integer: Minutes before closing to offer text-back option
    - `textPatientBackConfirmationSentMessage` string: Confirmation message sent when text-back is requested
    - `hubSmsTextPatientBackConfirmationSentMessage` string: SMS confirmation message sent via hub
    - `offerToTransferMessage` string: Message offering to transfer the caller
    - `offerToTextBackOrTransferMessage` string: Message offering text-back or transfer options
    - `offerToTextBackOrEndCallMessage` string: Message offering text-back or end call options
    - `officeClosedTransferNotAvailableOfferToTextBackMessage` string: Message when office is closed and transfer unavailable
    - `officeNearClosingTimeTransferNotAdvisedOfferToTextBackMessage` string: Message when office is near closing time
    - `workingHours` object[]: Working hours configuration for each day of the week
      - `earliest` object, required: Start time for the day
        - `hour` integer, required
        - `minute` integer, required
      - `latest` object, required: End time for the day
        - `hour` integer, required
        - `minute` integer, required
      - `dayOfWeek` integer, required: Day of week (0=Sunday, 6=Saturday)
  - `replaceAll` boolean: Whether to replace all existing entries in the intent routing table

## Response `200`

Successfully created transfer rules

- object
  - `createdRules` AssistantTransferRulesResponse[]
    - `_id` string: Unique identifier in Luma's database
    - `user` string: Organization ID
    - `deleted` integer: Soft delete timestamp (0 if not deleted)
    - `createdBy` string: ID of user who created this record
    - `updatedBy` string: ID of user who last updated this record
    - `createdAt` string, date-time: Timestamp when record was created
    - `updatedAt` string, date-time: Timestamp when record was last updated
    - `name` string: Name of the transfer rule (used for intent routing)
    - `metadata` object: Additional metadata
      - `city` string: City where the department is located
      - `state` string: State where the department is located
      - `zip` string: ZIP code for the department location
      - `address` string: Street address of the department
      - `suiteBuildingRoom` string: Suite, building, or room number
      - `specialty` string: Medical specialty of the department
      - `action` string: Action associated with the department
    - `enabled` boolean: Whether the transfer rule is enabled
    - `type` 'intent_routing' | 'rule_based': Type of transfer rule
    - `assistants` string[]: Array of assistant IDs
    - `assistantNumbers` string[]: Array of outbound number IDs
    - `transferNumber` string: Phone number to transfer calls to
    - `transferMessage` string: Message played when transferring
    - `transferFailedMessage` string: Message played when transfer fails
    - `afterHoursEndCallMessage` string: Message played when office is closed
    - `timezone` string: Timezone for working hours
    - `textPatientBackInHub` object: Configuration for texting patient back
      - `enabled` boolean: Whether text-back feature is enabled
      - `minutesBeforeClosingTime` integer: Minutes before closing to offer text-back option
    - `textPatientBackConfirmationSentMessage` string: Confirmation message sent when text-back is requested
    - `hubSmsTextPatientBackConfirmationSentMessage` string: SMS confirmation message sent via hub
    - `offerToTransferMessage` string: Message offering to transfer the caller
    - `offerToTextBackOrTransferMessage` string: Message offering text-back or transfer options
    - `offerToTextBackOrEndCallMessage` string: Message offering text-back or end call options
    - `officeClosedTransferNotAvailableOfferToTextBackMessage` string: Message when office is closed and transfer unavailable
    - `officeNearClosingTimeTransferNotAdvisedOfferToTextBackMessage` string: Message when office is near closing time
    - `workingHours` object[]: Working hours configuration for each day of the week
      - `earliest` object: Start time for the day
        - `hour` integer
        - `minute` integer
      - `latest` object: End time for the day
        - `hour` integer
        - `minute` integer
      - `dayOfWeek` integer: Day of week (0=Sunday, 6=Saturday)

## Other responses

- `400`: Bad request - missing entries, invalid entry data, or sync failed
- `401`: Not authenticated
- `403`: Access token does not have the required scope

---

[API](https://skmtc.dev/lumahealth/apis/rest-service.md) - [All operations](https://skmtc.dev/lumahealth/apis/rest-service/llms.txt) - [OpenAPI document](https://skmtc.dev/lumahealth/apis/rest-service/revisions/f19aeba84a26?raw)
