Made in Builder.io

Join us for an AI launch event by

Builder.io and Figma
Talk to Us
Product
Developers
Talk to Us

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

With the Content API, you can make requests to retrieve data about any of your models within Builder. The Content API supports advanced query filtering with URL parameters to help you get exactly the data you need.

Use cases for querying data could include searches, populating content for a collection, or getting all links that meet certain criteria.

To access this data, write queries with dot notation and, optionally, MongoDB style operators.

For more details on querying, see the Querying Cheatsheet.

To start using the Content API, make sure to import the Builder SDK into your project.

To use the Builder Content API to retrieve data from your models, be sure to always provide the following request parameters in your queries:

  • Required: my-model-name (replace with your model's name)
  • Required: apiKey query param (replace with your Public API Key)

As an example, you'd replace my-model-name with the name of your model, such as page, and YOUR_API_KEY with your own Public API Key.

https://cdn.builder.io/api/V3/my-model-name?apiKey=YOUR_API_KEY

This section covers the available Builder Content API query params.

MongoDB style query of your data.

Builder supports the following operators: $eq $gt$in $lt $lte $ne $nin$and $not $or $nor $exists $type $elemMatch$gte $regex $options. For more information, including examples, see the Builder Querying Cheatsheet.

Optionally use to send targeting attributes.

Only include these fields.

Omit only these fields.

Max number of results to return. The default is 30 and the maximum is 100.

Use to specify an offset for pagination of results. The default is 0.

For more detail, see this forum post and this forum post.

Include content of references in response.

Seconds to cache content. This sets the maximum age of the cache-control header response header. Set value higher for better performance, and lower for content that changes frequently.

Builder.io uses stale-while-revalidate caching at the CDN level. This means Builder always serves from edge cache and updates caches in the background for maximum possible performance.

In this way, the more frequently content is requested, the fresher it is. The longest Builder holds something in stale cache is one day by default, but you can set this to be shorter if needed. We suggest keeping this high unless you have content that must change rapidly and gets very little traffic.

Property to order results by. Use 1 for ascending and -1 for descending.

The key is what you're sorting on, so the following example sorts by createdDate. and because the value is 1, the sort is ascending.

Include content entries in a response that are still in draft mode and unarchived.

Though the default is true, you can pass false to include Symbol JSON in the response. This is helpful if you want to render your page all at once such as in server-side rendering.

Content API v3 is currently the default. Learn more in Content API Versions.

To experiment with the Content API, you can use the Builder API Explorer, which offers a way for you to compose queries in your own Builder Space. This way, you can confirm that your queries are correct before editing your code base.

Text that reads, "Try the API Explorer". Under the text is a curved arrow pointing to a tile to the right

Builder API Explorer


Looking to hire a third party to help with your project?

Submit a project request and our partnerships team will reach out to connect you with an Expert from our partner ecosystem.

Connect with us

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Get the latest from Builder.io

Developer Newsletter

Latest tips, tricks, and news for frontend developers from our blog

Product Newsletter

Latest features and updates on the Builder.io platform

By submitting, you agree to our Privacy Policy

Product

Features

Pricing

What's New

Developers

Builder for Developers

Developer Docs

Open Source Projects

Performance Insights

Headless CMS: Visual Guide

Resources

Documentation

Blog

Community Forum

Templates

Partners

Submit an Idea

Use Cases

Landing Pages

Headless CMS

Headless Storefront

Customer Showcase

Customer Success Stories

Builder.io logo

Visually build and optimize digital experiences on any tech stack. No coding required, and developer approved.

Get Started

Log In

Product

Features

Pricing

Integrations

React.js

Next.js

Gatsby

Angular

Vue

Nuxt

Hydrogen

Salesforce

All Integrations

Use Cases

© 2023 Builder.io, Inc.

Security

Privacy Policy

SaaS Terms