Last modified: August 22, 2025
Within a project, you can set up config profiles to dynamically apply relevant configuration and variables at build time for different target environments. Each profile will provide a set of values that correspond with variables defined in any *-hsmeta.json
configuration files in the project. When running hs project upload
or hs project dev
, you’ll specify the profile you want to use, and HubSpot will apply variable values accordingly.
This can allow you to streamline building and testing without impacting the production version of your app and without having to manually update configuration values based on your testing environment. For example, you can set up profiles for development and production to handle switching auth redirect URL domains (see example usage).
To use config profiles, ensure you’re on the latest version of the CLI by
running
npm install -g @hubspot/cli@latest
. If you haven’t installed the HubSpot CLI yet, you can run npm install -g @hubspot/cli
.Create and manage config profiles
To create a config profile, runhs project profile add
in your project directory, then follow the terminal prompts to assign the profile a name and a target HubSpot account. It’s highly recommended to use a different account for each profile.
You can also provide the profile name as an argument when running the command, as shown below with an example profile named prod
.
Please note:Only authenticated accounts can be selected during profile creation. If an account is missing from the list, you’ll need to run
hs account auth
.src
directory as a hsprofile.*.json
file, which has the following schema:
Field | Type | Description |
---|---|---|
accountId | Integer | The ID of the HubSpot account to target when using the profile. |
variables | Object | An object containing key-value pairs for each variable and its assigned value for the profile. You’ll reference these variables in your *-hsmeta.json files using ${VARIABLE_NAME} syntax. |
hs project profile add
command again will include an option to copy the variables from an existing profile into the new one.
To delete a profile, run the hs project profile delete
command. To completely disable profiles for a project, delete all profile files and variables from your configuration files.
At any time, you can run
hs project profile --help
to view more information
about the available profile commands.Using profile variables
With your variables defined for each profile, you can reference them in the project’s various*-hsmeta.json
files using the format ${VARIABLE_NAME}
. For example, the app-hsmeta.json
file below is configured to append the VAR
variable value to the app name when uploaded using that profile.
Using profiles with upload commands
After defining profiles in a project, you’ll need to specify the profile to use when runninghs project upload
or hs project dev
by including the --profile
or -p
flag. The CLI will then use the account specified by the profile and apply the profile’s variable values. The code block below demonstrates this usage with an example profile named qa
.
upload
or dev
command. The CLI will return an error if no profile is specified.
Usage example
As an example, let’s say you want to set your app’s authentication redirect URL based on whether you’re targeting a development environment or a production environment.- In your app configuration (
app-hsmeta.json
), include a${DOMAIN}
variable in theredirectUrls
field.
- Set the variable value within each profile configuration file (
hsprofile.*.json
):
- During development, you’ll specify the config profile (
qa
) via the--profile
or-p
flag in thehs project upload
orhs project dev
command.
http://test-env-domain.com/oauth-callback
.
- When you’re ready to upload your changes to the production version of the app, you’ll specify the production profile (
prod
) when runninghs project upload
.
http://production-domain.com/oauth-callback
.
Use config profile variables in UI extensions
Config profile variables are also available when building UI extensions (e.g., an app card or app settings page) via thevariables
property within the context object.
You can define any profile variables within each profile configuration file (hsprofile.*.json
):
- hsprofile.qa.json