Skip to main content
POST
/
automations
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
  "platform": "instagram",
  "name": "Spring promo",
  "triggers": [
    {
      "type": "comment_keyword",
      "postId": "17895695668004550",
      "keywords": ["INFO", "LINK"]
    }
  ],
  "actions": [
    {
      "type": "send_dm",
      "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com"
    }
  ]
}' \
-X POST https://api.ayrshare.com/api/automations
{
  "status": "success",
  "id": "auto_9xKp2Lm4nQ"
}

Documentation Index

Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Beta. See the Automations Overview for the full feature description, including the Beta status.
Create a new automation that fires one or more actions when any of its triggers matches. The automation activates immediately. See the Overview for the full catalog of triggers, actions, template variables, and limits. The connected Instagram account is derived server-side from the caller’s linked profile — do not pass accountId in the body; the request will be rejected as a validation error if you do. Pass a profileKey header to operate under a child profile.

Header Parameters

Body Parameters

platform
string
required
Target platform. Only instagram is supported in v1.
name
string
required
Short human-readable name. Used in the dashboard and activity logs.
description
string
Optional longer description.
triggers
array
required
One or more triggers (1–50). Each entry is a discriminated union on type. See Overview / Triggers for the full catalog.
comment_keyword trigger
{
  "type": "comment_keyword",
  "postId": "17895695668004550",       // required — Instagram media id
  "keywords": ["INFO", "LINK"]         // required — ≥1 entry, case-insensitive
}
story_reply trigger
{
  "type": "story_reply",
  "storyId": "17900000000000000"       // optional — scope to one story
}
dm_reaction trigger
{
  "type": "dm_reaction",
  "emoji": "❤️"                         // optional — scope to one emoji
}
dm_keyword trigger
{
  "type": "dm_keyword",
  "keywords": ["help", "support"]      // required — ≥1 entry, case-insensitive
}
actions
array
required
One or more actions (1–50). Each entry is a discriminated union on type. See Overview / Actions for the full catalog. Every action also accepts an optional top-level dedupWindowMinutes overriding the default 7-day per-recipient dedup window (0 to disable, max 525600).
send_dm action
{
  "type": "send_dm",
  "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com"
}
fire_webhook action
{
  "type": "fire_webhook"
  // POSTs to your account-level webhook URL (configured in the dashboard).
  // See Overview for the JSON payload shape.
}
send_email action
{
  "type": "send_email",
  "to": "alerts@example.com",
  "subject": "New {{platform}} engagement from @{{recipient_username}}",
  "message": "<p>{{recipient_username}} engaged with: {{comment_text}}</p>"
}
Action with per-action dedup override
{
  "type": "send_dm",
  "message": "Thanks {{recipient_username}}!",
  "dedupWindowMinutes": 1440           // 24h instead of the 7-day default
}
Platform compatibility. Each trigger and action declares which platforms it supports. The validator rejects the request when an entry’s type is not supported on the requested platform. All triggers and send_dm are currently Instagram-only; fire_webhook and send_email are platform-agnostic.
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
  "platform": "instagram",
  "name": "Spring promo",
  "triggers": [
    {
      "type": "comment_keyword",
      "postId": "17895695668004550",
      "keywords": ["INFO", "LINK"]
    }
  ],
  "actions": [
    {
      "type": "send_dm",
      "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com"
    }
  ]
}' \
-X POST https://api.ayrshare.com/api/automations
{
  "status": "success",
  "id": "auto_9xKp2Lm4nQ"
}