# Custom API Settings

> The Basic Info of a custom API in API Maker - name, path and method, access type and auth providers, caching with reset rules, request schemas, timeout, native process, error list, file upload rules and Swagger docs.

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

The **Basic Info** tab of a custom API is a TypeScript object : where the API answers, who may call it, and how it behaves.

| | |
|---|---|
| Page | `API Info → Custom API` → the API → **Basic Info**. |
| Type | `T.ICustomApiSettingsTypes` |
| URL | `/api/custom-api/<user path><path>` with `requestMethod`. Path and method together are unique. |

**Basic Info**

```typescript
import * as T from 'types';
import { EType } from 'types';

let customApi: T.ICustomApiSettingsTypes = {
    name: 'Create Customer',                 // unique ; the folder in Git
    requestMethod: T.ERequestMethod.POST,
    path: '/customers',
    enableCaching: false,
    resetCacheOnModificationOf: [
        // 'DB:mongodb:shop:customers',        // a write to this table resets the cache of this API
        // 'CA:other_custom_api',              // a call of that custom API resets it
    ],
    acceptOnlyEncryptedData: false,
    // customApiTimeoutInSeconds: 10,
    errorList: [ 'Unable to process this request' ],   // translatable in i18n
    apiAccessType: T.EAPIAccessType.TOKEN_ACCESS,
    // authProviders: ['users_tg'],
    reqBodySchema: {
        first_name: { __type: EType.string, validations: { required: true } },
        phone: { __type: EType.number, validations: { min: 5 } },
    },
    fileUpload: { enable: false, allowFileUploadFields: [ T.EFilesVariables.files ], validations: {} },
};
module.exports = customApi;
```

## The keys

| Key | Meaning |
|---|---|
| `name` | Unique name, also the folder of the API in Git. |
| `path`, `requestMethod` | Where it answers : `GET`, `POST`, `PUT` or `DELETE`. `/customers/:id` gives `g.req.params.id`. |
| `apiAccessType` | `TOKEN_ACCESS` (default), `IS_PUBLIC`, or `NO_ACCESS` for an API only your code calls. |
| `authProviders` | The person tokens the call must carry. Absent : `common.authProviders` of the secret ; `[]` : the API user token alone. |
| `enableCaching` | Cache the answer in Redis per body, query and person. |
| `resetCacheOnModificationOf` | `DB:instance:database:table`, `CA:custom API name`, `TP:bundle:version` : what drops the cached answers. Otherwise [reset custom API cache](https://docs.apimaker.dev/v1/docs/apis-all/system-apis/system-generated-reset-redis-cache-custom-api.html). |
| `acceptOnlyEncryptedData` | Refuse plain payloads : [encrypted payloads](https://docs.apimaker.dev/v1/docs/features/security-features.html#encrypted-request-payloads). |
| `reqBodySchema`, `reqQueryParametersSchema` | A [schema](https://docs.apimaker.dev/v1/docs/schema/schema.html) for the body and the query : validated and converted before the code runs, checkable with [is valid data for custom API](https://docs.apimaker.dev/v1/docs/apis-all/system-apis/system-generated-is-valid-data-for-custom-api.html). |
| `customApiTimeoutInSeconds` | How long the code may run. |
| `runOnNativeProcess` | Run on the process of API Maker instead of the sandbox : faster, less isolated ; `console.log` is not captured, use `g.logger`. |
| `errorList` | The messages this API throws, listed for [internationalization](https://docs.apimaker.dev/v1/docs/i18/i18.html). |
| `fileUpload` | `enable`, `allowFileUploadFields` (`files`…), and per field `validations` : `minFileSizeBytes`, `maxFileSizeBytes`, `allowedExtensionsArr`. See [files](https://docs.apimaker.dev/v1/docs/apis-all/custom-apis/user-created-custom-api.html#files). |
| `swaggerDocs` | `tag`, `summary`, `description`, `parameters` for the Swagger docs of the API users. |

## Related

- [Custom APIs](https://docs.apimaker.dev/v1/docs/apis-all/custom-apis/user-created-custom-api.html) · [Automatic caching](https://docs.apimaker.dev/v1/docs/features/automatic-caching.html) · [Auth of a database user](https://docs.apimaker.dev/v1/docs/authorization/AMDB.html)
