Using Builder API Keys
An API key is an alphanumeric string that you can use to connect your code base with Builder. Use the Builder Public API Key to integrate with Builder.
An example of a Builder API Key is bb209db71e62412dbe0114bdae18fd15
.
This document guides you through the following:
Prerequisites
To get the most our of this document, you should have the following:
- A Builder account
- An app in your framework of choice
Tip: The Builder Public API Key is public, meaning that you don't have to keep it private. Because of this, there are no inherent security risks in it being publicly viewable, for example, on GitHub.
Finding your Public API Key
You can find and copy your Public API Key with the following steps:
- Within your Builder Space, press
Cmd/Ctrl + k
to open the Command Palette. - Start to type the letters API into the search field to filter results.
- Click your API key to copy to your clipboard.
Alternatively, you can also find your Public API Key in Account Settings for the Space:
- Within your Builder Space, go to the Account Settings section.
- Click the copy icon to the right of the Public API Key field.
The video below shows both ways to find the Public API Key.
Using your Public API Key in your framework
Most JavaScript apps use builder.init()
to pass in the Public API Key. Replace YOUR_API_KEY
with the Public API Key you copied from Account Settings.
The following example shows what an actual Public API Key looks like when passed into builder.init()
.
Using your Public API Key in Angular
In Angular, pass your API Key into BuilderModule.forRoot()
, by replacing YOUR_API_KEY
with the Public API Key you copied in Account Settings. Place the forRoot()
method in the @NgModule()
imports
array.
When you replace the YOUR_API_KEY
placeholder, it looks similar to the following example.
Managing Private Keys
Use Private Keys when you want to create a server-side only key for writing to your Builder account or to pull content that you want to keep private.
Tip: Ensure your Private API Keys are kept out of any version control system that you may be using.
Managing an Organization's Private Key
With Organization Admin permissions, you can view, copy, or revoke the single, default Organization Private API Key. If you revoke the key, the dialogue gives you the option to create another key.
To manage the Private Key for your Organization:
- Go to the Organization Account Settings.
- To the right of Private Keys, click the Pencil icon.
For more information on Admin permissions at the Organization level, see Managing Your Organization.
Managing multiple Private API Keys in a Space
If you need to manage or create multiple Private API Keys, go to the Space Account Settings, rather than the Organization settings.
To manage the Private Key for your Organization:
- Go to the Organization Account Settings.
- To the right of Private Keys, click the Pencil icon.
- Create or revoke as many keys as you need.
To use Private Keys in a Space, make sure the Public readable toggle in the model is turned off. Then use the Content API to request private content using a Private API Key.
For more information, see Intro to Models and the forum post Create Private Pages that are accessible only after authorization.
What's next
With your API Key in place, you can integrate powerful Builder features. To get started, check out the following tutorials:
- Integrating Pages: set up your app so teammates can build Pages on their own.
- Integrating Sections: integrate Section building for reusable content
- Integrating CMS Data: create structured reusable data across your site
- Integrating Symbols: elegantly reuse data across your app
- Integrating Custom Components: use your custom components in Builder's drag-and-drop UI
Looking to hire a 3rd 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.