User Forms

Documentation for User Forms

Base path: /api/v1/user-forms

User forms are human-in-the-loop approval/review forms generated by workflow steps that require human review before proceeding. When a workflow step is configured as a human input step, it pauses execution and creates a form for review.


Endpoints Overview

MethodPathAuthDescription
GET/api/v1/user-formsJWTList forms for the authenticated user
GET/api/v1/user-forms/:formIdJWTGet form HTML content
POST/api/v1/user-forms/:activityRunId/:statusJWTSubmit a form approval/rejection

GET /api/v1/user-forms

Lists the user forms the authenticated user may see. A form is listed when any of these holds:

  • its workflow is in one of the user's organizations (every workflow there with the approval:read-org permission, otherwise only workflows the user created);
  • it is addressed to the user's verified login email, in any organization;
  • the user decided it (reviewedBy), in any organization.

Authentication

Requires JWT (authMiddleware + activeOrgPreferenceMiddleware).

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number (min: 1)
limitnumber20Items per page (min: 1, max: 100)
searchstring–Search by workflow name (case-insensitive)
sortBystring"createdAt"Sort field: createdAt, updatedAt, workflowName, status
sortOrderstring"desc"Sort direction: asc, desc
statusstring–Filter by status: pending, approved, rejected

Response 200 OK

json

Form object fields:

FieldTypeDescription
idstring (UUID)Form ID
workflowIdstring (UUID)Associated workflow ID
workflowNamestringWorkflow name
workflowDescriptionstring | nullWorkflow description
workflowRunIdstring (UUID)The workflow run that created this form
activityRunIdstring (UUID)The activity (step) run that paused for this form
workflowStepNamestringName of the step requiring approval
workflowStepDescriptionstring | nullStep description
formTitlestring | nullHeadline extracted from the form HTML
formDescriptionstring | nullFirst body paragraph from the form HTML (task summary)
workflowOwnerUserIdstring | nullKeycloak sub of the AI Employee owner (workflows.created_by)
status"pending" | "approved" | "rejected" | "timeout" | "cancelled"Review status
reviewedBystring | nullUser ID of reviewer (if reviewed)
reviewedAtstring (ISO 8601) | nullWhen the form was reviewed
createdAtstring (ISO 8601)When the form was created
updatedAtstring (ISO 8601)Last update time

Workbench resolves workflowOwnerUserId to the owner's login email for the queue label Owner.


GET /api/v1/user-forms/:formId

Returns the HTML content of a user form.

Authentication

Requires a signed-in user: a JWT, or a custom API key with x-source: external (see Authentication). Any signed-in user may read a form; the form ID alone is not a credential. Without one the answer is 401 Unauthorized.

Path Parameters

ParameterTypeDescription
formIdstring (UUID)Form ID

Response 200 OK

json
FieldTypeDescription
htmlstringThe form's HTML definition, ready to be rendered in a browser

Usage Pattern

Forms are typically rendered in an iframe or opened in a new browser tab. The HTML includes a form that submits to the approve/reject endpoint.


POST /api/v1/user-forms/:activityRunId/:status

Submits a form approval or rejection. This resumes the paused workflow with the form data. In the app, it is submitted when the reviewer clicks approve/reject in the form.

Authentication

Requires a signed-in user: a JWT, or a custom API key with x-source: external (see Authentication). Being signed in is enough to decide; there is no approver or organization check. The decision is recorded against that user as reviewedBy (for an API key, the user who created it). Without a credential the answer is 401 Unauthorized.

Path Parameters

ParameterTypeDescription
activityRunIdstring (UUID)Activity run ID associated with the form
status"approve" | "reject"The approval decision

Request Body (multipart/form-data)

Any form field values filled in by the reviewer. File fields are automatically uploaded to object storage, and a presigned URL replaces the file in the submitted data.

Response

Returns an HTML page confirming submission:

  • If successful: success page with "Form Submitted Successfully"
  • If already submitted: info page with "Form Already Submitted"

The HTTP status is 200 OK in both cases (the response is HTML, suitable for browser navigation).

Errors

StatusReason
401 UnauthorizedNo valid JWT or API key
404 Not FoundActivity run or workflow run not found
500 Internal Server ErrorWorkflow has no Temporal workflow association

Workflow Integration Notes

User forms appear during workflow execution when:

  1. A workflow step has is_human_input_step: true in its definition
  2. The executor pauses the Temporal workflow and creates a form record
  3. The form link is communicated to the reviewer (typically via email or notification); the reviewer signs in to open it
  4. The reviewer submits the form, which sends a Temporal signal to resume execution

The form data (including reviewer inputs) is passed back to the workflow step as the step's input for subsequent processing.

api-docs/user-forms