---
title: "Create a flow"
method: POST
path: "/flows"
tags: ["Flows"]
---

# Create a flow

`POST /flows`

## Request

- Base URL: `https://www.sociahive.com/api/v1`
- URL: `https://www.sociahive.com/api/v1/flows`
- 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`)

## Request body

- CreateFlowRequest
  - `name` string, required
  - `description` string
  - `account_id` string, required: MongoDB ObjectId (24-character hex string)
  - `platform_user_id` string, required
  - `platform` 'instagram' | 'messenger' | 'whatsapp' | 'linkedin' | 'twitter' | 'tiktok' | 'telegram' | 'threads' | 'youtube' | 'bluesky' | 'pinterest' | 'facebook': Connected-account platform identifier
  - `trigger` object
    - `type` 'post_comment' | 'story_reply' | 'message' | 'comment' | 'keyword' | 'live_comment' | 'ad_click' | 'referral_link' | 'instagram_story_mention', required

## Response `200`

Flow created

- FlowEnvelope: POST /flows returns `{ flow: <raw flow document> }` with HTTP 200.
  - `flow` object, required

## Other responses

- `400`: Bad request — invalid parameters
- `401`: Authentication required — provide X-API-Key or Bearer token
- `403`: Insufficient scope for this operation
- `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)
