---
title: "Create an automation"
method: POST
path: "/api/public/organizations/{orgId}/automations"
tags: ["Automations"]
---

# Create an automation

`POST /api/public/organizations/{orgId}/automations`

## Request

- Base URL: `https://charts.basedash.com`
- URL: `https://charts.basedash.com/api/public/organizations/{orgId}/automations`
- Auth: HTTP bearer

Creates an automation for an organization. Requires admin access to the organization.

## Path parameters

- `orgId` string, required: Organization ID

## Request body

- CreateAutomationInput
  - `name` string, required: Automation name
  - `icon` string: Icon name
  - `color` string: Icon color
  - `instructions` string, required: Automation instructions
  - `active` boolean
  - `triggerType` 'MANUAL' | 'SCHEDULE' | 'DATA_CHANGE': Automation trigger type
  - `frequency` 'DAILY' | 'WEEKDAYS' | 'WEEKLY' | 'MONTHLY' | 'QUARTERLY': Schedule frequency
  - `preferredHour` integer: Preferred UTC hour
  - `preferredDayOfWeek` integer, nullable
  - `preferredDayOfMonth` integer, nullable
  - `triggerDatabaseConnectionId` string, nullable
  - `triggerSqlQuery` string
  - `slackChannel` string, nullable
  - `emailRecipients` string

## Response `201`

Automation created successfully

- PublicAutomationResponse
  - `data` PublicAutomation, required
    - `id` string, required: Automation ID
    - `organizationId` string, required: Organization ID
    - `name` string, required: Automation name
    - `icon` string, required: Automation icon name
    - `color` string, required: Automation icon color
    - `instructions` string, required: Automation instructions
    - `active` boolean, required: Whether the automation is enabled
    - `archivedAt` string, date-time, nullable, required: Archive timestamp, if archived
    - `trigger` PublicAutomationTrigger, required
      - `type` 'MANUAL' | 'SCHEDULE' | 'DATA_CHANGE', required: Automation trigger type
      - `frequency` 'DAILY' | 'WEEKDAYS' | 'WEEKLY' | 'MONTHLY' | 'QUARTERLY', required: Schedule frequency for scheduled automations
      - `preferredHour` integer, required: Preferred UTC hour for scheduled runs
      - `preferredDayOfWeek` integer, nullable, required: Preferred day of week for weekly schedules, where 0 is Sunday
      - `preferredDayOfMonth` integer, nullable, required: Preferred day of month for monthly schedules
      - `databaseConnectionId` string, nullable, required: Data source ID for data change triggers
      - `sqlQuery` string, required: SQL query for data change triggers
    - `notifications` PublicAutomationNotifications, required
      - `slackChannel` string, nullable, required: Slack channel for automation notifications
      - `emailRecipients` string, required: Comma-separated email recipients for automation notifications
    - `createdByMemberId` string, required: Member ID that created the automation
    - `createdAt` string, date-time, required: Creation timestamp
    - `updatedAt` string, date-time, required: Last update timestamp

## Other responses

- `400`: Bad request - Invalid JSON body or validation error
- `401`: Unauthorized - Missing or invalid API key
- `403`: Forbidden - Automations are disabled
- `404`: Not found - Organization not found or no admin access
- `429`: Rate limit exceeded - Too many requests
- `500`: Internal server error

---

[API](https://skmtc.dev/basedash/apis/basedash-public-api.md) - [All operations](https://skmtc.dev/basedash/apis/basedash-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/basedash/apis/basedash-public-api/revisions/efb9d40bc6f7?raw)
