# Create an automation (/zh/growsocmed/docs/api-reference/automations/create-automation)

Create an automation (answers only what arrives after it is switched on)

POST /automations

```json
{
  "tags": [
    "Automations"
  ],
  "summary": "Create an automation",
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "account_id": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "kind": {
              "type": "string",
              "enum": [
                "comment_to_dm",
                "comment_reply",
                "dm_keyword",
                "default_reply",
                "comment_hide",
                "comment_like",
                "story_reply",
                "story_mention",
                "ice_breaker"
              ]
            },
            "trigger": {
              "type": "object",
              "properties": {
                "posts": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "all",
                        "next"
                      ]
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "minItems": 1,
                      "maxItems": 50
                    }
                  ],
                  "default": "all"
                },
                "match": {
                  "type": "string",
                  "enum": [
                    "any",
                    "contains",
                    "exact"
                  ],
                  "default": "contains"
                },
                "keywords": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "maxItems": 200,
                  "default": []
                },
                "includeReplies": {
                  "type": "boolean",
                  "default": false
                },
                "frequency": {
                  "type": "string",
                  "enum": [
                    "hour",
                    "day",
                    "week"
                  ]
                }
              }
            },
            "actions": {
              "type": "object",
              "properties": {
                "dmText": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "replyVariants": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "maxItems": 5
                },
                "agentId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "buttons": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2000,
                        "format": "uri"
                      }
                    },
                    "required": [
                      "title",
                      "url"
                    ]
                  },
                  "maxItems": 3
                },
                "trackClicks": {
                  "type": "boolean"
                },
                "requireFollow": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "askText": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 640
                    },
                    "buttonTitle": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 20
                    }
                  },
                  "required": [
                    "askText",
                    "buttonTitle"
                  ]
                },
                "heart": {
                  "type": "boolean"
                },
                "markAutomated": {
                  "type": "boolean"
                },
                "iceBreakers": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "question": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      "reply": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      }
                    },
                    "required": [
                      "question",
                      "reply"
                    ]
                  },
                  "minItems": 1,
                  "maxItems": 4
                }
              }
            },
            "delay": {
              "type": "string",
              "enum": [
                "fast",
                "natural",
                "relaxed"
              ],
              "default": "natural"
            },
            "once_per_person": {
              "type": "boolean",
              "default": true
            },
            "enabled": {
              "type": "boolean",
              "default": false
            }
          },
          "required": [
            "account_id",
            "name",
            "kind",
            "trigger",
            "actions"
          ]
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Created",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "automation": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "account_id": {
                    "type": "string"
                  },
                  "platform": {
                    "type": "string"
                  },
                  "account_username": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string"
                  },
                  "trigger": {
                    "type": "object",
                    "properties": {
                      "posts": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "all",
                              "next"
                            ]
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "minItems": 1,
                            "maxItems": 50
                          }
                        ],
                        "default": "all"
                      },
                      "match": {
                        "type": "string",
                        "enum": [
                          "any",
                          "contains",
                          "exact"
                        ],
                        "default": "contains"
                      },
                      "keywords": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "maxItems": 200,
                        "default": []
                      },
                      "includeReplies": {
                        "type": "boolean",
                        "default": false
                      },
                      "frequency": {
                        "type": "string",
                        "enum": [
                          "hour",
                          "day",
                          "week"
                        ]
                      }
                    }
                  },
                  "actions": {
                    "type": "object",
                    "properties": {
                      "dmText": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "replyVariants": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "maxItems": 5
                      },
                      "agentId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid"
                      },
                      "buttons": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "title",
                            "url"
                          ]
                        },
                        "maxItems": 3
                      },
                      "trackClicks": {
                        "type": "boolean"
                      },
                      "requireFollow": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "askText": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 640
                          },
                          "buttonTitle": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "askText",
                          "buttonTitle"
                        ]
                      },
                      "heart": {
                        "type": "boolean"
                      },
                      "markAutomated": {
                        "type": "boolean"
                      },
                      "iceBreakers": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "question": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "reply": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            }
                          },
                          "required": [
                            "question",
                            "reply"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 4
                      }
                    }
                  },
                  "delay": {
                    "type": "string"
                  },
                  "once_per_person": {
                    "type": "boolean"
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "enabled_at": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paused_until": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "stats": {
                    "type": "object",
                    "properties": {
                      "sent": {
                        "type": "number"
                      },
                      "skipped": {
                        "type": "number"
                      },
                      "failed": {
                        "type": "number"
                      },
                      "queued": {
                        "type": "number"
                      },
                      "clicks": {
                        "type": "number"
                      },
                      "follows": {
                        "type": "number"
                      },
                      "ctr": {
                        "type": [
                          "number",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "sent",
                      "skipped",
                      "failed",
                      "queued",
                      "clicks",
                      "follows",
                      "ctr"
                    ]
                  }
                },
                "required": [
                  "id",
                  "account_id",
                  "platform",
                  "account_username",
                  "name",
                  "kind",
                  "trigger",
                  "actions",
                  "delay",
                  "once_per_person",
                  "enabled",
                  "enabled_at",
                  "paused_until",
                  "stats"
                ]
              }
            },
            "required": [
              "automation"
            ]
          }
        }
      }
    }
  },
  "operationId": "create-automation",
  "description": "Create an automation (answers only what arrives after it is switched on)"
}
```