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

# Governance templates

> Build an intake or assessment questionnaire on a governance record type, score the answers into a tier, and let people fill it with an agent in chat or Slack, on a surface form or over the API.

A governance template is a questionnaire on a record type, such as an AI risk assessment on an AI System or an intake on a Use Case. Each answer can carry points. The template adds the points into a score, puts the score in a tier, and can write the score and the tier to fields of the record. Admins build templates without code. People fill them in three ways: with an agent in chat or Slack, on a form on a surface, or over the API. Every submitted response is stored with the record and its change history.

Templates are part of AI governance records. They show only in organizations that have AI governance records. Screenshots show sample data.

## Who does what

| Role | Templates | Responses |
| - | - | - |
| Owner or admin | Sees the **Templates** tab, creates, edits, publishes, duplicates and archives the organization's templates, and sees every draft version | Fills templates like a member |
| Member | Sees the published templates (no **Templates** tab) | Fills a published template on any record of the organization, sees the organization's submitted responses and only their own drafts. When the template writes to the record, only the record's owner or creator (or an owner or admin) can submit |

Built-in templates are read only for everyone. Duplicate one to change it.

## Build a template

**1. Open Templates**

Go to **Platform > AI governance > Records** and open the **Templates** tab. The list shows the built-in templates and your own, with their record type and version. Filter by record type, or by **Built-in and yours**, **Built-in** or **Yours**.

![Templates tab with the four built-in templates at Built-in Version 1 and two organization templates, one at Version 1 with a draft of version 2](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/templates-list.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=93177b6a7df3a8e7f992eeca15fdd7e7)

Platform > AI governance > Records, Templates tab. Shown with sample data.

**2. Create it**

Click **New template**, enter a **Name** and pick the **Record type** it answers. The template opens in the builder as **Draft of version 1**. Add a **Description** if you want one.

![Builder of a new template: Details with Name and Description, Questions with one empty section, Add question and Add section, Score set to No score, and the Preview pane](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/new-template.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=20b4f9aa625b6666c2dc9d81ae3355ee)

A new template in the builder, before its first question. Shown with sample data.

**3. Add questions**

Under **Questions**, give each section a title, then click **Add question**. **Add section** starts a new section. For each question set:

* **Question**: the text people answer.
* **Answer type**: one of the eight types in the table below.
* **Required**: the response cannot be submitted without an answer.
* **Help text**: optional, shown under the question.
* For **One choice** and **Several choices**: each choice and its **Points**. **Add choice** adds one.
* **Counts toward the score** and its **Weight** (for **Number**, **One choice** and **Several choices**).

| Answer type | What people give | Points it adds to the score |
| - | - | - |
| **Short text** | Up to 500 characters | None |
| **Long text** | Up to 20,000 characters | None |
| **Number** | A number | The number answered |
| **Yes or no** | Yes or no | None |
| **Date** | A date | None |
| **One choice** | One of the choices | The points of the chosen choice |
| **Several choices** | One or more of the choices | The sum of the points of the chosen choices |
| **Person** | A member of the organization | None |

**4. Set the score and the tiers**

Under **Score and tiers**, pick the **Score**:

| Score | Result |
| - | - |
| **No score** | The template only collects answers |
| **Sum of points** | The points of the answered questions that count toward the score, added up |
| **Weighted sum of points** | Each question's points times its **Weight** (default 1), added up |
| **Lowest points** | The lowest points of those questions |
| **Highest points** | The highest points of those questions |

A response with no answered scoring question has no score. Under **Tiers**, click **Add tier** for each tier and give it a name, a **From** and a **To** score. Leave **To** of the last tier empty for "and above". Tiers must not overlap or leave a gap: 0 to 10, 11 to 20 and 21 and above is complete. A score above a closed last tier, or below the first tier, has no tier.

**Write the score to** and **Write the tier to** name the record fields that get the result on submit, or **Do not write the score** and **Do not write the tier**. The score goes to a number field of the record type. The tier goes to **Risk tier** (with tiers named like the risk tiers: low, medium, high, critical), or to a text field or a one-choice field that has every tier name as an option.

**5. Check it in Preview**

