Buffer GraphQL API Examples
This collection demonstrates various operations that you can perform using our API.
Getting setup
Please ensure that you have followed the initial instructions over in the Getting Started Guide to set up your API access and authentication.
Available Examples
Browse through our examples using the sidebar on the left. Each example showcases different aspects of our GraphQL API:
- Aggregate Post Metrics - Aggregate normalized post metrics across a window of sent posts, without paginating through individual posts. When authenticating via OAuth, requires the
insights:readscope; personal API keys don't need it. - Create Draft Post - Draft posts can be created using the createPost mutation with the
saveToDraftargument set totrue. When saving a post as a draft, there are several required arguments: - Create Idea - Create an idea post for a specified Organization, using the provided content.
- Create Image Post - Creating a post with an image works in the same way as creating a text post, with the addition of the
assetsargument.assetsis an ordered list where each entry specifies exactly one ofimage,video,document, orlink— for an image post, pass animageentry with the URL you want to attach. - Create Scheduled Post - Scheduled posts can be created using the createPost mutation with the
customScheduledmode and adueAttimestamp. When creating a scheduled post, there are several required arguments: - Create Text Post - Text posts can be created using the createPost mutation. When creating a post, there are several required arguments:
- Create Threaded Post - Threaded posts (for example a Twitter/X thread or a Bluesky, Threads, or Mastodon thread) are created with the
createPostmutation by passing athreadarray inside the service-specificmetadata. Each entry in the array is one post in the thread, and they are published in order, each replying to the previous one. - Create Video Post - Creating a post with a video works in the same way as creating a text post, with the addition of a
videoentry in theassetsarray.assetsis an ordered list where each entry specifies exactly one ofimage,video,document, orlink— pass avideoentry with the URL you want to attach. You can also optionally provide athumbnailUrlfor the video thumbnail. - Get Channel - Fetch a single channel by its ID.
- Get Channels - Fetch all channels for the provided Organization ID.
- Get Filtered Channels - Fetch all channels for the provided Organization ID.
- Get Organizations - Fetch all of the organizations that belong to the authenticated account.
- Get Paginated Posts - Fetch a list of posts with support for pagination.
- Get Post Metrics - Fetch performance metrics for a single post. When authenticating via OAuth, requires the
insights:readscope; personal API keys don't need it. - Get Posts For Channels - Fetch a list of posts for a specific set of Channel IDs.
- Get Posts With Assets - Fetch a list of posts along with their associated assets (images, videos, etc.) for a specific set of Channel IDs.
- Get Posts With Metrics - Fetch a paginated list of sent posts together with their performance metrics. When authenticating via OAuth, requires the
insights:readscope; personal API keys don't need it. - Get Quarterly Performance Report - Roll up a quarter of publishing activity into a single aggregate. Useful for BI exports, board-deck stats, or year-on-year comparisons without paginating through every post.
- Get Scheduled Posts - Fetch a list of posts that are scheduled for future publishing.