> ## Documentation Index
> Fetch the complete documentation index at: https://docs.serval.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Form

> Create a form for a team from module source (TSX importing "serval/forms"). The form lands as an unpublished draft unless is_published is set, in which case the module is compiled and every workflow it imports must already be published on the team.



## OpenAPI

````yaml /sections/api-reference/openapi-spec-v2.yaml post /v2/forms
openapi: 3.1.0
info:
  title: Serval Public API
  description: Serval Public API
  contact:
    name: Serval
    url: https://serval.com
    email: support@serval.com
  license:
    name: Serval License
    url: https://serval.com/license
  version: 2.0.0
servers:
  - url: https://public.api.serval.com
security:
  - BearerAuth: []
tags:
  - name: Access Policy API
  - name: Access Policy Approval Procedure API
  - name: Access Profile API
  - name: Access Relationship API
  - name: Access Request API
  - name: Agent API
  - name: App Instance API
  - name: App Resource API
  - name: App Resource Role API
  - name: Approval Delegation API
  - name: Approval Request API
  - name: Audit Log API
  - name: Change Blackout API
  - name: Change Model API
  - name: Custom Field API
  - name: Custom Service API
  - name: Entity API
  - name: Entity Field Mapping API
  - name: Entity Ingestion Config API
  - name: Entity Scan Action API
  - name: Entity Type API
  - name: Folder API
  - name: Forms API
  - name: Group API
  - name: Guidance API
  - name: Help Agent API
  - name: Journey API
  - name: Knowledge API
  - name: Knowledge Base API
  - name: Report API
  - name: SLA API
  - name: Schedule API
  - name: Tag API
  - name: Team API
  - name: Team Group API
  - name: Team User API
  - name: Ticket API
  - name: Topic API
  - name: User API
  - name: User Relationship API
  - name: Workflow API
  - name: Workflow Approval Procedure API
  - name: Workflow Run API
paths:
  /v2/forms:
    post:
      tags:
        - Forms API
      summary: Create Form
      description: >-
        Create a form for a team from module source (TSX importing
        "serval/forms"). The form lands as an unpublished draft unless
        is_published is set, in which case the module is compiled and every
        workflow it imports must already be published on the team.
      operationId: svrelay.publicv2.PublicAPIServiceV2.CreateForm
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/svflow.publicapi.CreateFormRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/svflow.publicapi.CreateFormResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    svflow.publicapi.CreateFormRequest:
      type: object
      properties:
        teamId:
          type: string
          title: team_id
          description: The ID of the team.
          x-stainless-terraform-configurability: required
        name:
          type: string
          title: name
          description: >-
            Display name of the form, shown wherever the form is listed. Names
            of
             published items are unique per team across forms, workflows, and skills;
             a taken name is suffixed ("Order laptop 2") rather than rejected.
          x-stainless-terraform-configurability: required
        description:
          type: string
          title: description
          description: What the form is for, shown under the name.
          x-stainless-terraform-configurability: optional
        content:
          type: string
          title: content
          description: |-
            The form module source: TSX importing "serval/forms", exporting
             `main = view({ fn })`. Saved as a draft as-is; it is compiled when the
             form is published, so a broken draft can be saved and fixed later.
          x-stainless-terraform-configurability: required
        isPublished:
          type:
            - boolean
            - 'null'
          title: is_published
          description: |-
            Whether to publish the form after creation (optional). Publishing
             compiles the module and resolves every workflow it imports against the
             team's published workflows.
          x-stainless-terraform-configurability: optional
        scopedId:
          type:
            - string
            - 'null'
          title: scoped_id
          description: |-
            Copy-invariant identity to create the form under ("form_" + 22
             alphanumerics). Leave unset and the server mints one. Set it to the
             source form's scoped_id when pushing configuration between teams or
             environments: the copy then answers to the same scoped id as its source,
             so the next push resolves it and updates in place instead of creating a
             second form that collides on name. Must not already be in use on the
             team.
          x-stainless-terraform-configurability: optional
      title: CreateFormRequest
      required:
        - teamId
        - name
        - content
      additionalProperties: false
    svflow.publicapi.CreateFormResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/svflow.pubapimodels.Form'
          title: data
          description: The created form.
          x-stainless-terraform-configurability: optional
      title: CreateFormResponse
      additionalProperties: false
    svflow.pubapimodels.Form:
      type: object
      properties:
        id:
          type: string
          title: id
          description: The ID of the form.
          readOnly: true
          x-stainless-terraform-configurability: computed
        teamId:
          type: string
          title: team_id
          description: The ID of the team that the form belongs to.
          x-stainless-terraform-configurability: optional
        name:
          type: string
          title: name
          description: The name of the form.
          x-stainless-terraform-configurability: optional
        description:
          type: string
          title: description
          description: A description of the form.
          x-stainless-terraform-configurability: optional
        content:
          type: string
          title: content
          description: |-
            The form module source: TSX importing "serval/forms", exporting
             `main = view({ fn })`. Compiled when the form is published.
          x-stainless-terraform-configurability: optional
        isPublished:
          type: boolean
          title: is_published
          description: Whether the form is published. Set to true to publish the form.
          x-stainless-terraform-configurability: computed_optional
        hasUnpublishedChanges:
          type: boolean
          title: has_unpublished_changes
          description: >-
            Whether there are unpublished changes to the form (computed by
            server).
          readOnly: true
          x-stainless-terraform-configurability: computed
        isEnabled:
          type: boolean
          title: is_enabled
          description: >-
            Whether the form accepts new sessions. A form that is not enabled
            keeps
             its versions and its published state; it just stops being fillable.
          x-stainless-terraform-configurability: computed_optional
        scopedId:
          type: string
          title: scoped_id
          description: |-
            The copy-invariant scoped ID of the form (e.g. "form_..."), stable
             across cross-team copies. Set it explicitly at create time to push a
             form between teams or environments under one identity; resolve it back
             to a form id with ResolveScopedRefs.
          readOnly: true
          x-stainless-terraform-configurability: computed
        folderId:
          type:
            - string
            - 'null'
          title: folder_id
          description: |-
            The ID of the folder the form lives in, if any. Unset means the form
             lives at the team root.
          readOnly: true
          x-stainless-terraform-configurability: computed
        workflowIds:
          type: array
          items:
            type: string
            readOnly: true
          title: workflow_ids
          description: >-
            The IDs of the workflows this form's content references — the
            workflow
             its submit handler runs, plus any it queries for data. Extracted from
             the module source on every save, so they describe the same version of
             the form the other fields do.
          readOnly: true
          x-stainless-terraform-configurability: computed
      title: Form
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````