# Remove document template field

Remove a template field or inserted document by field_id. Removes its definition and every occurrence together. Other wording remains unchanged. A template locked for signing cannot be edited.

POST https://api.brigg.app/v1/operations/documents.RemoveDocumentTemplateField

## Access & visibility

Allow `documents.RemoveDocumentTemplateField` on your API key.

**Acting member required.** Send `Brigg-Act-As` with an [approved member account ID](https://developer.brigg.app/authentication#member-delegation). The key supplies permissions; the member selects whose data is used.

The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `template_id` | string | Yes | Use a template_id from the template catalogue; this is not the ID of a generated document. [workspace.ListTemplates](https://developer.brigg.app/reference/workspace/ListTemplates). At least 1 character. |
| `field_id` | string | Yes | Exact field_id from items or inserts in ListDocumentTemplateFields for this same template_id. It is a stable name, not an array index, display label or file ID. Pattern: `^[a-z0-9][a-z0-9-]{0,63}$`. |

## Inspect, edit, then inspect again

Use [List document template fields](https://developer.brigg.app/reference/documents/ListDocumentTemplateFields) to get this template's generated fields, inserted documents and placement landmarks. A generated field contains an instruction; an insert references an existing text document. Use the returned field_id names and landmark_id values exactly.

Edits create a new template version and require template-management authority, not just read access. Pending or completed signing can lock the template. Existing generated documents are not regenerated by a template edit. The returned version_id records the changed template; it is not a precondition for another edit. Re-list before selecting a placement in the changed structure.

## Response

Returns **200 OK** with a JSON body.

Removes the definition and every placement of this field or insert from the template. Removing an insert leaves its underlying text document intact; deleting the field does not rewrite documents previously generated from this template. Re-list before another edit because landmarks can change.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ok` | boolean | Yes | Whether the action completed successfully. |
| `version_id` | string | Yes | New template version containing this edit. It is not a collaborative text-document version or an optimistic-lock token. Re-list template fields to inspect the current structure after the edit. |

## Errors & retries

Set `BRIGG_REQUEST_ID` once for each logical action. The samples send it as `Idempotency-Key`. Reuse the same value and body on retries, including after a timeout; a missing response does not prove the action failed.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. Supply a stable Idempotency-Key containing 1–200 characters. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. Supply Brigg-Act-As with a member authorized by the key’s delegation grant. The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. Reuse the original Idempotency-Key. |
| 409 | `signing_locked` | Pending or completed signing protects this template. Do not retry the edit unchanged. |
| 400 | `not_a_template` | Choose a document template from ListTemplates, not a generated document. |
| 404 | `no_active_version` | This template has no editable version. Open it in Brigg to complete its setup. |
| 404 | `slot_not_found` | Re-list this template's fields and inserts; use an exact current field_id. |

## Next steps

- [List document template fields](https://developer.brigg.app/reference/documents/ListDocumentTemplateFields)
- [Add document template field](https://developer.brigg.app/reference/documents/AddDocumentTemplateField)
- [Update document template field](https://developer.brigg.app/reference/documents/UpdateDocumentTemplateField)
- [List templates](https://developer.brigg.app/reference/workspace/ListTemplates)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Remove the project summary field

Inspect ListDocumentTemplateFields first and choose the exact field name. This edits the template, not one generated document.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.RemoveDocumentTemplateField' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  -H "Idempotency-Key: $BRIGG_REQUEST_ID" \
  --data-raw '{
  "template_id": "c_template_proposal",
  "field_id": "project-summary"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const requestId = process.env.BRIGG_REQUEST_ID;
if (!requestId) throw new Error("Set BRIGG_REQUEST_ID once per action and reuse it on retries.");

const response = await fetch("https://api.brigg.app/v1/operations/documents.RemoveDocumentTemplateField", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
    "Idempotency-Key": requestId, // Create once per action; reuse on retries.
  },
  body: JSON.stringify({
    "template_id": "c_template_proposal",
    "field_id": "project-summary"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

request_id = os.environ["BRIGG_REQUEST_ID"]  # Reuse for retries of this action.
payload = {
  "template_id": "c_template_proposal",
  "field_id": "project-summary"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.RemoveDocumentTemplateField",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
        "Idempotency-Key": request_id,  # Create once per action; reuse on retries.
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "ok": true,
  "version_id": "v_proposal_4"
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "template_id": {
      "type": "string",
      "minLength": 1,
      "description": "Use a template_id from the template catalogue; this is not the ID of a generated document. [workspace.ListTemplates](https://developer.brigg.app/reference/workspace/ListTemplates)."
    },
    "field_id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
      "description": "Exact field_id from items or inserts in ListDocumentTemplateFields for this same template_id. It is a stable name, not an array index, display label or file ID."
    }
  },
  "required": [
    "template_id",
    "field_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "template_id": "c_template_proposal",
      "field_id": "project-summary"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean",
      "description": "Whether the action completed successfully."
    },
    "version_id": {
      "type": "string",
      "description": "New template version containing this edit. It is not a collaborative text-document version or an optimistic-lock token. Re-list template fields to inspect the current structure after the edit."
    }
  },
  "required": [
    "ok",
    "version_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "ok": true,
      "version_id": "v_proposal_4"
    }
  ]
}
```

