---
title: "Link a draft automation to a post"
method: POST
path: "/posts/{id}/automation"
tags: ["Automation"]
---

# Link a draft automation to a post

`POST /posts/{id}/automation`

## Request

- Base URL: `https://www.sociahive.com/api/v1`
- URL: `https://www.sociahive.com/api/v1/posts/{id}/automation`
- Auth: one of:
  - API key in header `X-API-Key`
  - OAuth 2 (authorization code, authorization URL `/api/oauth/authorize`, token URL `/api/oauth/token`, scopes: `flows:write`, `posts:write`)

Links the draft. `armed: true` also arms it — only for a person (the SociaHive iOS app); send the `previewed_hash` you showed. A refused arm keeps the link (`linked: true` on the error).

## Path parameters

- `id` string, required: MongoDB ObjectId (24-character hex string)

## Request body

- object
  - `flow_id` string, required: MongoDB ObjectId (24-character hex string)
  - `armed` boolean
  - `previewed_hash` string
  - `replace` boolean: Replace the post's existing draft automation.

## Response `200`

Linked

- object
  - `data` object, required
    - `linked` boolean, required
    - `armed` boolean, required

## Other responses

- `400`: Bad request — invalid parameters
- `401`: Authentication required — provide X-API-Key or Bearer token
- `403`: Plan access (feature_disabled) or arming by a non-person (arm_requires_human)
- `404`: Post or automation not found
- `409`: automation_exists, automation_changed, post_locked, activating_now, …
- `422`: The automation would not pass the publish gate (code names the fix)
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/sociahive/apis/sociahive-api.md) · [All operations](https://skmtc.dev/sociahive/apis/sociahive-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sociahive/apis/sociahive-api/revisions/791b8548d288?raw)
