# Base URL

Base URL is the main URL to a web service that should be used for every module and remote procedure in an app, e.g. `https://mywebservice.com/api/v1.`

There might be situations when you need to have a variable base URL. For example, if the web service uses multiple domains you may want to let your users have access to the one they use.

## Base URL example: two types of accounts

This is an example of how to handle two types of accounts - `sandbox` and `production`.

{% stepper %}
{% step %}
Add a checkbox in your connection parameters that can be checked when the condition is met:

```json
[
   {
      "name": "sandbox",
      "type": "boolean",
      "label": "Sandbox"
   },
   ...
]
```

{% endstep %}

{% step %}
Implement a condition in both the connection and the base:

```json
{
    "baseUrl": "https://{{if(connection.sandbox,'sandbox.', '')}}yourapi.com/api"
}
```

{% endstep %}
{% endstepper %}

All modules and remote procedures can then use hard-coded `"url": "/uniqueEndpoint"`

## Base URL example: two environments

This is an example of how to handle two types of accounts - `eu` and `us`.

{% stepper %}
{% step %}
Set up `select` in your connection parameters, where you let your users choose from available environments:

```json
[
    {
        "name": "environment",
        "type": "select",
        "label": "Environment",
        "options": [
            {
                "label": "EU",
                "value": "eu"
            },
            {
                "label": "US",
                "value": "us"
            }
        ],
        "default": "production"
    },
    ...
]
```

{% endstep %}

{% step %}
Map the environment in both the connection and the base.

```json
{
    "baseUrl": "https://{{connection.environment}}.yourapi.com",
    ...
}
```

{% endstep %}
{% endstepper %}

All modules and remote procedures can then use hard-coded `"url": "/uniqueEndpoint"`

{% hint style="info" %}
See the [best practices for Base URL](https://developers.make.com/custom-apps-documentation/best-practices/base#base-url) for more information.
{% endhint %}
