# Compliance templates

Source: https://docs.settlemint.com/docs/developers/developer-guides/api-integration/compliance-templates
Create, list, search, filter, publish, and delete reusable compliance templates through the DALP API.



A compliance template is a reusable policy pattern that an integration prepares before operators create assets. Each template stores its modules, jurisdictions, required controls, draft or published status, and module-set version.

Use these endpoints when your integration prepares policy templates before operators create assets in the Asset Designer. For the system-level module registry that templates rely on, see [Compliance modules API](/docs/developers/developer-guides/api-integration/compliance-modules). For the operator workflow, see [Compliance templates](/docs/operators/user-guides/compliance/templates).

## Template state model [#template-state-model]

Compliance templates can be DALP library templates or organisation templates. List responses include both by default. DALP library templates sort before organisation templates and are immutable through the organisation API: integrations can read and filter them, but cannot update, publish, or delete them.

Organisation templates start as drafts. Drafts can be edited, then published when ready for asset creation workflows. Publishing changes `isDraft` to `false`. A repeat publish request returns a conflict response instead of creating a new version.

Jurisdictions are stored on the template. A template with no jurisdictions is a global template. When you filter for a specific jurisdiction, the API returns templates tagged with that jurisdiction and global templates, so an integration can show global defaults beside jurisdiction-specific options.

<Mermaid
  chart="flowchart TD
  A[Create organisation template] --> B[Draft template]
  B --> C[Update modules, jurisdictions, and required controls]
  C --> D[Publish template]
  D --> E[Published organisation template]
  F[DALP library template] --> G[List and filter results]
  E --> G
  G --> H[Asset creation workflow]
  B -. editable .-> C
  F -. read only .-> G"
/>

## Endpoints [#endpoints]

The compliance template API exposes these endpoints:

| Endpoint                                                 | Use it for                                      |
| -------------------------------------------------------- | ----------------------------------------------- |
| `GET /api/v2/settings/compliance-templates`              | List compliance templates in the active tenant. |
| `POST /api/v2/settings/compliance-templates`             | Create a draft compliance template.             |
| `GET /api/v2/settings/compliance-templates/{id}`         | Read one compliance template.                   |
| `PUT /api/v2/settings/compliance-templates/{id}`         | Update a compliance template.                   |
| `PUT /api/v2/settings/compliance-templates/{id}/publish` | Publish a draft template for asset creation.    |
| `DELETE /api/v2/settings/compliance-templates/{id}`      | Delete a compliance template.                   |

Responses use the DALP single-resource or collection envelope with `data` and `links.self`. List responses also include pagination metadata. Facets are returned for `isSystem`, `isDraft`, and `moduleSetVersion`.

## Create a draft template [#create-a-draft-template]

Create requests start a template in draft state. If you omit `moduleSetVersion`, DALP uses the current compliance module generation. Older clients may still send the deprecated `legacy` boolean; new integrations should send `moduleSetVersion` instead.

```bash
curl --request POST \
  "$DALP_API_URL/api/v2/settings/compliance-templates" \
  --header "X-Api-Key: $DALP_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Global capital raise policy",
    "description": "Reusable capital raise controls for regulated assets",
    "jurisdictions": [],
    "moduleSetVersion": 2,
    "modules": [],
    "requiredControls": ["capital-raise-limit"]
  }'
```

The response includes the created template and a `links.self` path for the new resource.

## Update template configuration [#update-template-configuration]

Update requests can change the name, description, jurisdictions, modules, and required controls. Update requests cannot change the template's module generation. If an integration needs a different generation, create a new template with the target `moduleSetVersion` and move the required modules or controls there.

DALP validates modules and required controls against the template generation on create, update, and publish. A current-generation template cannot save controls that only belong to a legacy module set. If the API returns a module-set compatibility error, remove the incompatible controls or create a template with the matching generation.

## Publish a template [#publish-a-template]

Publish the template when it is ready to appear in asset creation workflows:

```bash
curl --request PUT \
  "$DALP_API_URL/api/v2/settings/compliance-templates/$TEMPLATE_ID/publish" \
  --header "X-Api-Key: $DALP_API_TOKEN"
```

Publishing changes `isDraft` to `false`. Published templates can be selected during asset creation. Draft templates remain editable preparation records.

## List and filter templates [#list-and-filter-templates]

Use the list endpoint to find templates by search, draft status, source, jurisdiction, or module generation. By default, the list includes DALP library templates and templates owned by the active organisation, with DALP library templates sorted first.

The list endpoint uses the standard collection query pattern:

| Query control                    | Use it for                                                                                                                 |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `filter[q]`                      | Search across template text fields.                                                                                        |
| `sort`                           | Sort the collection. The default sort is `name`; use a leading minus sign for descending order, such as `sort=-updatedAt`. |
| `page[limit]` and `page[offset]` | Page through large template libraries.                                                                                     |
| `filter[...]`                    | Restrict the collection to templates that match a field value.                                                             |

Supported filter and sort fields:

| Field              | Type    | Use it for                                                                                          |
| ------------------ | ------- | --------------------------------------------------------------------------------------------------- |
| `name`             | Text    | Filter, search, or sort by template name.                                                           |
| `jurisdiction`     | Text    | Return templates for a jurisdiction. `GLOBAL` returns templates with no specific jurisdiction.      |
| `isDraft`          | Boolean | Return draft templates with `true`, or published templates and DALP library templates with `false`. |
| `moduleSetVersion` | Number  | Return templates for one compliance module generation.                                              |
| `isSystem`         | Boolean | Return only DALP library templates with `true`, or only organisation templates with `false`.        |
| `createdAt`        | Date    | Filter or sort by creation time.                                                                    |
| `updatedAt`        | Date    | Filter or sort by last update time.                                                                 |

For example, request recently updated current-generation draft templates when your integration is preparing a new organisation policy set:

```bash
curl --globoff \
  "$DALP_API_URL/api/v2/settings/compliance-templates?filter[moduleSetVersion]=2&filter[isDraft]=true&filter[isSystem]=false&sort=-updatedAt&page[limit]=25" \
  --header "X-Api-Key: $DALP_API_TOKEN"
```

The response contains a `data` array of compliance templates. Each template includes `id`, `name`, `description`, `jurisdictions`, `isSystem`, `isDraft`, `moduleSetVersion`, `organizationId`, `version`, `modules`, `requiredControls`, `createdBy`, `createdAt`, and `updatedAt`. Collection metadata lets clients render paginated tables. Facets for `isSystem`, `isDraft`, and `moduleSetVersion` let clients build source, status, and module-generation filters without hard-coding the available values.

Read the template before you update it. Another operator or integration may have changed the template version or draft status since your last read.

## Related [#related]

* [Compliance modules API](/docs/developers/developer-guides/api-integration/compliance-modules)
* [Compliance templates user guide](/docs/operators/user-guides/compliance/templates)
* [Asset creation with instrument templates](/docs/operators/user-guides/asset-creation/instrument-templates)
* [Request headers](/docs/developers/developer-guides/api-integration/request-headers)
* [DAPI error reference](/docs/developers/developer-guides/api-integration/dapi-error-reference)
