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
.
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.
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.
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.
// Replace with your Public API Key
builder.init('YOUR_API_KEY')
The following example shows what an actual Public API Key looks like when passed into builder.init()
.
// an example of an actual API key passed into init()
builder.init('bb209fb71eh2412dbe0114bdae18fd15')
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.
@NgModule({
declarations: [
...
],
imports: [
...
BuilderModule.forRoot(YOUR_API_KEY), // <-- Paste your API Key here.
...
],
...
})
export class AppModule {}
When you replace the YOUR_API_KEY
placeholder, it looks similar to the following example.
// An example API Key in use
BuilderModule.forRoot('bb209fb71eh2412dbe0114bdae18fd15')
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.
To view or use Private API Keys, you must have Admin or Developer permissions.
Tip: Keep your Private API Key secret. It allows anyone to have write access to your content in Builder. Only use it in API calls from your server, not calls from public client applications.
Remember to ensure your Private API Keys are kept out of any version control system that you may be using.
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 Edit button.
For more information on Admin permissions at the Organization level, see Managing Your Organization.
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 Settings.
- To the right of Private Keys, click the Edit button.
- 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 Creating a Private Page.
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