Forms API

ProBeya includes a built-in multi-page form builder for data collection, surveys, and intake workflows. Forms support conditional logic, public submission URLs, auto-ticket creation, and submission analytics. The forms system is currently tRPC-only (no REST endpoints), accessible from the ProBeya web client and through direct tRPC calls.

Architecture

Forms follow a hierarchical structure:

Form
  |-- FormPage (ordered by sortOrder)
  |     |-- FormField (ordered by sortOrder)
  |-- FormSubmission
        |-- FormSubmissionValue (one per field)

Each form belongs to an organization and optionally links to a board for auto-creating items from submissions.

Procedures


forms.create

Create a new form definition. Automatically creates the first page (“Page 1”).

Type: Mutation Auth: Authenticated user with org context

Input:

NameTypeRequiredDescription
titlestringYesForm display title
slugstringYesURL-safe slug (unique within org)
descriptionstringNoForm description shown to respondents
boardIdstringNoLink to a board for item auto-creation

forms.update

Update form settings, status, metadata, or linked board.

Type: Mutation Auth: Authenticated user with org context

Input:

NameTypeRequiredDescription
idstringYesForm ID
titlestringNoNew title
slugstringNoNew slug (uniqueness checked)
descriptionstringNoNew description
boardIdstringNoNew linked board ID
statusstringNodraft, published, closed
settingsobjectNoForm settings (see below)

forms.delete

Delete a form and all its pages, fields, and submissions (cascade).

Type: Mutation Auth: Authenticated user with org context


forms.getById

Get a form with all pages, fields, and creator info.

Type: Query Auth: Authenticated user with org context


forms.list

List forms with filtering and pagination.

Type: Query Auth: Authenticated user with org context

Input:

NameTypeRequiredDescription
statusstringNoFilter by form status
boardIdstringNoFilter by linked board
sortBystringNocreatedAt, updatedAt, title (default: createdAt)
sortOrderstringNoasc or desc (default: desc)
pagenumberNoPage number (default: 1)
limitnumberNoResults per page (default: 25, max: 100)

forms.publish

Publish a draft form, making it live and accepting submissions. Validates that the form has at least one field.

Type: Mutation Auth: Authenticated user with org context Precondition: Form status must be draft or closed


forms.close

Close a published form, stopping new submissions.

Type: Mutation Auth: Authenticated user with org context Precondition: Form status must be published


forms.submit (Public)

Submit a form response. This is a public endpoint — no authentication required. The organization is resolved from the organizationSlug parameter.

Type: Mutation Auth: Public (no authentication required)

Input:

NameTypeRequiredDescription
organizationSlugstringYesOrganization slug (from subdomain)
formSlugstringYesForm URL slug
valuesarrayYesArray of { fieldId, value } objects
respondentEmailstringNoRespondent email
respondentNamestringNoRespondent name
isCompletebooleanNoWhether submission is final (validates required fields)

Response:

{
  "submissionId": "clx9fs001",
  "message": "Thank you for your submission!",
  "redirectUrl": "https://acme.com/thank-you"
}

forms.getSubmissions

List submissions for a form with pagination.

Type: Query Auth: Authenticated user with org context


forms.getAnalytics

Get form analytics including submission counts by status, completion rate, and daily submission trends (last 30 days).

Type: Query Auth: Authenticated user with org context

Response shape:

{
  "totalSubmissions": 156,
  "completeCount": 142,
  "partialCount": 14,
  "completionRate": 91.0,
  "recentDaily": [
    { "day": "2026-03-29", "count": 8 },
    { "day": "2026-03-30", "count": 12 }
  ]
}

Page and Field Management

ProcedureDescription
forms.upsertPageCreate or update a form page
forms.deletePageRemove a page from a form
forms.upsertFieldCreate or update a field on a page
forms.deleteFieldRemove a field from a page
forms.getPublicFormGet form structure for public rendering (no auth)

Form Settings

The settings JSONB field supports:

KeyTypeDescription
maxSubmissionsnumberMaximum allowed submissions
closedMessagestringMessage when max reached
confirmationMessagestringThank you message after submit
redirectUrlstringURL to redirect after submit
createTicketOnSubmitbooleanAuto-create a support ticket

Field Types

Supported form field types: text, textarea, number, email, phone, url, date, datetime, select, multiselect, checkbox, radio, rating, file, signature, section_header.