# Base

Base serves as the repository for all components that are common across all modules and remote procedures. Any elements placed in Base will be inherited by each module and remote procedure.

These components are:

* [Base URL](https://developers.make.com/custom-apps-documentation/app-components/base/base-url)
* [Authorization](https://developers.make.com/custom-apps-documentation/app-components/base/authorization)
* [Error handling](https://developers.make.com/custom-apps-documentation/app-components/base/error-handling)
* [Sanitization](https://developers.make.com/custom-apps-documentation/app-components/base/sanitization)

<table data-full-width="false"><thead><tr><th width="132.33333333333331" valign="top">Key</th><th width="182" valign="top">Type</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>baseUrl</code></td><td valign="top">String</td><td valign="top">Base URL is the main URL to a web service. It should be used for every module and remote procedure in an app.</td></tr><tr><td valign="top"><code>headers</code></td><td valign="top">Object</td><td valign="top">Default headers that every module will use.</td></tr><tr><td valign="top"><code>qs</code></td><td valign="top">Object</td><td valign="top">Default query string parameters that every module will use.</td></tr><tr><td valign="top"><code>body</code></td><td valign="top">Object</td><td valign="top">Default request body that every module will use when issuing a POST or PUT request.</td></tr><tr><td valign="top"><code>response</code></td><td valign="top">Object</td><td valign="top">Default directives for handling response, such as error handling.</td></tr><tr><td valign="top"><code>log</code></td><td valign="top">Object</td><td valign="top">Default directive for handling logs, such as sanitization of sensitive data.</td></tr><tr><td valign="top"><code>oauth</code></td><td valign="top">OAuth 1.0 Parameter Specification</td><td valign="top">Collection of directives containing parameters for the OAuth 1 protocol.</td></tr></tbody></table>

{% tabs %}
{% tab title="Base component examples" %}

```json
{
    "baseUrl": "https://my.api.cz/2.0",
    "headers": {
        "authorization": "Basic {{base64(connection.username + ':' + connection.password)}}"
    },
    "response": {
        "valid": {
            "condition": "{{body.status != 'error'}}"
        },
        "error": {
            "200": {
                "message": "{{ifempty(errors(body.message), body.message)}}"
            },
            "message": "[{{statusCode}}]: {{body.reason}}"
        }
    },
    "log": {
        "sanitize": [
            "request.headers.authorization"
        ]
    }
}


```

{% hint style="info" %}
Everything specified in the base is inherited by all modules and RPCs. You can see the `baseUrl`, `authorization` being sent in `headers,` an `error` handler and `sanitization`. Those parameters will be used across all the modules and RPCs.
{% endhint %}
{% endtab %}
{% endtabs %}

## Common data

Once the app is approved, the common data gets locked and it cannot be changed due to security reasons.

Common data can be accessed by the `common.variable` IML expression.

{% hint style="info" %}
Common data is stored in encrypted form in Make.
{% endhint %}

{% tabs %}
{% tab title="Common data" %}

```json
{
	"secret": "AABBCCDD"
}
```

{% endtab %}

{% tab title="Base" %}

```json
{
	"baseUrl": "https://www.example.com",
	"headers": {
		"Signature": "{{common.secret}}"
	}
}
```

{% endtab %}
{% endtabs %}

The secret is defined in the `common` data. Then it can be used in `base` and in all other communication objects inside modules and RPCs. Once the app becomes approved, it will not be possible to change the secret.

By default, requests time out after 40 seconds. If your API typically performs tasks that\
exceed this duration, you can increase the timeout up to a maximum of 300 seconds (or\
300,000 milliseconds).

To adjust the timeout, specify the desired duration in the base and common data settings\
(in milliseconds). This timeout will apply to the entire custom app. We recommend the\
following approach (example using a 300 seconds timeout):

{% tabs %}
{% tab title="Common" %}

```json
{
	"timeout": 300000
}
```

{% endtab %}

{% tab title="Base" %}

```json
{
	"url": "https://www.example.com",
	"method": "GET",
	"timeout": "{{common.timeout}}"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The timeout should only be extended if the API performs legitimately\
resource-intensive operations, such as video/image processing, file conversion, or\
complex AI computations.
{% endhint %}
