## Get the CRM module configuration (tenant:crm:read or tenant:settings:read)

`GET /api/crm/v1/config`

Module: CRM · operationId: `getCrmConfig` · Tag: Configuration · Auth: access token (`Authorization: Bearer <accessToken>`)

The CRM settings with every default filled in (without a saved configuration:
`active: false`, `leadAutoScoring: true`, `defaultLeadSource: MANUAL`,
`vatCheckEnabled: true`, `leadRetentionMonths: 0`, no custom fields). The NFON phone book settings are read with `getNfonConfig`.

### Responses

- **200** Configuration (`application/json`)
- **401** Missing, invalid or expired token (no body).
- **403** The token lacks the permission (`insufficient permissions`) or has no active tenant.
 (`application/json`)
- **500** Unexpected error; details are only logged. (`application/json`)

Fields of the 200 answer:

- `active` (boolean): Marks the CRM module as set up for the tenant (`getCrmConfigStatus`); the API does not refuse requests of an inactive module.
- `customFields` (object): The tenant's own fields of leads and opportunities.
  - `lead` (array of CustomFieldDef): Fields of leads.
    - `key` (string, required): Lower-case letters, digits, `-` or `_`.
    - `kind` (string, required): Field type. (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
    - `label` (string, required): Label shown in forms.
    - `options` (array of object): Choices of `select` and `multiselect` fields (required there).
      - `label` (string, required): Label shown in forms.
      - `value` (string, required): Stored value.
      - `color` (string): Display colour.
    - `required` (boolean): A value is required on write. (default `false`)
  - `opportunity` (array of CustomFieldDef): Fields of opportunities.
    - `key` (string, required): Lower-case letters, digits, `-` or `_`.
    - `kind` (string, required): Field type. (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
    - `label` (string, required): Label shown in forms.
    - `options` (array of object): Choices of `select` and `multiselect` fields (required there).
      - `label` (string, required): Label shown in forms.
      - `value` (string, required): Stored value.
      - `color` (string): Display colour.
    - `required` (boolean): A value is required on write. (default `false`)
- `defaultLeadSource` (string): Source of new leads created without one. (default `"MANUAL"`; max length 64)
- `leadAutoScoring` (boolean): New leads without a `score` get the data quality score; `false`: 0. (default `true`)
- `leadRetentionMonths` (integer): Months after which a daily job anonymises `LOST` leads and `NEW` / `CONTACTED` leads without change or activity (see Model); 0 is off. (default `0`; max 120)
- `vatCheckEnabled` (boolean): `false` makes `validateVatId` answer `409` (`vat_check_disabled`). (default `true`)

Example 200 answer:

```json
{
  "active": true,
  "customFields": {
    "lead": [
      {
        "key": "branche",
        "kind": "text",
        "label": "Branche"
      }
    ],
    "opportunity": []
  },
  "defaultLeadSource": "MANUAL",
  "leadAutoScoring": true,
  "leadRetentionMonths": 24,
  "vatCheckEnabled": true
}
```

### Example request

```bash
curl -X GET 'https://api.mbcom.cloud/api/crm/v1/config' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
