---
title: "Create an automation"
method: POST
path: "/automations"
tags: ["Automations"]
---

# Create an automation

`POST /automations`

## Request

- Base URL: `https://api.parley.so/v1`
- URL: `https://api.parley.so/v1/automations`
- Auth: HTTP bearer

Create an automation: instructions Parley's assistant carries out whenever one of its triggers fires, as you, with nobody present. The automation is active as soon as it's created. Without a trigger it only runs when someone starts a run with POST /automations/{id}/runs.

## Request body

- object
  - `name` string, required: The automation name.
  - `description` string: A short summary of what the automation does.
  - `instructions` string, required: The prompt Parley's assistant carries out on every run, up to 20,000 characters. Nobody is there to answer questions during a run, so say what to check, what counts as worth reporting, and what the report should look like.
  - `triggers` union[]: What starts the automation on its own, such as [{ "type": "cron", "cron": "0 9 * * 1-5" }] for 9:00 AM on weekdays. At most 10. Leave it out for an automation that only runs when someone starts a run.
    - union: A trigger to add, such as { "type": "cron", "cron": "0 9 * * 1-5" } for 9:00 AM on weekdays, or { "type": "event", "event": "project.created" } for each new project.
      - object
        - `type` 'cron', required
        - `cron` string, required: A five-field cron expression (minute, hour, day of month, month, day of week), such as 0 9 * * 1-5 for 9:00 AM on weekdays or 30 16 * * 5 for 4:30 PM on Fridays. A trigger can fire at most once an hour, and macros such as @daily and a seconds field aren't supported.
        - `timezone` string: The IANA time zone the cron expression is read in, such as America/New_York. Defaults to your time zone in Parley.
      - object
        - `type` 'event', required
        - `event` 'project.created' | 'account.created' | 'contact.created', required: What happens in Parley to start a run: someone creates a project, an account, or a contact. Records that email and calendar sync create don't count.
  - `projectId` string: A project to run the automation in, which needs edit access to it. Leave it out for an automation that runs across the organization.

## Response `201`

Created.

- Automation
  - `id` string, required: The automation ID.
  - `name` string, required: The automation name.
  - `description` string, nullable, required: A short summary of what the automation does, or null.
  - `status` 'active' | 'paused', required: active: the automation runs when its triggers fire. paused: its triggers are on hold, and the automation only runs when someone starts a run.
  - `nextRunAt` string, date-time, nullable, required: When a trigger next starts a run, or null for an automation that is paused or has no scheduled trigger.
  - `project` ProjectRef, required: The project's type, ID, and name.
    - `type` 'project', required
    - `id` string, required: Its ID.
    - `name` string, required: The project name.
  - `lastRun` object, nullable, required: The most recent run, or null for an automation that has never run.
    - `id` string, required: The run ID.
    - `status` 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled' | 'timed_out', required: pending: queued and not yet started. running: in progress. succeeded, failed, canceled, and timed_out are final.
    - `startedAt` string, date-time, nullable, required: When the run started.
    - `endedAt` string, date-time, nullable, required: When the run finished.
  - `createdAt` string, date-time, required: When the automation was created.
  - `updatedAt` string, date-time, required: When the automation or its triggers were last changed.
  - `triggers` AutomationTrigger[], required: What starts the automation on its own, oldest first. Empty for an automation that only runs when someone starts a run.
    - union: Something that starts a run. cron: a schedule. event: something that happens in Parley. slack_message: a new top-level post in a Slack channel. slack_reaction: a reaction to a message in a Slack channel. More types will be added, so skip any type you do not recognize.
      - CronTrigger
        - `id` string, required: The trigger ID.
        - `type` 'cron', required
        - `cron` string, required: A five-field cron expression (minute, hour, day of month, month, day of week), such as 0 9 * * 1-5 for 9:00 AM on weekdays or 30 16 * * 5 for 4:30 PM on Fridays.
        - `timezone` string, required: The IANA time zone the cron expression is read in, such as America/New_York.
      - EventTrigger
        - `id` string, required: The trigger ID.
        - `type` 'event', required
        - `event` 'project.created' | 'account.created' | 'contact.created', required: What happens in Parley to start a run: someone creates a project, an account, or a contact. Records that email and calendar sync create don't count.
      - SlackMessageTrigger
        - `id` string, required: The trigger ID.
        - `type` 'slack_message', required
        - `channelId` string, required: The ID of the Slack channel the trigger watches.
        - `mentions` object[], required: Only posts that mention one of these people or user groups start a run. Empty for every new post.
          - `type` 'user' | 'user_group', required
          - `id` string, required: The Slack user or user group ID.
      - SlackReactionTrigger
        - `id` string, required: The trigger ID.
        - `type` 'slack_reaction', required
        - `channelId` string, required: The ID of the Slack channel the trigger watches.
        - `reaction` string, required: The emoji, such as white_check_mark, that starts a run when someone in the Slack workspace reacts with it.
  - `instructions` string, required: The automation's instructions: the prompt Parley's assistant carries out on every run.

## Other responses

- `400`: The request was invalid. VALIDATION_FAILED, INVALID_REFERENCE, INVALID_TRIGGER.
- `401`: Missing or invalid credentials. UNAUTHORIZED.
- `403`: You don't have permission. FORBIDDEN.
- `429`: Too many requests, or a usage limit was reached. TOO_MANY_REQUESTS.

---

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