Skip to content

API reference

Add document template field

documents.AddDocumentTemplateFieldWriteMember delegation

Add a named field or a text-document insert to a template. Choose before or after a landmark returned by ListDocumentTemplateFields, or end. A field is filled from its instruction; an insert copies its selected text document at a pinned version when a document is generated. Returns the stable field ID and draft version.

POST/v1/operations/documents.AddDocumentTemplateField
On this page

Access & visibility

Allow documents.AddDocumentTemplateField on your API key.

Acting member required. Send Brigg-Act-As with an approved member account ID. 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 · Choose permissions

Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.

kind = "field"

template_idstringRequired

Use a template_id from the template catalogue; this is not the ID of a generated document. workspace.ListTemplates.

At least 1 character.

kind"field"Required

field adds generated text from an instruction; insert references an existing collaborative text document. Choose one request variant.

Always "field".

instructionstringRequired

Instructions used to fill this template field.

At least 1 character. At most 500 characters.

placementobject (2 variants)Required

Place the field before or after a named landmark, or at the end of the template. List the current landmarks first. No HTML or byte offset is accepted.

Nested fields

Variant 1

positionstringRequired

Where to place the new field or insert relative to a landmark, or at the end.

Allowed: "before", "after".

landmark_idstringRequired

Stable insertion landmark from documents.ListDocumentTemplateFields. Use it with position before or after; position end needs no landmark.

Pattern: ^[a-z0-9][a-z0-9-]{0,63}$.

position = "end"

position"end"Required

Where to place the new field or insert relative to a landmark, or at the end.

Always "end".

kind = "insert"

template_idstringRequired

Use a template_id from the template catalogue; this is not the ID of a generated document. workspace.ListTemplates.

At least 1 character.

kind"insert"Required

field adds generated text from an instruction; insert references an existing collaborative text document. Choose one request variant.

Always "insert".

file_idstringRequired

An existing collaborative text document from ListDocuments (kind=text_document). An uploaded PDF is not an insertable text document.

At least 1 character.

layoutstringOptional

Display layout for the inserted text document.

Allowed: "one-column", "two-column", "compact".

placementobject (2 variants)Required

Place the field before or after a named landmark, or at the end of the template. List the current landmarks first. No HTML or byte offset is accepted.

Nested fields

Variant 1

positionstringRequired

Where to place the new field or insert relative to a landmark, or at the end.

Allowed: "before", "after".

landmark_idstringRequired

Stable insertion landmark from documents.ListDocumentTemplateFields. Use it with position before or after; position end needs no landmark.

Pattern: ^[a-z0-9][a-z0-9-]{0,63}$.

position = "end"

position"end"Required

Where to place the new field or insert relative to a landmark, or at the end.

Always "end".

Inspect, edit, then inspect again

Use List document template fields 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.

field_idstringRequired

Server-assigned stable field or insert name. Keep it for subsequent instruction/layout changes or removal.

version_idstringRequired

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 and safe retries and limits.

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.
409 anchor_not_found The placement landmark no longer exists. Re-list template fields before selecting a position.
409 anchor_ambiguous The landmark does not uniquely identify a position. Inspect the template and choose another current landmark or position end.
400 not_a_text_document The insert must reference a collaborative text document; an uploaded PDF or generated document is not valid here.

Next steps

Download OpenAPI · Versioning & retirement

JSON schemas

Use the complete schemas for validation or client generation.

Full request JSON schema
{
  "anyOf": [
    {
      "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](/reference/workspace/ListTemplates)."
        },
        "kind": {
          "type": "string",
          "const": "field",
          "description": "field adds generated text from an instruction; insert references an existing collaborative text document. Choose one request variant."
        },
        "instruction": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "description": "Instructions used to fill this template field."
        },
        "placement": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "position": {
                  "type": "string",
                  "enum": [
                    "before",
                    "after"
                  ],
                  "description": "Where to place the new field or insert relative to a landmark, or at the end."
                },
                "landmark_id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
                  "description": "Stable insertion landmark from documents.ListDocumentTemplateFields. Use it with position before or after; position end needs no landmark."
                }
              },
              "required": [
                "position",
                "landmark_id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "position": {
                  "type": "string",
                  "const": "end",
                  "description": "Where to place the new field or insert relative to a landmark, or at the end."
                }
              },
              "required": [
                "position"
              ],
              "additionalProperties": false
            }
          ],
          "description": "Place the field before or after a named landmark, or at the end of the template. List the current landmarks first. No HTML or byte offset is accepted."
        }
      },
      "required": [
        "template_id",
        "kind",
        "instruction",
        "placement"
      ],
      "additionalProperties": false
    },
    {
      "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](/reference/workspace/ListTemplates)."
        },
        "kind": {
          "type": "string",
          "const": "insert",
          "description": "field adds generated text from an instruction; insert references an existing collaborative text document. Choose one request variant."
        },
        "file_id": {
          "type": "string",
          "minLength": 1,
          "description": "An existing collaborative text document from ListDocuments (kind=text_document). An uploaded PDF is not an insertable text document."
        },
        "layout": {
          "type": "string",
          "enum": [
            "one-column",
            "two-column",
            "compact"
          ],
          "description": "Display layout for the inserted text document."
        },
        "placement": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "position": {
                  "type": "string",
                  "enum": [
                    "before",
                    "after"
                  ],
                  "description": "Where to place the new field or insert relative to a landmark, or at the end."
                },
                "landmark_id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
                  "description": "Stable insertion landmark from documents.ListDocumentTemplateFields. Use it with position before or after; position end needs no landmark."
                }
              },
              "required": [
                "position",
                "landmark_id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "position": {
                  "type": "string",
                  "const": "end",
                  "description": "Where to place the new field or insert relative to a landmark, or at the end."
                }
              },
              "required": [
                "position"
              ],
              "additionalProperties": false
            }
          ],
          "description": "Place the field before or after a named landmark, or at the end of the template. List the current landmarks first. No HTML or byte offset is accepted."
        }
      },
      "required": [
        "template_id",
        "kind",
        "file_id",
        "placement"
      ],
      "additionalProperties": false
    }
  ],
  "examples": [
    {
      "template_id": "c_template_proposal",
      "kind": "field",
      "instruction": "Summarize the project objectives and agreed deliverables.",
      "placement": {
        "position": "end"
      }
    }
  ]
}
Full response JSON schema
{
  "type": "object",
  "properties": {
    "field_id": {
      "type": "string",
      "description": "Server-assigned stable field or insert name. Keep it for subsequent instruction/layout changes or removal."
    },
    "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": [
    "field_id",
    "version_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "field_id": "field-2",
      "version_id": "v_proposal_4"
    }
  ]
}

Search by operation name or what you want to build.

Use arrow keys to browse. Enter opens a result.