> For the complete documentation index, see [llms.txt](https://help.blotato.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blotato.com/api/openapi-reference/automations.md).

# Automations

Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account.

## List DM automations

> Lists the current user's DM automations, ordered by creation time (most recent first). Supports cursor-based pagination.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations":{"get":{"summary":"List DM automations","tags":["automations"],"description":"Lists the current user's DM automations, ordered by creation time (most recent first). Supports cursor-based pagination.","parameters":[{"schema":{"minimum":1,"maximum":250,"default":50,"type":"integer"},"in":"query","name":"limit","required":false,"description":"Maximum number of DM automations to return. Defaults to 50."},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false,"description":"Opaque cursor returned by a previous call. Pass it to fetch the next page."}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"description":"List of DM automations","type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"createdAt":{"type":"string"},"dmMessage":{"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"id":{"type":"string"},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"publishedVersionId":{"type":"string","nullable":true},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}]},"updatedAt":{"type":"string"},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"]}},"required":["accountId","buttons","createdAt","dmMessage","id","isActive","name","platform","publishedVersionId","target","updatedAt"]}},"cursor":{"description":"Cursor for the next page. Absent when there are no more DM automations.","type":"string"}},"required":["items"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## Create a DM automation

> Creates a DM automation: when its trigger fires it sends one direct message (text plus up to 3 link buttons). Set \`followGate\` (Instagram only) to gate that message behind a follow check, and \`emailGate\` to gate it behind the contact replying with an email address. Set \`webhook\` to call an external endpoint once the message is sent; its payload carries the run's contact and identifiers.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations":{"post":{"summary":"Create a DM automation","tags":["automations"],"description":"Creates a DM automation: when its trigger fires it sends one direct message (text plus up to 3 link buttons). Set `followGate` (Instagram only) to gate that message behind a follow check, and `emailGate` to gate it behind the contact replying with an email address. Set `webhook` to call an external endpoint once the message is sent; its payload carries the run's contact and identifiers.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"dmMessage":{"minLength":1,"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"],"nullable":true},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"],"nullable":true},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}],"nullable":true},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"],"nullable":true}},"required":["accountId","buttons","dmMessage","name","platform","target"]}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"flow":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"createdAt":{"type":"string"},"dmMessage":{"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"id":{"type":"string"},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"publishedVersionId":{"type":"string","nullable":true},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}]},"updatedAt":{"type":"string"},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"]}},"required":["accountId","buttons","createdAt","dmMessage","id","isActive","name","platform","publishedVersionId","target","updatedAt"]}},"required":["flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"description":"Validation error","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Validation error","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## Get a DM automation

> Fetches a single DM automation by id, including its trigger and the message it sends.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}":{"get":{"summary":"Get a DM automation","tags":["automations"],"description":"Fetches a single DM automation by id, including its trigger and the message it sends.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"flow":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"createdAt":{"type":"string"},"dmMessage":{"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"id":{"type":"string"},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"publishedVersionId":{"type":"string","nullable":true},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}]},"updatedAt":{"type":"string"},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"]}},"required":["accountId","buttons","createdAt","dmMessage","id","isActive","name","platform","publishedVersionId","target","updatedAt"]}},"required":["flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## Delete a DM automation

> Archives a DM automation so its trigger stops listening and it no longer fires. Runs already in flight are unaffected.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}":{"delete":{"summary":"Delete a DM automation","tags":["automations"],"description":"Archives a DM automation so its trigger stops listening and it no longer fires. Runs already in flight are unaffected.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"flow":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"createdAt":{"type":"string"},"dmMessage":{"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"id":{"type":"string"},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"publishedVersionId":{"type":"string","nullable":true},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}]},"updatedAt":{"type":"string"},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"]}},"required":["accountId","buttons","createdAt","dmMessage","id","isActive","name","platform","publishedVersionId","target","updatedAt"]}},"required":["flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## Update a DM automation

> Updates a DM automation. Each field present in the patch replaces that field; omitted fields are left unchanged. Pass \`null\` for \`emailGate\`, \`followGate\`, \`trigger\`, or \`webhook\` to remove it.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}":{"patch":{"summary":"Update a DM automation","tags":["automations"],"description":"Updates a DM automation. Each field present in the patch replaces that field; omitted fields are left unchanged. Pass `null` for `emailGate`, `followGate`, `trigger`, or `webhook` to remove it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"patch":{"type":"object","properties":{"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"dmMessage":{"minLength":1,"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"],"nullable":true},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"],"nullable":true},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}],"nullable":true},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"],"nullable":true}}}},"required":["patch"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"flow":{"type":"object","properties":{"accountId":{"type":"string"},"buttons":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"title":{"maxLength":20,"type":"string"},"type":{"type":"string","enum":["url"]},"url":{"type":"string"}},"required":["title","type"]}},"createdAt":{"type":"string"},"dmMessage":{"maxLength":640,"type":"string"},"emailGate":{"type":"object","properties":{"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"followGate":{"type":"object","properties":{"buttonTitle":{"default":"I'm following","minLength":1,"maxLength":20,"type":"string"},"message":{"minLength":1,"maxLength":640,"type":"string"}},"required":["message"]},"id":{"type":"string"},"isActive":{"type":"boolean"},"name":{"minLength":1,"maxLength":60,"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"publishedVersionId":{"type":"string","nullable":true},"target":{"type":"object","discriminator":{"propertyName":"targetType"},"oneOf":[{"type":"object","properties":{"pageId":{"type":"string"},"targetType":{"type":"string","enum":["facebook"]}},"required":["pageId","targetType"]},{"type":"object","properties":{"targetType":{"type":"string","enum":["instagram"]}},"required":["targetType"]}]},"trigger":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"postId":{"type":"string","nullable":true},"type":{"type":"string","enum":["comment-received"]}},"required":["keywords","type"]},{"type":"object","properties":{"isActive":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["message-received"]}},"required":["keywords","type"]}]},"updatedAt":{"type":"string"},"webhook":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}},"method":{"type":"string","enum":["DELETE","GET","PATCH","POST","PUT"]},"url":{"minLength":1,"maxLength":2048,"type":"string"}},"required":["method","url"]}},"required":["accountId","buttons","createdAt","dmMessage","id","isActive","name","platform","publishedVersionId","target","updatedAt"]}},"required":["flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"description":"Validation error","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Validation error","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## List DM automation runs

> Lists the execution runs of a single DM automation, ordered by start time (most recent first). Supports cursor-based pagination.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}/runs":{"get":{"summary":"List DM automation runs","tags":["automations"],"description":"Lists the execution runs of a single DM automation, ordered by start time (most recent first). Supports cursor-based pagination.","parameters":[{"schema":{"minimum":1,"maximum":250,"default":50,"type":"integer"},"in":"query","name":"limit","required":false,"description":"Maximum number of execution runs to return. Defaults to 50."},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false,"description":"Opaque cursor returned by a previous call. Pass it to fetch the next page."},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"description":"Execution runs for the DM automation, most recent first.","type":"array","items":{"type":"object","properties":{"contactId":{"type":"string"},"createdAt":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"}},"required":["message"]},"id":{"type":"string"},"platform":{"type":"string","enum":["facebook","instagram"]},"status":{"type":"string","enum":["completed","expired","failed","running","superseded","waiting"]},"updatedAt":{"type":"string"}},"required":["contactId","createdAt","id","platform","status","updatedAt"]}},"cursor":{"description":"Cursor for the next page. Absent when there are no more runs.","type":"string"}},"required":["items"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## List DM automation logs

> Lists the execution logs written as a DM automation's runs progress, ordered by creation time (most recent first). Pass flowRunId to narrow the logs to a single run. Supports cursor-based pagination.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}/logs":{"get":{"summary":"List DM automation logs","tags":["automations"],"description":"Lists the execution logs written as a DM automation's runs progress, ordered by creation time (most recent first). Pass flowRunId to narrow the logs to a single run. Supports cursor-based pagination.","parameters":[{"schema":{"type":"string"},"in":"query","name":"flowRunId","required":false,"description":"Only return logs belonging to this execution run. Omit to return logs across every run of the automation."},{"schema":{"minimum":1,"maximum":250,"default":50,"type":"integer"},"in":"query","name":"limit","required":false,"description":"Maximum number of logs to return. Defaults to 50."},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false,"description":"Opaque cursor returned by a previous call. Pass it to fetch the next page."},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"description":"Execution logs for the DM automation, most recent first.","type":"array","items":{"type":"object","properties":{"context":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"flowRunId":{"type":"string"},"id":{"type":"string"},"level":{"type":"string","enum":["info","warning","error"]},"message":{"type":"string"},"nodeId":{"type":"string","nullable":true}},"required":["context","createdAt","flowRunId","id","level","message","nodeId"]}},"cursor":{"description":"Cursor for the next page. Absent when there are no more logs.","type":"string"}},"required":["items"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```

## Get DM automation analytics

> Returns stats for a single DM automation.

```json
{"openapi":"3.0.3","info":{"title":"Blotato API","version":"2.0.0"},"tags":[{"name":"automations","description":"Endpoints related to DM automations, which send a direct message in response to a comment or message on a connected social account."}],"servers":[{"url":"https://backend.blotato.com","description":"Blotato API Server"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"blotato-api-key","in":"header"}}},"paths":{"/v2/dm-automations/{id}/analytics":{"get":{"summary":"Get DM automation analytics","tags":["automations"],"description":"Returns stats for a single DM automation.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"analytics":{"type":"object","properties":{"completed":{"type":"integer"},"failed":{"type":"integer"},"triggered":{"type":"integer"}},"required":["completed","failed","triggered"]}},"required":["analytics"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"description":"Not found","type":"object","properties":{"code":{"type":"number"},"reqId":{"description":"Request ID for tracking","type":"string"},"message":{"description":"Resource not found","type":"string"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"action":{"description":"Action to take to resolve the error","type":"string"},"details":{"description":"Additional structured details about the error","type":"object","additionalProperties":{}}},"required":["message"]}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.blotato.com/api/openapi-reference/automations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
