Content API v2

Build a custom experience from scratch by using our API

Looking for the API v1 documentation? View legacy documentation here

Getting started#

Before starting to build a solution using our API, we highly recommend utilizing our pre-designed embed layouts to kickstart your project promptly. These layouts are readily available and can be easily customized using CSS. As an added benefit, we are responsible for keeping these layouts updated to support various content types utilized by different social channels.

If you are looking to build a custom solution from scratch, you can use our Content API to fetch content that you've got collected to Flockler. The API does not provide any content that is hidden or waiting for moderation but only content that you've set to published state.

Authentication#

Even though the content provided by our API is considered to be public content, we require that you create an API key in your Flockler settings. This is so that we have a better understanding on who's using our API and a way to notify API users about updates and breaking changes.

Authenticating requests#

There are to ways to authenticate your requests:

  • Use a HTTP header:X-FL-API-Key: c1348c8843eca56ba620025acd31af81c8778ca0
  • Use a query parameter:?api_key=c1348c8843eca56ba620025acd31af81c8778ca0

Endpoints#

This is the base URL for all API requests where the :siteUuid is the UUID of your Flockler:https://api.flockler.app/v2/:siteUuid

Posts#

Request parameters#

ParameterDescription
count
integer

Max number of items returned in the response. Value between 1–100.

?count=20
filterByChannels[]
facebook flickr flockler google_review instagram link linkedin pinterest review rss tiktok twitter youtube

Filter posts by channels.

?filterByChannels[]=twitter&filterByChannels[]=instagram
filterBySectionIds[]
integer

List of section IDs to limit the results to.

?filterBySectionIds[]=1&filterBySectionIds[]=2
filterByTags[]
string

List of tags to limit the results to.

?filterByTags[]=foo&filterByTags[]=bar
tagFilterType
all any

Whether returned posts should have all of the tags mentioned or any of them. The default value is "all".

?tagFilterType=any
order
random

Used to return posts in a random order.

?order=random

Examples#

request
get/posts
const SITE_UUID = '01h3cqe975srrvf1zwp96xs29x';
const API_KEY = 'c1348c8843eca56ba620025acd31af81c8778ca0';
const response = await fetch(
  `https://api.flockler.app/v2/${SITE_UUID}/posts`,
  {
    headers: {
      'X-FL-API-Key': API_KEY
    }
  }
);
const data = await response.json();
response
get/posts
{
  "meta": {
    "statsApiEndpoint": "https://stats-api.flockler.app/v1/stats/01h3cqe975srrvf1zwp96xs29x?campaignId=…"
  },
  "pagination": {
    "newer": "https://api.flockler.app/v2/01h3cqe975srrvf1zwp96xs29x/posts?count=12&newerThanCursor=1234567890",
    "older": null
  },
  "posts": [
    {
      "attachments": [],
      "flocklerId": 1234567890,
      "from": {
        "name": "Flockler",
        "username": "getflockler",
        "profileUrl": "https://example.org/getflockler",
        "profileImageUrl": "https://example.org/getflockler.jpg"
      },
      "channel": "flockler",
      "ctaLink": null,
      "images": [
        {
          "altText": null,
          "url": "https://example.org/example.jpg"
        }
      ],
      "postType": "image",
      "publishedAt": "2025-03-12T05:00:54.030Z",
      "sourceId": "2dxsk8fx",
      "sourceUrl": "https://example.org/2dxsk8fx",
      "tags": [
        "HashtagA",
        "HashtagB",
      ],
      "textPlain": "Example text

#HashtagA #HashtagB",
      "textRich": "<p>Example text</p><p>#HashtagA #HashtagB</p>",
      "title": null,
      "videos": [],
      "pinnedIndex": null,
    }
  ]
}

Typescript definition for the posts#

type FlocklerPost = { attachments: PostAttachment[]; flocklerId: number; from: { name: string | null; username: string | null; profileUrl: string | null; profileImageUrl: string | null; }; channel: | 'facebook' | 'flickr' | 'flockler' | 'google_review' | 'instagram' | 'link' | 'linkedin' | 'pinterest' | 'review' | 'rss' | 'tiktok' | 'twitter' | 'vimeo' | 'youtube'; ctaLink: { url: string; title: string | null; } | null; images: { altText: string | null; url: string; }[]; pinnedIndex: number | null; postType: string; publishedAt: string; sourceId: string | null; sourceUrl: string; tags: string[]; textRich: string | null; textPlain: string | null; title: string | null; videos: { type: 'file' | 'iframe' | 'link'; url: string; }[]; }; type FacebookReviewAttachment = { pageName: string; pageUrl: string; recommendationType: 'positive' | 'negative'; type: 'review'; }; type FlocklerRatingAttachment = { rating: number; type: 'rating'; }; interface InstagramStoryAttachment { type: 'storyItem'; publishedAt: string; videoUrl: string; imageUrl: string; }; type LinkAttachment = { type: 'link'; snippet: string; title: string; url: string; }; type PostAttachment = FacebookReviewAttachment | FlocklerRatingAttachment | InstagramStoryAttachment | LinkAttachment;

Feeds#

The feeds API is only available on request for customers on our Business or Pro plans.The Feeds API allows you to create new social media feeds to pull posts automatically and make them available in a section. You can then use the posts endpoint (described above) to retrieve the content.

Request parameters#

