# Forms

Create form templates, manage fields, send forms to contacts, and view submissions. Fields support CRM Variable Injection - map a field to a CRM variable so submitted values are written back to the linked deal, contact, or account before automations run.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /forms/templates

List all form templates.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-templates.md)

### GET /forms/templates/:id

Retrieve a form template with all fields inline.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-templates-id.md)

### POST /forms/templates

Create a form template.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates.md)

### PATCH /forms/templates/:id

Update a form template. Use settings to configure the completion screen, notification addresses, and PDF archive behaviour.

**Scopes:** `forms:write` — [full detail](./forms/patch-forms-templates-id.md)

### DELETE /forms/templates/:id

Delete a form template.

**Scopes:** `forms:write` — [full detail](./forms/delete-forms-templates-id.md)

### POST /forms/templates/:id/duplicate

Duplicate a form template with all its fields.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates-id-duplicate.md)

### POST /forms/templates/:id/archive

Toggle archive status on a form template.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates-id-archive.md)

### GET /forms/templates/:id/fields

List all fields for a form template, ordered by order_index.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-templates-id-fields.md)

### POST /forms/templates/:id/fields

Add a field to a form template. Use the content object to configure CRM Variable Injection.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates-id-fields.md)

### PATCH /forms/templates/:id/fields/:fieldId

Update a field on a form template. Use content to update CRM Variable Injection mapping.

**Scopes:** `forms:write` — [full detail](./forms/patch-forms-templates-id-fields-fieldId.md)

### DELETE /forms/templates/:id/fields/:fieldId

Remove a field from a form template.

**Scopes:** `forms:write` — [full detail](./forms/delete-forms-templates-id-fields-fieldId.md)

### POST /forms/templates/:id/fields/reorder

Reorder fields within a form template by providing an ordered array of field IDs.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates-id-fields-reorder.md)

### POST /forms/send

Send a form to a recipient via email. Costs 3 credits. At least one of deal_id, contact_id, or customer_id is required to link the submission to a CRM entity. CRM Variable Injection fires on submission when any linkage is set -- deal.* wirings are skipped if no deal_id is provided, but contact.* and account.* wirings fire against the submission-level contact/customer. Notification cascade: notify_emails (this call) -> template notifyEmails -> workspace form_completion_notify_emails -> sender fallback.

**Scopes:** `forms:send` — [full detail](./forms/post-forms-send.md)

### POST /forms/templates/:id/wiring

Bulk-update CRM variable wiring on a form template's fields in one atomic call. Optionally creates new workspace custom fields on company_settings before applying mappings -- useful for wiring AI-generated templates whose fields need new CRM targets. Fields not listed in mappings are untouched. Pass crm_variable: null to clear an existing wiring. Requires forms:write scope.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-templates-id-wiring.md)

### GET /forms/folders

List form template folders.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-folders.md)

### POST /forms/folders

Create a form template folder. name is required.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-folders.md)

### PATCH /forms/folders/:id

Update a form template folder.

**Scopes:** `forms:write` — [full detail](./forms/patch-forms-folders-id.md)

### DELETE /forms/folders/:id

Delete a form template folder.

**Scopes:** `forms:write` — [full detail](./forms/delete-forms-folders-id.md)

### GET /forms/prefills

List form prefills. Filter by template_id or deal_id.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-prefills.md)

### POST /forms/prefills

Create a form prefill. template_id is required.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-prefills.md)

### GET /forms/prefills/:id

Retrieve a form prefill with its values.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-prefills-id.md)

### POST /forms/prefills/:id/values

Upsert prefill values for form fields.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-prefills-id-values.md)

### GET /forms/submissions

List form submissions. Filter by template_id, deal_id, contact_id, customer_id, or status.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-submissions.md)

### GET /forms/submissions/:id

Retrieve a form submission with all response data.

**Scopes:** `forms:read` — [full detail](./forms/get-forms-submissions-id.md)

### POST /forms/submissions/:id/resend

Resend a form submission email to the original recipient.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-submissions-id-resend.md)

### POST /forms/submissions/:id/void

Void (expire) a form submission to prevent further responses.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-submissions-id-void.md)

### DELETE /forms/submissions/:id

Permanently delete a form submission and any uploaded files attached to its responses. Use delete_archived_pdf=true to also remove the auto-archived PDF from the Documents library (matched via source_form_submission_id). Unlike void, this removes the record entirely and cannot be undone. Requires forms:delete scope.

**Scopes:** `forms:delete` — [full detail](./forms/delete-forms-submissions-id.md)

### POST /forms/submissions/:id/render-pdf

Render a completed form submission to PDF and archive it in the Documents library. The PDF is auto-attached to the linked opportunity, contact, or account. Submission must have status "completed". Costs 1 credit per rendered page (typical intake form = 1-3 pages). All override params fall back to the form template settings, then platform defaults.

**Scopes:** `forms:write` — [full detail](./forms/post-forms-submissions-id-render-pdf.md)
