# API Settings

> Settings of one generated or schema API of a table in API Maker - access type, auth providers, encrypted payloads - the most specific level, over the table and the database.

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

The settings of one API of a table, for example the get all of `products` : the most specific level. A key set here wins over the table and the database.

| | |
|---|---|
| Page | `API Info → DB API` → select the table → the API → **Add API Settings**. |
| Type | `T.IInstanceApiSettingsTypesForAPI` |
| Applies to | This API only. Caching is not set here : it belongs to the table or the database. |

**Make one read public, keep the writes behind tokens**

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

// Remove properties which you want to apply from parent level
let instanceColSetting: T.IInstanceApiSettingsTypesForAPI = {
    acceptOnlyEncryptedData: false,
    apiAccessType: T.EAPIAccessType.IS_PUBLIC,
};
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). |

- 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**.

- `NO_ACCESS` hides an API from HTTP while your custom APIs keep using it through `g.sys.db` : a way to expose a narrow custom API instead of the raw table.

## Related

- [Collection settings](https://docs.apimaker.dev/v1/docs/settings/collectionSettings.html) · [Database settings](https://docs.apimaker.dev/v1/docs/settings/databaseSettings.html) · [Security features](https://docs.apimaker.dev/v1/docs/features/security-features.html)
