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

# Create or replace a form

> Upserts by `key`. A password field is only accepted with an external submit; wondeya never stores a password.



## OpenAPI

````yaml /openapi.json post /v1/forms
openapi: 3.0.0
info:
  title: wondeya Developer API
  description: >-
    The public REST API for building on wondeya: agents, projects, pages,
    knowledge, assets, brand, theme, usage, retrieval and chat, authenticated by
    a workspace API key (`Authorization: Bearer wdy_live_…`).
  version: 0.1.0
  contact:
    name: wondeya
    url: https://wondeya.com
    email: team@wondeya.com
  license:
    name: Proprietary
    url: https://wondeya.com/terms
servers:
  - url: https://api.wondeya.com
    description: Production
  - url: http://localhost:8080
    description: Development
security: []
tags:
  - name: Identity
  - name: Agents
  - name: Projects
  - name: Pages
  - name: Knowledge
  - name: Assets
  - name: Brand
  - name: Usage
  - name: Chat
paths:
  /v1/forms:
    post:
      tags:
        - Forms
      summary: Create or replace a form
      description: >-
        Upserts by `key`. A password field is only accepted with an external
        submit; wondeya never stores a password.
      operationId: PublicFormsController_upsert_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertFormDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicFormDto'
        '409':
          description: The form limit is reached
      security:
        - api-key: []
components:
  schemas:
    UpsertFormDto:
      type: object
      properties:
        key:
          type: string
          description: The kebab-case id the model emits.
        agentId:
          type: object
          nullable: true
          description: The agent this form belongs to; `null` = the workspace pool.
        description:
          type: string
          maxLength: 600
          description: 'ENGLISH, prompt-facing: when to offer it.'
        fields:
          maxItems: 8
          type: array
          items:
            $ref: '#/components/schemas/FormFieldDto'
        submit:
          $ref: '#/components/schemas/FormSubmitDto'
        successMessage:
          $ref: '#/components/schemas/LocalizedTextDto'
        successLinkId:
          type: object
          nullable: true
          description: A link id from the agent, where success navigates.
        notifyOwners:
          type: boolean
      required:
        - key
        - description
        - fields
        - submit
        - successMessage
    PublicFormDto:
      type: object
      properties:
        id:
          type: string
        agentId:
          type: object
          nullable: true
        key:
          type: string
        description:
          type: string
        fields:
          type: array
          items:
            $ref: '#/components/schemas/FormFieldDto'
        submit:
          $ref: '#/components/schemas/FormSubmitDto'
        successMessage:
          $ref: '#/components/schemas/LocalizedTextDto'
        successLinkId:
          type: object
          nullable: true
        notifyOwners:
          type: boolean
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - agentId
        - key
        - description
        - fields
        - submit
        - successMessage
        - successLinkId
        - notifyOwners
        - createdAt
        - updatedAt
    FormFieldDto:
      type: object
      properties:
        key:
          type: string
          description: The kebab-case key of the field.
        kind:
          type: string
          enum:
            - text
            - email
            - phone
            - textarea
            - select
            - checkbox
            - password
        label:
          $ref: '#/components/schemas/LocalizedTextDto'
        required:
          type: boolean
        placeholder:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/LocalizedTextDto'
        options:
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/LocalizedTextDto'
        minLength:
          type: object
          nullable: true
        maxLength:
          type: object
          nullable: true
        pattern:
          type: object
          nullable: true
          maxLength: 200
        confirms:
          type: object
          nullable: true
          maxLength: 64
      required:
        - key
        - kind
        - label
        - required
    FormSubmitDto:
      type: object
      properties:
        mode:
          type: string
          enum:
            - internal
            - external
        url:
          type: string
          description: 'external only: the tenant API the browser POSTs to.'
          maxLength: 400
        method:
          type: string
          enum:
            - POST
        tokenField:
          type: object
          nullable: true
          maxLength: 64
          description: 'external only: the JSON key carrying a session token for auto-login.'
      required:
        - mode
    LocalizedTextDto:
      type: object
      properties:
        es:
          type: string
          maxLength: 200
        en:
          type: string
          maxLength: 200
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: opaque
      type: http
      description: >-
        A workspace API key: wdy_live_… / wdy_test_…. Created at POST
        /workspaces/{tenantId}/keys and shown exactly once.

````