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

# Run an automation

> Run a scheduled automation now. Channel automations run when a matching provider event arrives.



## OpenAPI

````yaml /2026-10-22/openapi.json post /automations/{automation_id}/run
openapi: 3.1.0
info:
  title: Motion
  version: '2026-10-22'
  description: >-
    Motion 2026-10-22 (legacy) REST API — original contract retained for
    existing integrations. Pass Motion-API-Version: 2026-10-22 (legacy) to
    select this contract explicitly.
servers:
  - url: https://api.motion.so/api/motion
security:
  - MotionApiKey: []
tags:
  - name: Projects
  - name: Exports
  - name: Library
  - name: Templates
  - name: Brand kits
  - name: Connectors
    description: Connect services and control the actions a project may use.
  - name: Automations
  - name: Social posting
  - name: Deprecated (/sessions)
    description: >-
      Earlier single-video endpoints kept callable for existing 2026-10-22
      integrations. Use Projects on 2026-11-19 for new integrations.
paths:
  /automations/{automation_id}/run:
    post:
      tags:
        - Automations
      summary: Run an automation
      description: >-
        Run a scheduled automation now. Channel automations run when a matching
        provider event arrives.
      operationId: run_automation
      parameters:
        - name: automation_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 200
          description: ID returned by list or create.
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            New UUID for each intentional run. Reuse the same UUID after a lost
            response to avoid duplicate work.
        - $ref: '#/components/parameters/MotionApiVersion'
      responses:
        '200':
          description: Existing invocation returned for a reused UUID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationInvocation'
              example:
                automation:
                  id: auto_01j9x4m8n9p0q1r2s3t4u5v6
                  name: Daily product update
                  enabled: true
                  prompt: >-
                    Create a 15-second 16:9 animated update summarizing the
                    latest release notes.
                  trigger:
                    type: schedule_recurring
                    platform: schedule
                    label: Every 24 hours
                    source: Schedule
                    interval_minutes: 1440
                  created_at: '2026-11-18T14:00:00Z'
                  updated_at: '2026-11-19T14:02:18Z'
                  next_run_at: '2026-11-20T14:00:00Z'
                  runs:
                    - id: run_01j9x5q2k7w8m4n3p6r9s1t2
                      status: completed
                      motion_agent_chat_id: 4f20dcdd-f63b-4898-97d6-2e05c0d37c78
                      queued_at: '2026-11-19T14:00:00Z'
                      started_at: '2026-11-19T14:00:03Z'
                      completed_at: '2026-11-19T14:02:18Z'
                      attempt: 1
                      result_summary: Created the daily product update video.
                      error: null
                  memory:
                    remember_processed_items: true
                    include_previous_runs: 5
                    compact_after_runs: 20
                  max_concurrent_runs: 1
                  max_runs_per_hour: 4
                run:
                  id: run_01j9x6a1b2c3d4e5f6g7h8j9
                  status: queued
                  motion_agent_chat_id: null
                  queued_at: '2026-11-19T15:00:00Z'
                  started_at: null
                  completed_at: null
                  attempt: 1
                  result_summary: null
                  error: null
                session:
                  id: sess_01j9x6a1b2c3d4e5f6g7h8j9
                  run_id: run_01j9x6a1b2c3d4e5f6g7h8j9
                  motion_agent_chat_id: null
                  status: queued
                deduplicated: true
        '202':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationInvocation'
              example:
                automation:
                  id: auto_01j9x4m8n9p0q1r2s3t4u5v6
                  name: Daily product update
                  enabled: true
                  prompt: >-
                    Create a 15-second 16:9 animated update summarizing the
                    latest release notes.
                  trigger:
                    type: schedule_recurring
                    platform: schedule
                    label: Every 24 hours
                    source: Schedule
                    interval_minutes: 1440
                  created_at: '2026-11-18T14:00:00Z'
                  updated_at: '2026-11-19T14:02:18Z'
                  next_run_at: '2026-11-20T14:00:00Z'
                  runs:
                    - id: run_01j9x5q2k7w8m4n3p6r9s1t2
                      status: completed
                      motion_agent_chat_id: 4f20dcdd-f63b-4898-97d6-2e05c0d37c78
                      queued_at: '2026-11-19T14:00:00Z'
                      started_at: '2026-11-19T14:00:03Z'
                      completed_at: '2026-11-19T14:02:18Z'
                      attempt: 1
                      result_summary: Created the daily product update video.
                      error: null
                  memory:
                    remember_processed_items: true
                    include_previous_runs: 5
                    compact_after_runs: 20
                  max_concurrent_runs: 1
                  max_runs_per_hour: 4
                run:
                  id: run_01j9x6a1b2c3d4e5f6g7h8j9
                  status: queued
                  motion_agent_chat_id: null
                  queued_at: '2026-11-19T15:00:00Z'
                  started_at: null
                  completed_at: null
                  attempt: 1
                  result_summary: null
                  error: null
                session:
                  id: sess_01j9x6a1b2c3d4e5f6g7h8j9
                  run_id: run_01j9x6a1b2c3d4e5f6g7h8j9
                  motion_agent_chat_id: null
                  status: queued
                deduplicated: false
        '400':
          description: Invalid input or cursor; read the error message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
        '401':
          description: Missing, invalid, or wrong-audience credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
        '403':
          description: Missing OAuth scope, account automation access, or engine access.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
        '404':
          description: >-
            Unavailable environment, or automation/run not owned by this
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
        '409':
          description: 'automation_paused: resume before running.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
        '503':
          description: Temporarily unavailable; retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationError'
      security:
        - MotionApiKey: []
        - MotionOAuth:
            - motion:automations:write
