Skip to main content

Fetching Repeater data via API

This guide provides comprehensive code examples for fetching and rendering Repeater data from ButterCMS across various programming languages and frameworks.
Need to set up repeaters first? See Creating Repeater Fields.

API response structure

When you publish a page with a Repeater field, the API returns your content as an array of items. Here are examples of common Repeater field responses:
Each Repeater field returns as an array of items. As you add more items to a Repeater in the CMS, more objects appear in the array. A developer can map over that list and render the items in any way they want.

JavaScript / Node.js

Using the ButterCMS JavaScript SDK

Using Fetch API (Vanilla JavaScript)

React

React Component for Repeater data

Testimonials Component

Vue.js

Vue 3 composition API

FAQ accordion Component

Testimonials Component

Python

Using the ButterCMS Python SDK

Flask example

Django example

Jinja2 template

Go

Processing features Repeater in Go

Complete Go handler

PHP / Laravel

Using the ButterCMS PHP SDK

Laravel controller

Laravel Blade template

Ruby / Rails

Using the ButterCMS Ruby SDK

Rails controller

Rails view (ERB)

Repeater structure

Repeaters are single-level lists in this codebase. Repeater subfields can only be standard field types.

Error handling best practices