REST API
Automations
Comment to DM, keyword replies and the other automations: create one from a template, read it, change it, turn it on and see its runs.
An automation is one JSON document: triggers (a comment, a DM, a mention, a story reply) and the steps that follow. The dashboard wizard, the canvas and these endpoints all edit the same document, so a flow made here opens in the dashboard and the other way round.
Most flows start from a template. A new flow is a draft until you enable it, and nothing goes out to anyone before that. If the account is not subscribed to the channel's webhooks yet, the response also carries warning: reconnect the account, or the flow will not hear any events.
Templates and what each channel can do
Comment to reply (comment_public_reply) and Comment to DM (comment_to_dm) can have the AI write the public reply instead of picking one of your sentences. For comment_public_reply pass replyMode: "ai" with an instruction; onlyPositive, on by default, answers only comments the AI reads as positive. For comment_to_dm pass publicReplyMode: "ai" with publicReplyInstruction; the reply goes out only after the private reply did, and the AI is told the DM was just sent. The former template id ai_comment_reply still works: it builds comment_public_reply with replyMode "ai" and the response says renamedFrom.
Only one message flow without keywords (a default reply or AI replies) can be live per account, or one message would get two answers. Creating or enabling a second one answers 409 automation_catch_all_taken with the name of the live one.
GET/v1/automations/templates
Every template: its id, channels, parameters (JSON Schema) and the reviewed feature it needs, if any.
GET/v1/automations/capabilities
Per channel: which triggers and steps a flow may use there.
Create
POST/v1/automations/quick/{template}
Create a flow from a template and its parameters. The usual way.
| Name | Type | Description |
|---|---|---|
templateRequired | path | A template id from GET /v1/automations/templates, e.g. comment_to_dm, comment_public_reply, keyword_dm, default_reply. |
accountIdRequired | string | The connected account the flow runs on. |
paramsRequired | object | The template's parameters. Their schema is in the template's params. |
enabled | boolean | true to turn it on right away. Defaults to false (a draft). |
name | string | Defaults to the template's title. |
curl -X POST https://api.uplika.com/v1/automations/quick/comment_to_dm \
-H "Authorization: Bearer $UPLIKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "acc_7f3c",
"params": {
"post": "any",
"keywords": ["link"],
"message": "Thanks for the comment. Tap below and I will send the link.",
"buttonTitle": "Send me the link",
"deliver": { "text": "Here it is.", "links": [{ "title": "Open", "url": "https://example.com" }] }
}
}'POST/v1/automations
Create a flow from a full document.
| Name | Type | Description |
|---|---|---|
accountIdRequired | string | The connected account the flow runs on. |
docRequired | object | The flow document: triggers and nodes. POST /v1/automations/validate checks it first. |
name | string | Defaults to Untitled automation. |
enabled | boolean | Defaults to false. |
postId | string | Ties the flow to one of your posts. |
POST/v1/automations/validate
Check a document without saving it. Answers the list of problems, empty when it is fine.
List and read
GET/v1/automations
Every flow in the workspace, newest first.
GET/v1/automations/{id}
One flow with its document, version, run counts and the channel's capabilities.
Change, turn on and off
PUT/v1/automations/{id}
Replace the document. Send the version you read; a newer save answers 409 version_conflict.
| Name | Type | Description |
|---|---|---|
versionRequired | number | The version you read. A newer save answers 409 version_conflict with the current version. |
doc | object | The new document. Or send template instead. |
template | object | { id, params }: rebuild the document from a template, as the dashboard wizard does. |
name | string | A new name. |
PATCH/v1/automations/{id}
Rename, or turn on and off with enabled.
POST/v1/automations/{id}/enable
Turn it on. From this moment messages go to real people.
POST/v1/automations/{id}/disable
Turn it off. Runs that are waiting do not continue.
POST/v1/automations/{id}/duplicate
Copy it as a new draft, with the same document and template parameters.
DELETE/v1/automations/{id}
Delete the flow, its runs and its versions.
Send to past comments
A flow reacts to new comments. To reach the comments that are already on the post, the ones it missed before it was turned on or while another tool handled the account, send the flow to past comments. It works on Instagram and Facebook, on top-level comments, and the flow has to be on. Preview first: it sends nothing and answers eligible, the number of comments that would get the flow now, and skipped with the reason for the rest: mine, tooOld, keyword, alreadyRan, refused, replyUsed, answered and sameAuthor. One person gets it once: when someone commented several times, only their newest comment is answered. refused counts comments whose run ended because Instagram refused the private reply (error 2534025); with retryRefused those are sent again within 7 days of the comment, in the same run and without a public reply, and replyUsed counts the ones another run has answered since. While Instagram blocks the account's messages, a job pauses and counts the comments it reached as held; Uplika sends those when the block lifts.
Meta allows one private reply per comment and only within 7 days, so older comments are left out, and a comment another app already answered by DM is refused by Meta and counted as alreadyReplied. Sending is paced at a few comments a minute because Meta allows 750 private replies per hour per account and live flows use the same allowance. Each comment that was answered is a run in the list below.
POST/v1/automations/{id}/past-comments/preview
Count without sending: how many comments would get the flow, and why the others would not. Takes the same body as the start call.
POST/v1/automations/{id}/past-comments
Start sending. Answers 202 with the job; one job per flow at a time.
| Name | Type | Description |
|---|---|---|
includeAnswered | boolean | Also send to comments that already have a reply from the account. Defaults to false. |
publicReply | boolean | Also post the trigger's public reply under each comment. Defaults to false. |
retryRefused | boolean | Also send again to comments whose private reply Instagram refused (error 2534025), within 7 days of the comment, in the same run. Defaults to false. |
GET/v1/automations/{id}/past-comments
The most recent job: its status, how many were sent, and how many are queued. GET /v1/automations/{id} carries the same in pastComments.
DELETE/v1/automations/{id}/past-comments
Stop the running job. Comments already answered stay answered.
Runs and versions
A run that stopped says why in error, or in its log: window_closed when the 24-hour messaging window was closed, private_reply_expired when the comment was older than 7 days, and a sentence with an address when another app holds the conversation. When the AI step cannot classify a comment or write a reply, the run stops as failed_ai, and when the workspace reaches its daily automation AI limit it stops as blocked_ai_quota; in both cases it takes neither branch. A run that is waiting with private_reply_held in its log is held because Instagram temporarily blocked the account's messages; Uplika sends it when the block lifts, within 7 days of the comment, and posts the public reply after the DM. GET /v1/help?code=<reason> returns what to do.
GET/v1/automations/{id}/runs
What happened each time it fired: status, the reason it stopped, and a step log.
| Name | Type | Description |
|---|---|---|
limit | query | 1-200, defaults to 50. |
before | query | A run id from the previous page. |
GET/v1/automations/{id}/versions
Saved versions of the document, newest first.
GET/v1/automations/{id}/versions/{version}
One saved version of the document.