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

# Import SMS template to multiple automations

> Import the SMS template body of a marketplace listing into one or more automations owned by the caller, in a single Mongo transaction. Each target automation must be SMS-enabled; per-automation failures are returned in `failed[]` with a 207 partial-success status when at least one target imported cleanly.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/marketplace/{id}/import-to-automations
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/marketplace/{id}/import-to-automations:
    post:
      tags:
        - Marketplace
      summary: Import SMS template to multiple automations
      description: >-
        Import the SMS template body of a marketplace listing into one or more
        automations owned by the caller, in a single Mongo transaction. Each
        target automation must be SMS-enabled; per-automation failures are
        returned in `failed[]` with a 207 partial-success status when at least
        one target imported cleanly.
      operationId: import_template_to_automations
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportTemplateToAutomationsRequest'
      responses:
        '200':
          description: Template imported to all automations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplaceImportToAutomationsResponse'
        '207':
          description: Template imported to some automations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplaceImportToAutomationsResponse'
        '400':
          description: Validation failed or no automations imported
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplaceImportToAutomationsResponse'
        '404':
          description: Published template, user, or template content not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplaceErrorResponse'
        '500':
          description: Failed to import template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplaceErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ImportTemplateToAutomationsRequest:
      type: object
      properties:
        automationIds:
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 50
          description: >-
            Mongo ObjectIds of caller-owned automations to receive the template
            body; each must be SMS-enabled and is processed in a single Mongo
            transaction.
      required:
        - automationIds
      additionalProperties: true
      example:
        automationIds:
          - 5f7b1c2e8a1d4e0012c3b4a5
          - 6a8c2d3f9b1e5a0023d4c5b6
    MarketplaceImportToAutomationsResponse:
      type: object
      description: >-
        Mixed success/partial-success/all-failure envelope. HTTP 200 = all
        imported; HTTP 207 = some imported; HTTP 400 = none imported. Inspect
        `stats` and per-target `results[]` for detail.
      properties:
        success:
          type: boolean
        message:
          type: string
        results:
          type: array
          items:
            $ref: '#/components/schemas/MarketplaceImportAutomationResult'
        stats:
          type: object
          properties:
            total:
              type: integer
            successful:
              type: integer
            failed:
              type: integer
          required:
            - total
            - successful
            - failed
          additionalProperties: true
      required:
        - success
        - results
        - stats
      additionalProperties: true
      example:
        success: true
        message: Template imported to 2 of 3 automations
        results:
          - automationId: 64a1b2c3d4e5f6001234567a
            automationName: New lead — first reply
            success: true
            changes:
              smsEnabled: true
              phoneNumber: '+14165550100'
              message: Hi {{contact.firstName}}!
          - automationId: 64a1b2c3d4e5f6001234567b
            automationName: Tour follow-up
            success: false
            error: >-
              SMS notification already enabled and conflicts with existing
              settings
        stats:
          total: 3
          successful: 2
          failed: 1
    MarketplaceErrorResponse:
      type: object
      description: Generic error envelope returned by Marketplace endpoints.
      properties:
        error:
          type: string
        details:
          type: string
      required:
        - error
      additionalProperties: true
      example:
        error: Marketplace item not found
    MarketplaceImportAutomationResult:
      type: object
      description: Per-automation outcome from a template import.
      properties:
        automationId:
          type: string
        automationName:
          type: string
        success:
          type: boolean
        changes:
          type: object
          description: Applied changes when `success` is true.
          properties:
            smsEnabled:
              type: boolean
            phoneNumber:
              type: string
            message:
              type: string
          additionalProperties: true
        error:
          type: string
          description: Failure reason when `success` is false.
      required:
        - automationId
        - automationName
        - success
      additionalProperties: true
      example:
        automationId: 64a1b2c3d4e5f6001234567a
        automationName: New lead — first reply
        success: true
        changes:
          smsEnabled: true
          phoneNumber: '+14165550100'
          message: Hi {{contact.firstName}} — thanks for reaching out!
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````