To set the base_url variable in Postman for APIs, follow these steps:

  1. Open Postman and go to the "Manage Environments" option located on the top right corner.

  2. Click on "Add" to create a new environment.

  3. Give a name to the environment and add the base URL of the API in the "INITIAL VALUE" field. For example, if the base URL is "https://api.example.com/v1", then enter it in the field.

  4. Click on "Add" to save the environment.

  5. Now, in the API requests, use the variable {{base_url}} instead of the actual URL.

  6. To select the environment, click on the dropdown menu on the top right corner and select the environment you just created.

  7. The base URL will now be automatically set for all the API requests in that environment.

how to set base_url variable in postman for apis