> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alforse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contract Configuration

> Manage custom contract types and lifecycle templates (stages and transitions).

Every write endpoint on this page requires the `admin` module (edit) **and** the tenant's
`workflowAutomation` feature flag (Team plan and above). Codes must match `^[a-z][a-z0-9_]{1,63}$`.

## Catalog

`GET /contract-config/catalog` · requires `contract_view` (view)

Returns the tenant's configured contract types and lifecycle templates — this is what backs the
`type` / `typeCode` and `lifecycleTemplateId` / `lifecycleStageCode` fields on
[Contracts](/api-reference/contracts).

## Contract types

| Endpoint                           | Body                                                                                                                  |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `POST /contract-config/types`      | `{ code, name, category?, description?, enabled?, order?, fieldSchema?, defaultRules?, defaultLifecycleTemplateId? }` |
| `PATCH /contract-config/types/:id` | Same fields, all optional                                                                                             |

## Lifecycle stages

| Endpoint                                                       | Body                                                                                                    |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `POST /contract-config/lifecycle/templates/:templateId/stages` | `{ code, name, category?, order?, isTerminal?, locksCoreFields?, completionRules?, allowedRoleCodes? }` |
| `PATCH /contract-config/lifecycle/stages/:id`                  | Same fields, all optional                                                                               |

`locksCoreFields` is what makes a stage lock core contract fields — see
[Workflow](/api-reference/workflow).

## Lifecycle transitions

| Endpoint                                                            | Body                                                                                                    |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `POST /contract-config/lifecycle/templates/:templateId/transitions` | `{ code, name, fromStageCode, toStageCode, requiredControl?, conditions?, effects?, order?, enabled? }` |
| `PATCH /contract-config/lifecycle/transitions/:id`                  | Same fields, all optional                                                                               |

`requiredControl` ties a transition to a [workflow control](/concepts/roles-and-permissions#workflow-controls)
level (e.g. `approve`, `sign`) that the acting role must hold.