components:
  parameters:
    MotionApiVersion:
      name: Motion-API-Version
      in: header
      required: false
      description: >-
        Optional API version override for this request. When omitted, Motion
        uses the API version pinned to your API key or OAuth connection.
      schema:
        type: string
        enum:
          - '2026-10-22'
        default: '2026-10-22'
      example: '2026-10-22'
  schemas:
    AutomationInvocation:
      type: object
      properties:
        automation:
          $ref: '#/components/schemas/Automation'
        run:
          $ref: '#/components/schemas/AutomationRun'
        session:
          $ref: '#/components/schemas/AutomationSession'
        deduplicated:
          type: boolean
      required:
        - automation
        - run
        - session
        - deduplicated
      additionalProperties: false
    AutomationError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      additionalProperties: false
    Automation:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabled:
          type: boolean
        prompt:
          type: string
        trigger:
          type: object
          properties:
            type:
              type: string
              enum:
                - schedule_once
                - schedule_recurring
                - youtube_video_uploaded
                - youtube_stream_ended
                - youtube_channel_content
                - twitch_stream_ended
                - kick_stream_ended
                - website_changed
            platform:
              type: string
              enum:
                - schedule
                - youtube
                - twitch
                - kick
                - website
            source:
              type: string
          required:
            - type
            - platform
            - source
          additionalProperties: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        nextRunAt:
          type:
            - string
            - 'null'
          format: date-time
        runs:
          type: array
          items:
            $ref: '#/components/schemas/AutomationRun'
        memory:
          $ref: '#/components/schemas/AutomationMemory'
        connectorPolicy:
          $ref: '#/components/schemas/AutomationConnectorPolicy'
        maxConcurrentRuns:
          type: integer
        maxRunsPerHour:
          type: integer
      required:
        - id
        - name
        - enabled
        - prompt
        - trigger
        - createdAt
        - updatedAt
        - nextRunAt
        - runs
      additionalProperties: true
      description: >-
        Owner-scoped read view. Read responses can include additional saved
        context and history. Use the dedicated run-history endpoint for
        pagination. Read fields are not accepted as write inputs.
    AutomationRun:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - skipped
            - failed
            - blocked
        motionAgentChatId:
          type:
            - string
            - 'null'
          description: >-
            Null until a Motion chat is created. Open
            https://motion.so/agent?chat={motionAgentChatId} to inspect the run.
        queuedAt:
          type: string
          format: date-time
        startedAt:
          type:
            - string
            - 'null'
          format: date-time
        completedAt:
          type:
            - string
            - 'null'
          format: date-time
        attempt:
          type: integer
        resultSummary:
          type:
            - string
            - 'null'
        error:
          type:
            - string
            - 'null'
      required:
        - id
        - status
        - motionAgentChatId
        - queuedAt
      additionalProperties: true
      description: >-
        Read view can also include event context, logs, artifacts, and connector
        snapshots. An accepted or completed agent run is not proof of a
        downloadable video; inspect saved exports in its Motion chat.
    AutomationSession:
      type: object
      properties:
        id:
          type: string
        runId:
          type: string
        motionAgentChatId:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - skipped
            - failed
            - blocked
      required:
        - id
        - runId
        - motionAgentChatId
        - status
      additionalProperties: true
    AutomationMemory:
      type: object
      properties:
        rememberProcessedItems:
          type: boolean
        includePreviousRuns:
          type: integer
          minimum: 0
          maximum: 20
        compactAfterRuns:
          type: integer
          minimum: 5
          maximum: 100
      required:
        - rememberProcessedItems
        - includePreviousRuns
        - compactAfterRuns
      additionalProperties: false
    AutomationConnectorPolicy:
      type: object
      properties:
        mode:
          type: string
          enum:
            - none
            - fixed
            - conditional
        onUnavailable:
          type: string
          enum:
            - block
            - run_without
        grants:
          type: array
          maxItems: 6
          items:
            $ref: '#/components/schemas/AutomationConnectorGrant'
      required:
        - mode
        - onUnavailable
        - grants
      additionalProperties: false
      description: >-
        Uses existing connected accounts and permissions; this request cannot
        connect an account or grant access.
    AutomationConnectorGrant:
      type: object
      properties:
        connectorId:
          type: string
          enum:
            - github
            - notion
            - figma
            - google-drive
            - dropbox
            - getty
        access:
          type: string
          enum:
            - read
        resources:
          type: array
          maxItems: 50
          items:
            type: string
            minLength: 1
            maxLength: 2000
        condition:
          $ref: '#/components/schemas/AutomationConnectorCondition'
      required:
        - connectorId
        - access
        - resources
      additionalProperties: false
    AutomationConnectorCondition:
      type: object
      properties:
        eventTypes:
          type: array
          items:
            type: string
            enum:
              - schedule_once
              - schedule_recurring
              - youtube_video_uploaded
              - twitch_stream_ended
              - kick_stream_ended
        payloadField:
          type: string
          maxLength: 200
        equals:
          type: string
          maxLength: 2000
      required: []
      additionalProperties: false
  securitySchemes:
    MotionApiKey:
      type: http
      scheme: bearer
      description: >-
        A Motion API key. Access is limited to its stored organization,
        workspace, scopes and the creator’s current permissions.
    MotionOAuth:
      type: oauth2
      description: >-
        OAuth REST tokens use the full MCP audience, https://mcp.motion.so/mcp.
        Reauthorize existing connections to add scopes. Current workspace roles
        and resource permissions still apply.
      flows:
        authorizationCode:
          authorizationUrl: https://mcp.motion.so/oauth/authorize
          tokenUrl: https://mcp.motion.so/oauth/token
          scopes:
            motion:automations:read: Read automation definitions, capabilities, runs, and analytics.
            motion:automations:write: Create, edit, delete, invoke, and retry automations.
            motion:connectors:read: >-
              Read available services, your private organization connections and
              allowed actions without secrets.
            motion:connectors:write: >-
              Connect and disconnect your private accounts inside the credential
              organization workspace.
            motion:templates:read: Read and preview accessible templates.
            motion:templates:write: Create, edit, share, and archive prompt templates.
            motion:sessions:read: Read permitted chats, job status and saved exports.
            motion:sessions:write: >-
              Create and steer Motion projects using organization workspace
              credits.
            motion:assets:read: Find and read permitted media library assets.
            motion:brand-kits:read: Read permitted brand kits.
            motion:brand-kits:write: Create and edit brand kits within current app permissions.
            motion:social:read: Read authorized social accounts and posts.
            motion:social:write: >-
              Draft, submit, approve and cancel posts within current app
              permissions.
            motion:assets:write: Create and complete reusable media library uploads.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.