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.

Neighbor post comments (neighbor_post_comment) on Naver Blog can keep a gap per blog: ownerGapHours, a whole number of hours from 1 to 720, makes Uplika wait that long after the last comment the automation left on a blog before commenting there again. Leave it out for no gap. The gap is kept by this setting; a spacing rule written in the instruction is not. A value outside the range answers 422 invalid_flow with a problem coded owner_gap_hours. excludeBlogs lists blogs to leave out: give blog addresses, or links to a blog or one of its posts (up to 200), and Uplika saves each as its blog id; a nickname is refused with 422 exclude_blogs. A new post from a listed blog ends as neighbor_excluded before the post is read. To change the list, send the whole list again; null clears it.

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.

NameTypeDescription
templateRequiredpathA template id from GET /v1/automations/templates, e.g. comment_to_dm, comment_public_reply, keyword_dm, default_reply.
accountIdRequiredstringThe connected account the flow runs on.
paramsRequiredobjectThe template's parameters. Their schema is in the template's params.
enabledbooleantrue to turn it on right away. Defaults to false (a draft).
namestringDefaults to the template's title.
curl -X POST https://api.uplika.com/v1/automations/quick/comment_to_dm \
  -H "Authorization: Bearer $UPLIKA_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.

NameTypeDescription
accountIdRequiredstringThe connected account the flow runs on.
docRequiredobjectThe flow document: triggers and nodes. POST /v1/automations/validate checks it first.
namestringDefaults to Untitled automation.
enabledbooleanDefaults to false.
postIdstringTies 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.

NameTypeDescription
versionRequirednumberThe version you read. A newer save answers 409 version_conflict with the current version.
docobjectThe new document. Or send template instead.
templateobject{ id, params }: rebuild the document from a template, as the dashboard wizard does.
namestringA new name.

PATCH/v1/automations/{id}

Rename, turn on and off with enabled, or change some template params. Any other field (doc and the like) answers 400 invalid_params; to replace the whole document, use PUT.

NameTypeDescription
versionnumberThe version you read. Required with params; a newer save answers 409 version_conflict with the current version.
namestringA new name. Leave it out to keep the current one.
enabledbooleantrue turns it on through the same checks as POST /v1/automations/{id}/enable; false turns it off.
paramsobjectOnly the template params to change; the rest stay as they are. An automation edited on the canvas answers 409 automation_not_template.

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) or because the account owner turned off message access for connected tools (error 200); 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.

NameTypeDescription
includeAnsweredbooleanAlso send to comments that already have a reply from the account. Defaults to false.
publicReplybooleanAlso post the trigger's public reply under each comment. Defaults to false.
retryRefusedbooleanAlso send again to comments whose private reply Instagram refused (error 2534025) or that were refused because the account owner turned off message access for connected tools (error 200), 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. A post deleted on the channel is skipped and counted in posts.gone (the preview says postsGone); if every post is gone, the job ends failed with the post_unavailable sentence. 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. A run that ends as superseded found a private reply already on the comment: another run sent it, or, when the reason has error 2534023, another app connected to the account did. 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. A Naver neighbor-post comment run ends as done and says in its log what happened: neighbor_excluded when the post's blog is on excludeBlogs, neighbor_commented when the comment went out, neighbor_owner_gap when ownerGapHours had not passed since the last comment on that blog (the line carries the time of the next turn), neighbor_off_topic when the AI found the post outside what the instruction covers, neighbor_ai_declined when it would not comment on that post for another reason, neighbor_ai_failed when the AI could not be reached or the daily AI limit was used, neighbor_already when our comment was already there, and neighbor_unreadable when the post could not be read. 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.

NameTypeDescription
limitquery1-200, defaults to 50.
beforequeryA 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.