> ## 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.

# Crear o reemplazar un formulario

> Hace upsert por `key`. Un campo de contraseña solo se acepta con un envío external; wondeya nunca almacena una contraseña.



## OpenAPI

````yaml /openapi.es.json post /v1/forms
openapi: 3.0.0
info:
  title: API para desarrolladores de wondeya
  description: >-
    La API REST pública para construir sobre wondeya: agentes, proyectos,
    páginas, conocimiento, recursos, marca, tema, uso, recuperación y chat,
    autenticada mediante una clave de API del espacio de trabajo
    (`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: Producción
  - url: http://localhost:8080
    description: Desarrollo
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: Crear o reemplazar un formulario
      description: >-
        Hace upsert por `key`. Un campo de contraseña solo se acepta con un
        envío external; wondeya nunca almacena una contraseña.
      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: Se alcanzó el límite de formularios
      security:
        - api-key: []
components:
  schemas:
    UpsertFormDto:
      type: object
      properties:
        key:
          type: string
          description: El id en kebab-case que emite el modelo.
        name:
          type: string
          maxLength: 120
          description: Nombre administrativo. Si se omite, se conserva el nombre existente.
        agentId:
          type: object
          nullable: true
          description: >-
            El agente al que pertenece este formulario; `null` = el pool del
            espacio de trabajo.
        description:
          type: string
          maxLength: 600
          description: >-
            Cuándo ofrecer el formulario. En inglés, salvo que se indique
            descriptionLocale.
        descriptionLocale:
          type: string
          enum:
            - es
            - en
          description: >-
            Idioma de las instrucciones proporcionadas. Si se omite, se usa
            inglés para mantener la compatibilidad.
        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: Un id de link del agente, hacia donde navega el éxito.
        notifyOwners:
          type: boolean
      required:
        - key
        - description
        - fields
        - submit
        - successMessage
    PublicFormDto:
      type: object
      properties:
        id:
          type: string
        agentId:
          type: object
          nullable: true
        key:
          type: string
        name:
          type: string
          maxLength: 120
        description:
          type: string
        descriptionText:
          $ref: '#/components/schemas/FormDescriptionTextDto'
        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
        - descriptionText
        - fields
        - submit
        - successMessage
        - successLinkId
        - notifyOwners
        - createdAt
        - updatedAt
    FormFieldDto:
      type: object
      properties:
        key:
          type: string
          description: La key del campo, en kebab-case.
        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 solo: la API propia del negocio a la que el navegador hace
            POST.
          maxLength: 400
        method:
          type: string
          enum:
            - POST
        tokenField:
          type: object
          nullable: true
          maxLength: 64
          description: >-
            external solo: la clave JSON que lleva un token de sesión para el
            auto-login.
      required:
        - mode
    LocalizedTextDto:
      type: object
      properties:
        es:
          type: string
          maxLength: 200
        en:
          type: string
          maxLength: 200
    FormDescriptionTextDto:
      type: object
      properties:
        es:
          type: string
          maxLength: 600
        en:
          type: string
          maxLength: 600
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: opaque
      type: http
      description: >-
        Una clave de API del espacio de trabajo: wdy_live_… / wdy_test_…. Se
        crea en POST /workspaces/{tenantId}/keys y se muestra exactamente una
        vez.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.