Configuration as Code (CaC) is a way of representing and managing the configuration of a Yext account as a set of JSON files. Nearly everything configurable in a Yext account has a corresponding file that represents its configuration. These files can be read, edited, transferred between accounts, and stored in a source repository.
But what does Configuration as Code actually look like? To answer this, let’s look at an example from Yext.
Let’s say you create a number type field in your Yext account called Price, using the Yext platform in your browser:

When you save the new field, this creates a JSON file that represents the configuration, that looks like this:
{
"$id": "c_price",
"$schema": "https://schema.yext.com/config/km/custom-field/v1",
"displayName": "Price",
"typeId": "type.decimal",
"type": {
"decimalType": {}
},
"localization": "PRIMARY_ONLY",
"group": "NONE"
}Nearly everything that you can configure in your Yext account has a similar file representing its configuration.
Why Use Configuration as Code
CaC solves problems that arise when managing account configuration only through a browser UI:
- Version control: Store configuration in a repository and revert to an earlier state when needed.
- Account-to-account transfer: Apply the same configuration to multiple accounts by reusing files, rather than manually recreating settings.
- Collaboration: Share configuration files with teammates or across teams.
Pulling and Applying Configuration
Making Changes in the Browser
Let’s say you want to make a configuration change in a web browser for a web application like Yext. What do you need to do?
First, you need to navigate to the correct URL, which will load the correct configuration page. The state that the page loads in represents the configuration that was previously saved for your account.
Next, you need to make the configuration changes that you desire. This involves pressing different buttons or typing various words into text boxes.
Last, you need to save your changes. When you save, the changes you have made take effect.
With Configuration as Code, there is a similar sequence of events.
Pull
Pulling is how you access the current configuration files for an account. When you pull, Yext returns the JSON files representing the account's current state. This is the equivalent of navigating to a settings page in the browser. The page loads the current configuration.
When you load the Admin Console, you are pulling the configuration files from the account, solution template, or Github repository.
Edit Locally
After pulling, you can edit the files directly. Instead of clicking buttons or filling in form fields, you edit JSON. These edits are local. Changing something in these files will not immediately change the configuration of the account.
Editing files locally is the equivalent of making configuration changes within a web browser before pressing save. You indicate the changes you would like to make and can view what the final state of the configuration will be, but nothing in the account has actually changed yet. If you were to pull the files again (or reload the browser), all of your changes would be lost.
Apply
Applying sends your edited files back to Yext, telling it what the final state of the configuration should be.
Applying files is the equivalent of pressing save in the web browser. Similar to pressing save, applying files does not automatically mean that the account’s configuration will change to match what you indicated. You may have errors that prevent the configuration from being saved.
Resources and Resource Types
In CaC, the core unit of configuration is called a resource. Every resource has a type (its resource type) that describes what kind of configuration it represents.
For example, a custom field named "Price" is a resource with the resource type Custom Field. Its configuration file looks like this:
{
"$id": "c_price",
"$schema": "https://schema.yext.com/config/km/custom-field/v1",
"displayName": "Price",
"typeId": "type.decimal",
"type": {
"decimalType": {}
},
"localization": "PRIMARY_ONLY",
"group": "NONE"
}
Available Resource Types
Resource types span all areas of a Yext account. Below is a list of the resource types that are currently available for Configuration as Code:
| Area | Resource Types |
|---|---|
| Content | Connector, Entity, Entity Folder, Entity Label, Entity Template, Entity Type, Entity Type Extension, Entity Upload Config, Custom Field, Field Presentation, Field Type, Saved Filter, Settings |
| Crawler | Crawler |
| Search | Search Configuration, Saved Query, Experience Training |
| Pages | Domain, Module, Page Builder Template, Site Configuration |
| Analytics | Conversion Action, Dashboard, Insight |
| Platform | Account Features, Home Screen, Role |