ParameterDescription
feed
object

An object containing details about the feed to create.

feed[name]
string

What to name the feed. This should be unique, as it's what you'll see in the Flockler dashboard on your list of active feeds.

feed[feed_type]
rss twitter_v2

Which type of social media feed to create; i.e. which service to pull content from. Right now, limited to rss and twitter feed types.

feed[moderation_type]
saved_to_inbox ai_moderation auto_publish

Defines how the feed content is moderated. Options are saved_to_inbox, ai_moderation, or auto_publish.

feed[feed_attributes]
object

Contains additional parameters specific to the feed type, such as the URL for RSS feeds.

section
object

An object containing details about the section to create or reference.

section[uuid]
string

The UUID of the section where the feed will be added. If you want to use an existing section, provide only the UUID.

section[name]
string

The name of the section to create a new section. Use this only if you want to create a new section instead of using an existing one.

Examples#

RSS Feed Example#

Feed AttributeDescription
urlThe URL of the RSS feed to pull content from.
request
post/feeds
const SITE_UUID = '01h3cqe975srrvf1zwp96xs29x';
const API_KEY = 'c1348c8843eca56ba620025acd31af81c8778ca0';
const postData = {
  feed: {
    name: "BBC",
    feed_type: "rss",
    moderation_type: "auto_publish",
    feed_attributes: {
      url: "https://feeds.bbci.co.uk/news/world/rss.xml"
    }
  },
  section: {
    uuid: "uuid"
  }
};

const response = await fetch(
  `https://api.flockler.app/v2/${SITE_UUID}/feeds`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-FL-API-Key': API_KEY
    },
    body: JSON.stringify(postData)
  }
);

const data = await response.json();
response
post/feeds

{
    "result": {
        "success": true,
        "data": {
            "feed": {
                "uuid": "uuid",
                "name": "BBC",
                "service": "rss"
            },
            "section": {
                "uuid": "uuid",
                "name": "wow"
            }
        }
    }
}
          

Typescript definition for this request#

type FeedAttributes = { url: string; // ...other params for other feed types... }; type Feed = { name: string; feed_type: 'rss' moderation_type: 'saved_to_inbox' | 'ai_moderation' | 'auto_publish'; feed_attributes: FeedAttributes; }; type Section = { uuid: string; }; type CreateFeedRequest = { feed: Feed; section: Section; };

Twitter Feed Example#

Feed AttributeDescription
authorThe username of the Twitter account to pull tweets from.
hashtag_or_keywordHashtags or keywords to filter tweets.
include_repliesBoolean flag to include replies in the feed.
videos_requiredBoolean flag to include only tweets with videos.
pictures_requiredBoolean flag to include only tweets with pictures.
request
post/feeds
const SITE_UUID = '01h3cqe975srrvf1zwp96xs29x';
const API_KEY = 'c1348c8843eca56ba620025acd31af81c8778ca0';
const postData = {
  feed: {
    name: "Twitter feed",
    feed_type: "twitter_v2",
    moderation_type: "auto_publish",
    feed_attributes: {
      author: "author",
      hashtag_or_keyword: "#hashtag",
      include_replies: true,
      videos_required: true,
      pictures_required: true
    }
  },
  section: {
    uuid: "uuid"
  }
};

const response = await fetch(
  `https://api.flockler.app/v2/${SITE_UUID}/feeds`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-FL-API-Key': API_KEY
    },
    body: JSON.stringify(postData)
  }
);

const data = await response.json();
response
post/feeds

{
    "result": {
        "success": true,
        "data": {
            "feed": {
                "uuid": "uuid",
                "name": "twitter_v2",
                "service": "twitter_v2"
            },
            "section": {
                "uuid": "uuid",
                "name": "test"
            }
        }
    }
}

Typescript definition for this request#

type FeedAttributes = { url: string; author?: string; hashtag_or_keyword?: string; include_replies?: boolean; videos_required?: boolean; pictures_required?: boolean; }; type Feed = { name: string; feed_type: 'rss' moderation_type: 'saved_to_inbox' | 'ai_moderation' | 'auto_publish'; feed_attributes: FeedAttributes; }; type Section = { uuid: string; }; type CreateFeedRequest = { feed: Feed; section: Section; };

Pinterest Feed Example#

Feed AttributeDescription
urlAdd Pinterest user or board URL, e.g., https://www.pinterest.com/user/board.
request
post/feeds
const SITE_UUID = '01h3cqe975srrvf1zwp96xs29x';
const API_KEY = 'c1348c8843eca56ba620025acd31af81c8778ca0';
const postData = {
  feed: {
    name: "Pinterest feed",
    feed_type: "pinterest",
    moderation_type: "auto_publish",
    feed_attributes: {
      url: "https://www.pinterest.com/user/board"
    }
  },
  section: {
    uuid: "uuid"
  }
};

const response = await fetch(
  `https://api.flockler.app/v2/${SITE_UUID}/feeds`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-FL-API-Key': API_KEY
    },
    body: JSON.stringify(postData)
  }
);

const data = await response.json();
response
post/feeds

{
    "result": {
        "success": true,
        "data": {
            "feed": {
                "uuid": "uuid",
                "name": "Pinterest feed",
                "service": "pinterest"
            },
            "section": {
                "uuid": "uuid",
                "name": "example_section"
            }
        }
    }
}