Docs Home

N8n Integrations

Learn more about n8n integrations in our help documentation.

N8N Integration

Publish Posts via N8N Using the Postly API

Automate your entire publishing workflow by connecting N8N to the Postly API.
Use your API Key to trigger posts, generate content, schedule automations, or sync Postly with your CRM, CMS, or any custom flow.

This guide walks you through:

  1. Authenticating N8N with Postly
  2. Fetching workspaces
  3. Fetching connected socials
  4. Uploading media files
  5. Creating & scheduling posts via API

1. Get Your API Key

Go to:

Dashboard → Automations → API → Generate API Key

Copy your key:

X-API-KEY: your_api_key_here

In N8N, store this in:

Settings → Credentials → HTTP Header Auth
or add it directly inside each HTTP Request Node.


2. N8N Setup Overview

A typical Postly → N8N workflow looks like:

Trigger (cron / webhook / CMS update)
      ↓
Fetch Workspaces (GET /workspaces)
      ↓
Fetch Socials (GET /socials)
      ↓
Upload Media (POST /files)
      ↓
Create Post (POST /posts)
      ↓
Confirm or Notify

3. Fetch Workspaces

GET /workspaces

curl --location --request GET 'https://openapi.postly.ai/workspaces' --header 'X-API-KEY: <api-key>'

Example Response

{
  "code": "success",
  "message": "Workspaces fetched",
  "data": [
    {
      "_id": "workspace_id",
      "name": "My Workspace",
      "avatar": "https://cdn.postly.ai/workspace/avatar.png"
    }
  ]
}

4. Fetch Social Accounts

GET /socials

curl --location --request GET 'https://openapi.postly.ai/socials?workspaceId=<workspace_id>' --header 'X-API-KEY: <api-key>'

Example Response

{
  "code": "success",
  "data": [
    {
      "_id": "socialId",
      "platform": "facebook",
      "name": "My FB Page"
    }
  ]
}

5. Upload Media Files

POST /files

curl --location --request POST 'https://openapi.postly.ai/files' --header 'X-API-KEY: <api-key>' --form 'workspaceId="<workspace_id>"' --form 'file=@"/path/to/media.jpg"'

Example Response

{
  "code": "success",
  "data": {
    "url": "https://cloud.postly.ai/media/123abc.jpg"
  }
}

6. Create or Schedule a Post

POST /posts

curl --location --request POST 'https://openapi.postly.ai/posts' --header 'Content-Type: application/json' --header 'X-API-KEY: <api-key>' --data '{
  "workspaceId": "workspace_id",
  "text": "Automation from N8N 🚀",
  "platforms": ["facebook", "instagram"],
  "media": [
    {
      "type": "image",
      "url": "https://cloud.postly.ai/media/123abc.jpg"
    }
  ],
  "schedule": {
    "type": "scheduled",
    "datetime": "2025-02-15T10:00:00Z"
  }
}'

7. Full Workflow Example

Trigger → Fetch Workspaces → Fetch Socials → Upload Media → Create Post → Notify

Example Use Cases

  • Auto-post from Notion → N8N → Postly
  • Publish daily RSS content
  • Auto-post from Shopify product updates
  • Auto-repost high-performing tweets

Best Practices

  • Store your API Key in N8N credentials
  • Upload media before /posts
  • Use ISO time:
2025-10-17T14:30:00Z
  • Connect accounts in Postly dashboard first