Hoppscotch provides you the ability to create and use variable throughout the app. This helps you reuse values throughout Hoppscotch just by invoking the variable name.

Hoppscotch considers an objects within an angular brackets as a variable <<variable>>

Variable Scopes

Hoppscotch provides you different variables scopes, allowing you to use different scopes for different contexts.

  1. Global Variables: can be accessed throughout Hoppscotch and has the broadest scope of all variables.
  2. Environment Variables: allow your variables to be scoped to an environment. Environment variables are useful when you have the same set of variables for two environments such as production and staging.
  3. Request Variables: are scoped to just an individual request, request variables are useful when you want to use variables in your URL path or when you want to embed a variable URL.
  4. Predefined Variables: are automatically generated at runtime and can be accessed globally throughout Hoppscotch using the $ symbol, such as $guid or $timestamp.

The scope of each variable can be identified from the color of the variable name

Variable ScopeColor
GlobalBlue
EnvironmentGreen
RequestOrange
PredefinedYellow
Non resolvableRed

Types of Variables

  1. A regular variable: allows users to reference the variable throughout Hoppscotch, and anyone can see the value associated with the variable. In a workspace, regular environment variable-value pairs will be synced to the server, making them available to all workspace members. However, you have the option to choose whether to sync a regular variable value present in your personal workspace
  2. A secret variable: enables users to specify secrets and reference the values as variables. The values of secret variables in any workspace will never be synced to the server or shared with any workspace members. It is expected that in a collaborative workspace the user will populate the value of the variable at runtime. All secret variable values in Hoppscotch will be masked using asterisks (***). Secret Variables cannot be scoped to a request and can only be scoped in an environment or globally
Secret variables values will not be exported when an environment is exported.
  1. A predefined variable: is automatically generated at runtime and provides dynamic, context-specific data. Predefined variables are available throughout your requests and responses and are useful for incorporating system-level information or dynamic values into your API interactions without manual configuration. All predefined variables are accessible throughout Hoppscotch and can be retrieved using the $ symbol. Below is the list of predefined variables whose values are dynamically generated during the request or collection run:
Variable NameDescriptionExample
$guidA v4 style unique (GUID) identifier for each request.123e4567-e89b-12d3-a456-426614174000
$timestampThe current UNIX timestamp in seconds1693047645
$isoTimestampThe current date and time in ISO-8601 format at zero UTC (also known as “Zulu time” or UTC-0)2024-09-25T00:00:00.000Z
$randomUUIDA random 36-character UUID.6929bb52-3ab2-448a-9796-d6480ecad36b

Numbers, Text, and Colors

Variable NameDescriptionExample
$randomAlphaNumericA random alpha-numeric character.A9X1Z3
$randomBooleanA random boolean value.true , false
$randomIntA random integer value between 0 and 1000.29 , 432 , 786
$randomColorA random color amongst red, green, blue, yellow, purple, and orange.yellow
$randomHexColorA random hex value.#f2a729
$randomAbbreviationA random abbreviation.SQL , JSON , HTML

Internet and IP addresses

Variable NameDescriptionExample
$randomIPA random IPv4 address192.168.0.101
$randomIPV6A random IPv6 address2001:0db8:85a3:0000:0000:8a2e:0370:7334
$randomMACAddressA random MAC address.00:1B:44:11:3A:B7
$randomPasswordA random 15-character alpha-numeric password.H8w72Sx93KlqA1b
$randomLocaleA random two-letter language code (ISO 639-1).en, fr, es
$randomUserAgentA random user agent.Mozilla/5.0 (Windows NT 10.0; Win64)
$randomProtocolA random internet protocol.https, ftp
$randomSemverA random semantic version number.1.2.3

Names

Variable NameDescriptionExample
$randomFirstNameA random first name.Ethan , Chandler, John
$randomLastNameA random last name.Schaden , Schneider , Doe
$randomFullNameA random Full name.Ethan Schaden , Chandler Schneider , John Doe
$randomNamePrefixA random name prefix.Dr. , Miss. , Prof.
$randomNameSuffixA random name suffix.MD , PhD , Jr.

Addresses and Profession

Variable NameDescriptionExample
$randomCityA random city name.New York , Houston , Philadelphia
$randomJobAreaA random job area.Intranet , Development , Testing
$randomJobDescriptorA random job descriptor.Corporate , Lead , Principal
$randomJobTitleA random job title.Global Branding Officer , Productivity Analyst
$randomJobTypeA random job type.Manager , Coordinator , Director