We recommend the latest API version, which is currently v3.
To leverage the latest Content API features, we recommend using the most recent version. Currently, the latest version is v3, which offers important advantages over previous versions.
Content API v3 benefits include:
- Better, more scalable infrastructure: The content API is built on global scale infrastructure to ensure fast response times and high availability.
- Ability to ship more features, faster: With v3, Builder can ship the latest features to customers without breaking fundamental flows. These features are only available in v3 and not in prior versions of the Content API.
To use the v3 Content APIs, upgrade your SDKs to the latest version with npm with the following:
npm update YOUR_SDK@latest
For example, if using the React SDK, the command would be:
npm update @builder.io/sdk-react@latest
SDK versions higher than those in the following table use the v3 Content APIs by default. Any prior SDK version uses v2 or below of the Content API.
Check the following table for information on which SDK versions support which Content API versions.
SDK | SDK version and Content API support |
---|---|
React SDK ( |
|
React-Native, Vue, Svelte, SolidJS, Qwik and Beta React SDKs |
|
- Better support for localization (coming soon): The content API will provide improved support for localization, including querying based on localization features.
- Support for multi-level nested references (coming soon): The content API will allow you to query, resolve, and return content that has nested references of other contents and symbols.
When making requests to Builder's Content API, be sure to use v3
in the path, as in /api/v3/content
instead of v2
:
- fetch('https://cdn.builder.io/api/v2/content/...')
+ fetch('https://cdn.builder.io/api/v3/content/...')
Do the same for the GraphQL API and HTML API; that is, replace v1
with v3
:
- fetch('https://cdn.builder.io/api/v1/html/...')
+ fetch('https://cdn.builder.io/api/v3/html/...')
- fetch('https://cdn.builder.io/api/v1/graphql/...')
+ fetch('https://cdn.builder.io/api/v3/graphql/...')
If you encounter limitations with v3 when querying content, you have the option to fall back to v1 — or v2, depending on your SDK — for individual queries.
The React SDK supports v3 or v1 with the apiVersion
property.
To use v1, update builder.apiVersion
, which is typically in the same place where you call buidler.init()
to initialize the React SDK:
import { builder } from "@builder.io/react";
builder.init('YOUR_BULDER_PUBLIC_API_KEY');
builder.apiVersion = "v1"; //this can be v1 or v3
Though we highly recommend using the latest Content API, you can toggle versions.
Using the apiVersion
property, you can toggle the API version between v3 and v2, if needed, for the following SDKs:
- React-Native
- Qwik
- SolidJS
- Svelte
- Vue
For example, to use v2, pass the apiVersion
property in two places:
- The
Content
component that renders the Builder content - The
getContent()
function that fetches the content
The following snippets provide an example:
<Content apiVersion="v2" />
// The name of this package import will depend on your SDK.
import { getContent } from "@builder.io/sdk-qwik";
getContent({ apiVersion: "v2" })
Versions 1 and 2 do not have the latest features and improvements available in v3, as v3 is the default and recommended version for content queries.