# Database Settings

> Settings which apply to every table of a database in API Maker - access type, auth providers, caching, encrypted payloads - inherited by the tables and the APIs which do not override them.

Source: https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html

The settings of a database apply to every table of it, and to every API of those tables, unless a table or an API sets the same key itself.

| | |
|---|---|
| Page | `API Info → DB API` → select the database → **Add Database Settings**. |
| Type | `T.IInstanceApiSettingsTypes` |
| Applies to | The APIs of every table of the database. |

**Database settings**

```typescript
import * as T from 'types';

// Remove properties which you want to apply from parent level
let instanceColSetting: T.IInstanceApiSettingsTypes = {
    enableCaching: false,
    acceptOnlyEncryptedData: false,
    apiAccessType: T.EAPIAccessType.TOKEN_ACCESS,
    // authProviders: ['users_tg'],   // absent : common.authProviders of the secret ; [] : API user token only
};
module.exports = instanceColSetting;
```

## The keys

| Key | Values | Meaning |
|---|---|---|
| `apiAccessType` | `TOKEN_ACCESS` (default), `IS_PUBLIC`, `NO_ACCESS` | Who may call : with the token of an API user, anybody, or only your own code and the admin panel. |
| `authProviders` | names of [auth providers](https://docs.apimaker.dev/v1/docs/authorization/AMDB.html) | The person tokens the call must carry. Absent : `common.authProviders` of the secret. `[]` : the API user token alone. |
| `acceptOnlyEncryptedData` | `true` / `false` | Refuse plain bodies and query strings : see [encrypted payloads](https://docs.apimaker.dev/v1/docs/features/security-features.html#encrypted-request-payloads). |
| `enableCaching` | `true` / `false` | Cache the answers of the reads in Redis until a write of the table : see [automatic caching](https://docs.apimaker.dev/v1/docs/features/automatic-caching.html). Table and database level only. |

- A setting is used when it is present : leave a key out to inherit it. The order is **API settings → table settings → database settings → secret → default**.

## Related

- [Collection settings](https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html) · [API settings](https://docs.apimaker.dev/v1/docs/settings/apiSettings.html) · [Auth of a database user](https://docs.apimaker.dev/v1/docs/authorization/AMDB.html)