**Preview** on the right shows the form as people see it. Answer it to see the **Score**, the **Tier** and how many questions are answered. Preview saves nothing.

![Builder with three questions: a required Number question, a required One choice question with points 0, 3 and 5, and an optional Yes or no question; Weighted sum of points; tiers Low 0 to 10, Medium 11 to 20, High 21 and above; tier written to Risk tier; Preview shows Score 15 and Tier Medium](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/builder-preview.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=50795b8e41eea806db136d2dd6850eec)

The builder with Preview: 9 people (weight 1) and Internal data (3 points, weight 2) give a weighted score of 15, tier Medium. Shown with sample data.

**6. Publish**

**Save draft** keeps your changes without publishing them. **Publish** makes the draft the template's next version, and people can fill it from then on. A template needs at least one question to publish. The builder names any problem, such as two tiers that overlap, before it publishes.

## Versions

A published version never changes. Every response keeps the exact questions it answered.

* After a publish, the next edit starts the **draft of version n+1**. The list then reads, for example, **Version 1 · draft of version 2**. People keep filling version 1 until you publish version 2.
* A template has at most one draft.
* A response stays on the version it started on. Filling the template again later makes a new response on the version published then.
* **Archive** in a row's menu stops new answers. Answers people already gave stay on their records. A template that has responses cannot be deleted, only archived.

## Built-in templates

Four templates come with xpander:

| Template | Record type | Scoring |
| - | - | - |
| **AI use case intake** | Use Case | No score. Uses all eight answer types |
| **AI risk assessment** | AI System | Weighted sum of points, tiers low (0 to 10), medium (11 to 20) and high (21 and above), tier written to **Risk tier** |
| **AI impact assessment** | Use Case | Sum of points, tiers low (0 to 5), medium (6 to 11) and high (12 and above). Writes nothing to the record |
| **AI vendor assessment** | Vendor | Sum of points, tiers low (2 and below), medium (3 to 5) and high (6 and above), tier written to **Risk tier**. Each certification the vendor holds takes 1 point off |

They are read only. To change one, choose **Duplicate** in its row's menu. The copy is your own template, named with "(copy)", as **Draft of version 1**, and opens in the builder. **Duplicate** works on your own templates too.

![Builder with AI risk assessment (copy), Draft of version 1 on AI System, with the built-in questions now editable](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/duplicate-copy.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=12c8e3b13afd48918e791947acc9e47f)

A duplicated built-in template, editable as Draft of version 1. Shown with sample data.

## Fill a template with an agent

Any agent of your organization can fill a published template with a person in the app chat or in Slack, one question at a time. Ask it, for example: "Start the AI risk assessment on AIS-0007."

* The agent names the record by its id (such as `AIS-0007`) or its exact title. For anything else it lists close records to choose from and starts nothing.
* It asks one question at a time, with its answer type, whether it is required, its help text and its choices.
* It reads answers as people say them: a number, yes or no, a choice by its label, several choices separated by commas, and "me" for a person question. A wrong type, such as "abc" for a number, is refused, nothing is saved, and the agent asks again.
* An empty answer skips an optional question. A required question cannot be skipped.
* Before it submits, the agent states the score and the tier and asks you to confirm. It submits only after you confirm.
* A draft stays. Ask again later ("continue my risk assessment") and the agent starts at the first unanswered question.

Example in chat:

```text theme={"dark"}
You:    Start the AI risk assessment on AIS-0007.
Agent:  Question 1 of 6, required, one choice: What is the most sensitive data the system processes?
        Public, Internal, Confidential, Personal, or Sensitive personal or regulated.
You:    Internal
Agent:  Question 2 of 6, required, one choice: How much does a person oversee its outputs?
        A person approves every output, A person monitors and can step in, or No person reviews outputs.
You:    A person monitors and can step in
Agent:  Question 3 of 6, required, one choice: Who receives its outputs?
        Internal staff, Customers, or The public or vulnerable groups.
You:    Customers
Agent:  Question 4 of 6, optional, number: About how many people does it reach each month?
You:    skip
Agent:  Question 5 of 6, required, several choices: Which harms could a wrong output cause?
You:    Financial loss, Privacy breach
Agent:  Question 6 of 6, optional, long text: Which controls reduce these risks today?
You:    skip
Agent:  Score 14, tier Medium. This writes Risk tier = Medium to AIS-0007. Submit?
You:    Yes
Agent:  Submitted. AIS-0007 now shows Risk tier Medium.
```

