Mailtea Automation Runs API

The Automation Runs API from Mailtea — 3 operation(s) for automation runs.

GitHub OpenAPI

Operations 3

GET /v1/automations/{id}/runs List Automation Runs #
GET /v1/automations/{id}/runs/{runId} Retrieve Automation Run #
POST /v1/automations/{id}/runs/{runId}/cancel Cancel Automation Run #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/mailtea-app:mailtea-app-automation-runs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

mailtea-app-automation-runs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Mailtea Automation Runs API
  version: 0.24.0
  summary: Send transactional and marketing email, manage contacts and audiences, verify sending domains, render templates, and subscribe to webhook events.
  description: Every endpoint lives under `/v1` and takes a Bearer token (`mt_pat_…` personal access token, `mt_svc_…` service key, or `mt_test_…` test key) in the `Authorization` header. The required scopes are listed per operation. This document is generated from the API reference at https://docs.mailtea.app/docs/api-reference.
  termsOfService: https://mailtea.app/terms
  contact:
    name: Mailtea
    url: https://mailtea.app
    email: support@mailtea.app
  license:
    name: AGPL-3.0-only
    identifier: AGPL-3.0-only
servers:
- url: https://api.mailtea.app
  description: Mailtea cloud
tags:
- name: Automation Runs
paths:
  /v1/automations/{id}/runs:
    get:
      operationId: listAutomationRuns
      summary: List Automation Runs
      description: 'List an automation''s runs with cursor-based pagination and status filtering


        List the runs of one automation, newest first. The list view carries no graph and no step timeline — use Retrieve Automation Run for those. Results are paginated using cursor-based pagination.'
      tags:
      - Automation Runs
      externalDocs:
        url: https://docs.mailtea.app/docs/api-reference/automation-runs/list-automation-runs
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: publication_id
        in: query
        required: true
        description: The publication the automation belongs to.
        schema:
          type: string
      - name: status
        in: query
        required: false
        description: '**Comma-separated** list of run statuses, e.g. `scheduled,executing,waiting_event`. Any unrecognised value is a `400`.'
        schema:
          type: string
      - name: contact_id
        in: query
        required: false
        description: Only runs for this contact.
        schema:
          type: string
      - name: is_test
        in: query
        required: false
        description: Strictly `true` or `false`. Omit for both kinds. Anything else is a `400` — `1`, `yes` and `TRUE` are all rejected rather than guessed at.
        schema:
          type: string
      - name: limit
        in: query
        required: false
        description: Number of results per page. 1–100, default `20`.
        schema:
          type: number
      - name: after
        in: query
        required: false
        description: Pagination cursor from a previous response's `next_cursor`.
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    description: Always `"list"`.
                  data:
                    type: array
                    description: Array of run summary objects, newest first.
                    items:
                      type: object
                      properties:
                        object:
                          type: string
                          description: Always `"automation_run"`.
                        id:
                          type: string
                          description: Unique run identifier.
                        automation_id:
                          type: string
                          description: The automation this run belongs to.
                        publication_id:
                          type: string
                          description: The publication the run belongs to.
                        status:
                          type: string
                          description: '`scheduled`, `executing`, `waiting_event`, `completed`, `failed`, `canceled` or `exited`.'
                        contact:
                          type:
                          - object
                          - 'null'
                          description: '`{ "id", "email" }`, or `null` when the run was created without a contact. A **deleted** contact keeps its `id` with `email: null` — "run for a contact that is gone" and "run with no contact" are different facts.'
                        version:
                          type: number
                          description: The automation version this run is pinned to.
                        version_id:
                          type: string
                          description: Identifier of that version.
                        current_step_key:
                          type:
                          - string
                          - 'null'
                          description: Key of the step the run is on, or last was on.
                        current_step_label:
                          type:
                          - string
                          - 'null'
                          description: That step's label in the pinned version.
                        current_step_type:
                          type:
                          - string
                          - 'null'
                          description: That step's type.
                        is_test:
                          type: boolean
                          description: Whether this run came from [Test Automation](/docs/api-reference/automations/test-automation). Test runs are excluded from every metric.
                        exit_reason:
                          type:
                          - string
                          - 'null'
                          description: Why the run left early, e.g. `contact_unsubscribed`, `contact_suppressed`, `contact_deleted`, `automation_paused`, `automation_archived`, `canceled_by_operator`. `null` while the run is live or when it completed normally.
                        started_at:
                          type: string
                          description: ISO 8601 start timestamp.
                        completed_at:
                          type:
                          - string
                          - 'null'
                          description: ISO 8601 end timestamp, or `null` while the run is live.
                        created_at:
                          type: string
                          description: ISO 8601 creation timestamp.
                  has_more:
                    type: boolean
                    description: Whether additional pages exist.
                  next_cursor:
                    type: string
                    description: Cursor for the next page. Only present when `has_more` is `true`.
              example:
                object: list
                data:
                - object: automation_run
                  id: run_abc123
                  automation_id: aut_abc123
                  publication_id: pub_abc123
                  status: scheduled
                  contact:
                    id: con_abc123
                    email: reader@example.com
                  version: 4
                  version_id: autv_mno345
                  current_step_key: wait_an_hour
                  current_step_label: Wait one hour
                  current_step_type: delay
                  is_test: false
                  exit_reason: null
                  started_at: '2026-07-26T09:00:00.000Z'
                  completed_at: null
                  created_at: '2026-07-26T09:00:00.000Z'
                - object: automation_run
                  id: run_def456
                  automation_id: aut_abc123
                  publication_id: pub_abc123
                  status: exited
                  contact:
                    id: con_def456
                    email: null
                  version: 3
                  version_id: autv_ghi789
                  current_step_key: welcome
                  current_step_label: Send the welcome email
                  current_step_type: send_email
                  is_test: false
                  exit_reason: contact_unsubscribed
                  started_at: '2026-07-25T14:00:00.000Z'
                  completed_at: '2026-07-25T14:02:00.000Z'
                  created_at: '2026-07-25T14:00:00.000Z'
                has_more: false
        '400':
          description: Missing required `publication_id` query parameter, an unrecognised value in the `status` list, or an `is_test` that is not exactly `true` or `false`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized — missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — publication not owned by your organization, or token scoped to a different publication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Automation not found, or publication not found. The parent is checked first, so another tenant's automation id is a `404` rather than an empty list that would read as "this automation has no runs".
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth:
        - automations:read
      x-mailtea-scopes:
      - automations:read
  /v1/automations/{id}/runs/{runId}:
    get:
      operationId: retrieveAutomationRun
      summary: Retrieve Automation Run
      description: 'Retrieve one run with its pinned graph, step timeline and waiting state


        Retrieve one run. The response is **self-contained**: it carries the graph the run is pinned to, the ordered step timeline, and the current waiting state, so a replay can be rendered from this one call. The graph returned here is the run''s version, never the live one — see Automation Runs for why that matters.'
      tags:
      - Automation Runs
      externalDocs:
        url: https://docs.mailtea.app/docs/api-reference/automation-runs/retrieve-automation-run
      parameters:
      - name: runId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: publication_id
        in: query
        required: true
        description: The publication the automation belongs to.
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    description: Always `"automation_run"`.
                  id:
                    type: string
                    description: Unique run identifier.
                  automation_id:
                    type: string
                    description: The automation this run belongs to.
                  publication_id:
                    type: string
                    description: The publication the run belongs to.
                  status:
                    type: string
                    description: '`scheduled`, `executing`, `waiting_event`, `completed`, `failed`, `canceled` or `exited`.'
                  contact:
                    type:
                    - object
                    - 'null'
                    description: '`{ "id", "email" }`. A deleted contact keeps its `id` with `email: null`; `null` means the run has no contact at all.'
                  version:
                    type: number
                    description: The automation version this run is pinned to.
                  version_id:
                    type: string
                    description: Identifier of that version.
                  steps:
                    type: array
                    description: The **pinned** graph's steps — what this run actually traverses, which may differ from the live automation.
                  connections:
                    type: array
                    description: The pinned graph's connections.
                  current_step_key:
                    type:
                    - string
                    - 'null'
                    description: Key of the step the run is on, or last was on.
                  current_step_label:
                    type:
                    - string
                    - 'null'
                    description: That step's label in the pinned version.
                  is_test:
                    type: boolean
                    description: Whether this run came from [Test Automation](/docs/api-reference/automations/test-automation).
                  exit_reason:
                    type:
                    - string
                    - 'null'
                    description: Why the run left early, e.g. `contact_unsubscribed`, `automation_archived`, `canceled_by_operator`.
                  step_budget_used:
                    type: number
                    description: Steps consumed against the run's step budget — the loop guard.
                  attempts:
                    type: number
                    description: Retries of the current step.
                  last_error:
                    type:
                    - string
                    - 'null'
                    description: The most recent error message, or `null`.
                  waiting:
                    type: object
                    description: Always present, both members nullable. A terminal run has both `null`.
                    properties:
                      resume_at:
                        type:
                        - string
                        - 'null'
                        description: ISO 8601. The wake time on a `scheduled` run sleeping in a `delay`; the **timeout** deadline on a `waiting_event` run.
                      waiting_event_name:
                        type:
                        - string
                        - 'null'
                        description: Event name when parked on a `wait_for_event`. Only a `waiting_event` run ever has one — see [`scheduled` vs `waiting_event`](/docs/api-reference/automation-runs#scheduled-vs-waiting_event).
                  step_runs:
                    type: array
                    description: The ordered timeline, one entry per completed step attempt.
                    items:
                      type: object
                      properties:
                        object:
                          type: string
                          description: Always `"automation_step_run"`.
                        id:
                          type: string
                          description: Step-run identifier.
                        step_key:
                          type: string
                          description: The step this entry is for.
                        step_type:
                          type: string
                          description: The step's type.
                        label:
                          type:
                          - string
                          - 'null'
                          description: The step's label in the pinned version.
                        status:
                          type: string
                          description: '`succeeded`, `failed` or `skipped`.'
                        output:
                          type: object
                          description: Allowlisted projection of what the step recorded. See [Redacted step output](/docs/api-reference/automation-runs#redacted-step-output).
                        output_redacted:
                          type: boolean
                          description: '`true` when the endpoint withheld part of the step''s output.'
                        error:
                          type:
                          - string
                          - 'null'
                          description: Error message when the step failed.
                        attempts:
                          type: number
                          description: How many attempts this step took.
                        started_at:
                          type: string
                          description: ISO 8601 start timestamp.
                        completed_at:
                          type: string
                          description: ISO 8601 end timestamp. Can be **later than the run's own `completed_at`** — see [`recorded_after_run_ended`](/docs/api-reference/automation-runs#a-step-that-finished-after-its-run).
                  started_at:
                    type: string
                    description: ISO 8601 run start timestamp.
                  completed_at:
                    type:
                    - string
                    - 'null'
                    description: ISO 8601 run end timestamp, or `null` while live.
                  created_at:
                    type: string
                    description: ISO 8601 creation timestamp.
                  updated_at:
                    type: string
                    description: ISO 8601 last-updated timestamp.
              example:
                object: automation_run
                id: run_abc123
                automation_id: aut_abc123
                publication_id: pub_abc123
                status: scheduled
                contact:
                  id: con_abc123
                  email: reader@example.com
                version: 3
                version_id: autv_ghi789
                steps:
                - key: trigger
                  type: trigger
                  label: New subscriber
                  config:
                    trigger_type: contact.subscribed
                - key: wait_a_day
                  type: delay
                  label: Wait one day
                  config:
                    duration: 1
                    unit: days
                - key: welcome
                  type: send_email
                  label: Send the welcome email
                  config:
                    template_id: tmpl_abc123
                connections:
                - from: trigger
                  to: wait_a_day
                  branch: next
                - from: wait_a_day
                  to: welcome
                  branch: next
                current_step_key: wait_a_day
                current_step_label: Wait one day
                is_test: false
                exit_reason: null
                step_budget_used: 2
                attempts: 0
                last_error: null
                waiting:
                  resume_at: '2026-07-27T09:00:00.000Z'
                  waiting_event_name: null
                step_runs:
                - object: automation_step_run
                  id: srun_abc123
                  step_key: trigger
                  step_type: trigger
                  label: New subscriber
                  status: succeeded
                  output: {}
                  output_redacted: false
                  error: null
                  attempts: 1
                  started_at: '2026-07-26T09:00:00.000Z'
                  completed_at: '2026-07-26T09:00:00.120Z'
                - object: automation_step_run
                  id: srun_def456
                  step_key: wait_a_day
                  step_type: delay
                  label: Wait one day
                  status: succeeded
                  output:
                    resume_at: '2026-07-27T09:00:00.000Z'
                  output_redacted: false
                  error: null
                  attempts: 1
                  started_at: '2026-07-26T09:00:00.130Z'
                  completed_at: '2026-07-26T09:00:00.140Z'
                started_at: '2026-07-26T09:00:00.000Z'
                completed_at: null
                created_at: '2026-07-26T09:00:00.000Z'
                updated_at: '2026-07-26T09:00:00.140Z'
        '400':
          description: Missing required `publication_id` query parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized — missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — publication not owned by your organization, or token scoped to a different publication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Run not found under this automation, or publication not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth:
        - automations:read
      x-mailtea-scopes:
      - automations:read
  /v1/automations/{id}/runs/{runId}/cancel:
    post:
      operationId: cancelAutomationRun
      summary: Cancel Automation Run
      description: 'Stop one in-flight automation run


        Stop a single in-flight run. The run''s status becomes `canceled` with `exit_reason: "canceled_by_operator"`, and no further steps execute. **A canceled run cannot be resumed** — there is no un-cancel.


        Only live runs can be canceled. A run that has already reached `completed`, `failed`, `canceled` or `exited` is a `409`.


        To stop every run of an automation at once, use `cancel_runs` on Pause Automation or Archive Automation.'
      tags:
      - Automation Runs
      externalDocs:
        url: https://docs.mailtea.app/docs/api-reference/automation-runs/cancel-automation-run
      parameters:
      - name: runId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: publication_id
        in: query
        required: true
        description: The publication the automation belongs to.
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
              example:
                object: automation_run
                id: run_abc123
                automation_id: aut_abc123
                publication_id: pub_abc123
                status: canceled
                contact:
                  id: con_abc123
                  email: reader@example.com
                version: 3
                version_id: autv_ghi789
                steps:
                - key: trigger
                  type: trigger
                  label: New subscriber
                  config:
                    trigger_type: contact.subscribed
                - key: wait_a_day
                  type: delay
                  label: Wait one day
                  config:
                    duration: 1
                    unit: days
                - key: welcome
                  type: send_email
                  label: Send the welcome email
                  config:
                    template_id: tmpl_abc123
                connections:
                - from: trigger
                  to: wait_a_day
                  branch: next
                - from: wait_a_day
                  to: welcome
                  branch: next
                current_step_key: wait_a_day
                current_step_label: Wait one day
                is_test: false
                exit_reason: canceled_by_operator
                step_budget_used: 2
                attempts: 0
                last_error: null
                waiting:
                  resume_at: null
                  waiting_event_name: null
                step_runs:
                - object: automation_step_run
                  id: srun_abc123
                  step_key: trigger
                  step_type: trigger
                  label: New subscriber
                  status: succeeded
                  output: {}
                  output_redacted: false
                  error: null
                  attempts: 1
                  started_at: '2026-07-26T09:00:00.000Z'
                  completed_at: '2026-07-26T09:00:00.120Z'
                - object: automation_step_run
                  id: srun_def456
                  step_key: wait_a_day
                  step_type: delay
                  label: Wait one day
                  status: succeeded
                  output:
                    resume_at: '2026-07-27T09:00:00.000Z'
                  output_redacted: false
                  error: null
                  attempts: 1
                  started_at: '2026-07-26T09:00:00.130Z'
                  completed_at: '2026-07-26T09:00:00.140Z'
                started_at: '2026-07-26T09:00:00.000Z'
                completed_at: '2026-07-26T12:30:00.000Z'
                created_at: '2026-07-26T09:00:00.000Z'
                updated_at: '2026-07-26T12:30:00.000Z'
        '400':
          description: Missing required `publication_id` query parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized — missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — insufficient permissions, publication not owned by your organization, or token scoped to a different publication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Run not found under this automation, or publication not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '`run_terminal` — the run already ended. The body carries the `status` it ended in.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth:
        - automations:write
      x-mailtea-scopes:
      - automations:write
components:
  schemas:
    Error:
      type: object
      description: Every error body carries `error`; validation failures add `details` and some refusals add a machine-readable `code`.
      properties:
        error:
          type: string
        code:
          type: string
        details:
          type: array
          items:
            type: object
      required:
      - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A Mailtea API key. Scopes such as `contacts:write` are properties of the key, chosen when it is created; each operation lists the scope it needs under `x-mailtea-scopes`. See https://docs.mailtea.app/docs/api-reference/authentication.
externalDocs:
  description: API reference
  url: https://docs.mailtea.app/docs/api-reference