# Collection Settings

> Settings of one table or collection in API Maker - access type, auth providers, caching, encrypted payloads - over the settings of its database, under the settings of its APIs.

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

The settings of a table apply to every API of the table. They override the settings of the database, and an API can override them in turn.

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

**Collection settings**

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

// Remove properties which you want to apply from parent level
let instanceColSetting: T.IInstanceApiSettingsTypes = {
    enableCaching: true,                 // the reads of this table are cached until a write
    acceptOnlyEncryptedData: false,
    apiAccessType: T.EAPIAccessType.TOKEN_ACCESS,
    authProviders: ['users_tg'],         // every API of the table needs a person of users_tg
};
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

- [Database settings](https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html) · [API settings](https://docs.apimaker.dev/v1/docs/settings/apiSettings.html) · [Automatic caching](https://docs.apimaker.dev/v1/docs/features/automatic-caching.html)