The agent acts as you, with your role. It sees only what you can see, and submits only where you can submit. In Slack, it acts as the person who wrote, so that person's Slack account must be linked to xpander. A run started with an API key cannot fill a template through an agent; use the [API](#api) instead.

### Turn it on or off

The agent uses four built-in tools: `xpgovernance_list_templates`, `xpgovernance_start_response`, `xpgovernance_answer` and `xpgovernance_submit`. They are on for every agent of an organization that has AI governance records.

* For the whole organization: **Platform > AI governance > Policies** > **Agent tools** > **Governance templates**.
* For one agent on Claude Code, Codex or OpenCode: **Agent settings** > **Skills** > **Core Skills** > **xpander built-in tools** > **Governance templates** ([Built-in tools](https://docs.xpander.ai/use/agents/built-in-tools.md)).

![xpander built-in tools list with Memory, Knowledge bases, Company brain and Governance templates switched on](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/agent-tools-switch.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=f7f502b7951074331274fb17b573ac02)

Agent settings, Core Skills: Governance templates under xpander built-in tools. Shown with sample data.

## Fill a template on a surface

A `template-form` block shows a published template as a form on one record, on any [surface](https://docs.xpander.ai/use/surfaces.md). Ask the agent that builds the surface to add it, for example: "Add the AI risk assessment form for AIS-0007 to this surface." The block in the surface manifest:

```json theme={"dark"}
{ "kind": "template-form", "template_id": "<template id>", "record_id": "<record id>" }
```

Add `"version": <n>` to pin the form to a version. When the pinned version is not the published one, the form takes no answers and asks the surface owner to update it.

The form reads and writes as the person who views the surface, with their own role. It shows the template name, the record it is on and the version.

* Required questions carry a red mark. **Submit** stays off until every required question has an answer. The footer counts them, for example "1 of 4 required answered". Clicking **Submit** too early marks each missing question **Required**.
* Answers save as a draft while the person types, and the draft is there when they come back.
* After submit, the form shows **Submitted** with the **Score** and the **Tier**. **Fill in again** makes a new response; the earlier one stays.

![AI risk assessment form on Invoice triage agent, version 3: required questions marked Required, footer 1 of 4 required answered, Submit off](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/form-required.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=144d5be18bc202d798719534fb912650)

A template-form block with required questions left: Submit stays off. Shown with sample data.

![Surface with a Submitted card: AI risk assessment was submitted on Invoice triage agent, Score 24, Tier High, and Fill in again](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/form-submitted.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=a3ad89acb8daa2698159fdeb299fc334)

The same block after submit: score and tier. Shown with sample data.

When the form cannot take answers, it says why:

| The form shows | Why |
| - | - |
| "You do not have access to this record." and "Ask the record owner for access." | The person cannot read the record, or the template writes to the record and the person is not its owner or creator, an owner or an admin |
| "Ask an owner or admin of this organization for access." | The person's role cannot answer templates |
| "Sign in to xpander to fill in the form." | The viewer is not signed in |
| "Open this surface in xpander to fill in the form." | The surface is open outside xpander Chat |
| "This template has no published version yet, so it cannot take answers." | The template was never published |
| "This template is not available. Ask the surface owner to check it." | The template id is wrong, or the template is not readable in this organization |

![AI risk assessment card: You do not have access to this record. Ask the record owner for access.](https://mintcdn.com/xpanderai-099931d1/BOuJ1R4YzkmHMOWc/images/run/governance-templates/form-no-access.png?fit=max\&auto=format\&n=BOuJ1R4YzkmHMOWc\&q=85\&s=c8e4224f52bfb39e814d90a29351a12a)

The form for a person with no access to the record. Shown with sample data.

## API

The public API has the same routes under `https://api.xpander.ai/v1/governance`. Send your key in `x-api-key`.

| Method and path | Does |
| - | - |
| `GET /v1/governance/templates` | Built-in and your templates, with their published and draft version numbers. Filters: `record_type` (key or id), `include_archived` |
| `POST /v1/governance/templates` | Create a template: `record_type`, `name`, optional `description` and `definition`. It starts as the draft of version 1 |
| `GET /v1/governance/templates/{id}` | The template, its published version, its draft (owner or admin) and its version list |
| `PATCH /v1/governance/templates/{id}` | Change `name`, `description` or `definition`. After a publish, a definition change starts the draft of the next version. Built-in templates answer 403 |
| `DELETE /v1/governance/templates/{id}` | Archive |
| `POST /v1/governance/templates/{id}/publish` | Publish the draft as the next version |
| `POST /v1/governance/templates/{id}/duplicate` | Owner or admin: copy any template, built-in included, into an editable draft. Optional `name` |
| `POST /v1/governance/templates/{id}/preview` | Score `answers` against the template (or an unsaved `definition`, owner or admin) and return the score, the tier, the missing required questions and the fields a submit would write. Saves nothing |
| `POST /v1/governance/responses` | Start a draft: `template_id`, `record_id`. When you already have an open draft on that record and template, it is returned with `resumed` |
| `GET /v1/governance/responses` | Responses, newest first. Filters: `record_id`, `template_id`, `started_by` (a person id or `me`), `state` (`draft` or `submitted`), `limit` (up to 200), `offset` |
| `GET /v1/governance/responses/{id}` | A response with its questions and its current score and tier |
| `PATCH /v1/governance/responses/{id}` | Save `answers` as `{question_id: value}`. `null` clears an answer. A wrong type answers 422 `invalid_answers`, naming each question, and saves nothing |
| `DELETE /v1/governance/responses/{id}` | Delete your own draft |
| `POST /v1/governance/responses/{id}/submit` | Check, score and submit. 422 `missing_required` lists the required questions with no answer |

The `definition` holds `sections`, each with `questions`. A question has an `id`, a `label`, a `type` (`text`, `long_text`, `number`, `boolean`, `date`, `select`, `multi_select` or `user`), optional `required`, `help` and `weight`, and for `select` and `multi_select` the `options` with their `points`. `score_formula` is `{"op": "sum" | "weighted_sum" | "min" | "max", "questions": [...]}`, `tier_bands` is a list of `{"name", "min", "max"}` (`max` null for "and above"), and `field_mapping` is `{"score": "<field>", "tier": "<field>"}`. An invalid definition answers 422 `invalid_definition` with the problem.

Example: start, answer and submit the built-in AI risk assessment. The answers give a score of 14, tier Medium.

```bash theme={"dark"}
curl -s -X POST 'https://api.xpander.ai/v1/governance/responses' \
  -H 'x-api-key: YOUR_API_KEY' -H 'Content-Type: application/json' \
  -d '{"template_id": "TEMPLATE_ID", "record_id": "RECORD_ID"}'

curl -s -X PATCH 'https://api.xpander.ai/v1/governance/responses/RESPONSE_ID' \
  -H 'x-api-key: YOUR_API_KEY' -H 'Content-Type: application/json' \
  -d '{"answers": {"data_sensitivity": "internal", "human_oversight": "human_on_the_loop", "exposure": "customers", "potential_harms": ["financial", "privacy"]}}'

curl -s -X POST 'https://api.xpander.ai/v1/governance/responses/RESPONSE_ID/submit' \
  -H 'x-api-key: YOUR_API_KEY'
```

Which key to use:

* A personal API key acts as its person, with that person's role, under the same rules as the app.
* The organization API key acts for the organization with an owner or admin's rights. Its drafts and writes name no person.
* Any other key, such as a key made for one agent, is refused with 403.

An organization without AI governance records gets 403 on every route, and an id of another organization gets 404.

## What a submit records

* The response with its answers, score and tier, under the person who submitted it.
* When the template writes to the record: the new field values, as a record version marked as set by the template, with the note `Set by <template> v<n>`. A value that does not change makes no new version.
* An entry `template_response_submitted` in the **Audit log**, with the record, template, version, score and tier.
* An answer saved after the submit is refused. A submitted response never changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.