openapi: 3.1.0
info:
  title: Formbricks API
  description: Manage Formbricks resources programmatically.
  version: 2.0.0
servers:
  - url: https://app.formbricks.com/api/v2
    description: Formbricks Cloud
tags:
  - name: Health
    description: Operations for checking critical application dependencies health status.
  - name: Roles
    description: Operations for managing roles.
  - name: Me
    description: Operations for managing your API key.
  - name: Management API - Responses
    description: Operations for managing responses.
  - name: Management API - Contacts
    description: Operations for managing contacts.
  - name: Management API - Contact Attributes
    description: Operations for managing contact attributes.
  - name: Management API - Contact Attribute Keys
    description: Operations for managing contact attribute keys.
  - name: Management API - Surveys
    description: Operations for managing surveys.
  - name: Management API - Surveys - Contact Links
    description: Operations for generating personalized survey links for contacts.
  - name: Management API - Webhooks
    description: Operations for managing webhooks.
  - name: Organizations API - Teams
    description: Operations for managing teams.
  - name: Organizations API - Project Teams
    description: Operations for managing project teams.
  - name: Organizations API - Users
    description: Operations for managing users.
security:
  - apiKeyAuth: []
paths:
  /client/{environmentId}/responses/{responseId}:
    put:
      security: []
      description: Update an existing response for example when you want to mark a
        response as finished or you want to change an existing response's value.
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
          description: The ID of the environment.
        - in: path
          name: responseId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              example:
                data:
                  tcgls0063n8ri7dtrbnepcmz: Who? Who? Who?
                finished: true
              type: object
      responses:
        "200":
          content:
            application/json:
              example:
                data: {}
              schema:
                type: object
          description: OK
        "404":
          content:
            application/json:
              example:
                code: not_found
                details:
                  resource_type: Response
                message: Response not found
              schema:
                type: object
          description: Not Found
      summary: Update Response
      tags:
        - Client API - Response
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/responses:
    post:
      security: []
      description: Create a response for a survey and its fields with the user's
        responses. The userId & meta here is optional
      requestBody:
        content:
          application/json:
            schema:
              example:
                surveyId: survey123
                responses: {}
              type: object
      responses:
        "201":
          content:
            application/json:
              example:
                responseId: response123
              schema:
                type: object
          description: Created
      summary: Create Response
      tags:
        - Client API - Response
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/contacts/{userId}/attributes:
    put:
      security: []
      description: Update a contact's attributes in Formbricks to keep them in sync
        with your app or when you want to set a custom attribute in Formbricks.
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
        - in: path
          name: userId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              example:
                attributes: {}
              type: object
      responses:
        "200":
          content:
            application/json:
              examples:
                example-0: {}
                example-1: {}
              schema:
                type: object
          description: OK
        "500":
          content:
            application/json:
              example:
                code: internal_server_error
                details: {}
                message: "Unable to complete request: Expected"
              schema:
                type: object
          description: Internal Server Error
      summary: Update Contact (Attributes)
      tags:
        - Client API - Contacts
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/identify/contacts/{userId}:
    get:
      security: []
      description: Retrieves a contact's state including their segments, displays,
        responses and other tracking information. If the contact doesn't exist,
        it will be created.
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
        - in: path
          name: userId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              example:
                userId: user123
                state: active
              schema:
                type: object
          description: OK
      summary: Get Contact State
      tags:
        - Client API - Contacts
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/displays:
    post:
      security: []
      description: Create a new display for a valid survey ID. If a userId is passed,
        the display is linked to the user.
      requestBody:
        content:
          application/json:
            schema:
              example:
                surveyId: survey123
                userId: user123
              type: object
      responses:
        "201":
          content:
            application/json:
              example:
                displayId: display123
              schema:
                type: object
          description: Created
      summary: Create Display
      tags:
        - Client API - Display
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/environment:
    get:
      security: []
      description: "Retrieves the environment state to be used in Formbricks SDKs.
        **Cache Behavior**: This endpoint uses server-side caching with a
        **5-minute TTL (Time To Live)**. Any changes to surveys, action classes,
        project settings, or other environment data will take up to 5 minutes to
        reflect in the API response. This caching is implemented to improve
        performance for high-frequency SDK requests."
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
          description: The ID of the environment.
      responses:
        "200":
          content:
            application/json:
              example:
                environmentId: env123
                state: active
              schema:
                type: object
          description: OK
      summary: Get Environment State
      tags:
        - Client API - Environment
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/user:
    post:
      security: []
      description: Endpoint for creating or identifying a user within the specified
        environment. If the user already exists, this will identify them and
        potentially update user attributes. If they don't exist, it will create
        a new user.
      requestBody:
        content:
          application/json:
            schema:
              example:
                userId: user123
                attributes: {}
              type: object
      responses:
        "200":
          content:
            application/json:
              example:
                userId: user123
                state: identified
              schema:
                type: object
          description: OK
      summary: Create or Identify User
      tags:
        - Client API - User
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks Client
  /client/{environmentId}/storage:
    post:
      security: []
      summary: Upload Private File
      description: API endpoint for uploading private files. Uploaded files are kept
        private so that only users with access to the specified environment can
        retrieve them. The endpoint validates the survey ID, file name, and file
        type from the request body, and returns a signed URL for S3 uploads
        along with a local upload URL.
      tags:
        - Client API - File Upload
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
          description: The ID of the environment.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                surveyId:
                  type: string
                  description: The ID of the survey associated with the file.
                fileName:
                  type: string
                  description: The name of the file to be uploaded.
                fileType:
                  type: string
                  description: The MIME type of the file.
              required:
                - surveyId
                - fileName
                - fileType
              example:
                surveyId: cm7pr0x2y004o192zmit8cjvb
                fileName: example.jpg
                fileType: image/jpeg
      responses:
        "200":
          description: OK - Returns the signed URL, presigned fields, updated file name,
            and file URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      signedUrl:
                        type: string
                        description: Presigned POST URL for uploading the file to S3-compatible storage.
                      presignedFields:
                        type: object
                        additionalProperties:
                          type: string
                        description: Presigned POST form fields required by S3-compatible storage.
                      updatedFileName:
                        type: string
                        description: The updated file name after processing.
                      fileUrl:
                        type: string
                        description: URL where the uploaded file can be accessed.
                example:
                  data:
                    signedUrl: https://s3.example.com/bucket
                    presignedFields:
                      key: uploads/env-id/private/file--fid--uuid.jpg
                      policy: <base64-policy>
                      x-amz-algorithm: AWS4-HMAC-SHA256
                    updatedFileName: file--fid--b153ba3e-6602-4bb3-bed9-211b5b1ae463.jpg
                    fileUrl: https://app.formbricks.com/storage/cm1ubebtj000614kqe4hs3c67/private/file--fid--b153ba3e-6602-4bb3-bed9-211b5b1ae463.jpg
        "400":
          description: Bad Request - One or more required fields are missing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Detailed error message.
                example:
                  error: fileName is required
        "404":
          description: Not Found - The specified survey or organization does not exist.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Detailed error message.
                example:
                  error: Survey survey123 not found
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks API Server
  /health:
    get:
      tags:
        - Health
      summary: Health Check
      description: Check the health status of critical application dependencies
        including database and cache.
      operationId: healthCheck
      security: []
      responses:
        "200":
          description: Health check completed successfully. Check individual dependency
            status in response data.
          content:
            application/json:
              schema:
                type: object
                properties:
                  main_database:
                    type: boolean
                    description: Main database connection status - true if database is reachable and
                      running
                    example: true
                  cache_database:
                    type: boolean
                    description: Cache database connection status - true if cache database is
                      reachable and running
                    example: true
                title: Health Check Response
                description: Health check status for critical application dependencies
  /roles:
    get:
      operationId: getRoles
      summary: Get roles
      description: Gets roles from the database.
      tags:
        - Roles
      responses:
        "200":
          description: Roles retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      anyOf:
                        - type: string
                          const: owner
                        - type: string
                          const: manager
                        - type: string
                          const: member
                        - type: string
                          const: billing
  /me:
    get:
      operationId: me
      summary: Me
      description: Fetches the projects and organizations associated with the API key.
      tags:
        - Me
      responses:
        "200":
          description: API key information retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  organizationId:
                    type: string
                  organizationAccess:
                    type: object
                    properties:
                      accessControl:
                        type: object
                        properties:
                          read:
                            type: boolean
                          write:
                            type: boolean
                        required:
                          - read
                          - write
                        additionalProperties: false
                    required:
                      - accessControl
                  environments:
                    type: array
                    items:
                      type: object
                      properties:
                        environmentId:
                          type: string
                        environmentType:
                          type: string
                          enum:
                            - production
                            - development
                        permission:
                          type: string
                          enum:
                            - read
                            - write
                            - manage
                        projectId:
                          type: string
                        projectName:
                          type: string
                      required:
                        - environmentId
                        - environmentType
                        - permission
                        - projectId
                        - projectName
  /management/responses:
    get:
      operationId: getResponses
      summary: Get responses
      description: Gets responses from the database.
      tags:
        - Management API - Responses
      parameters:
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: &a6
              - createdAt
              - updatedAt
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: &a7
              - asc
              - desc
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: &a8
              - createdAt
              - updatedAt
            description: Date field to filter by
        - in: query
          name: surveyId
          schema:
            type: string
        - in: query
          name: contactId
          schema:
            type: string
      responses:
        "200":
          description: Responses retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the response
                        createdAt:
                          type: string
                          description: The date and time the response was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the response was last updated
                          example: 2021-01-01T00:00:00.000Z
                        finished:
                          type: boolean
                          description: Whether the response is finished
                          example: true
                        surveyId:
                          type: string
                          description: The ID of the survey
                        contactId:
                          type:
                            - string
                            - "null"
                          description: The ID of the contact
                        endingId:
                          type:
                            - string
                            - "null"
                          description: The ID of the ending
                        data:
                          type: object
                          additionalProperties:
                            anyOf:
                              - type: string
                              - type: number
                              - type: array
                                items:
                                  type: string
                              - type: object
                                additionalProperties:
                                  type: string
                          description: The data of the response
                          example: &a1
                            question1: answer1
                            question2: 2
                            question3:
                              - answer3
                              - answer4
                            question4:
                              subquestion1: answer5
                        variables:
                          type: object
                          additionalProperties:
                            anyOf:
                              - type: string
                              - type: number
                          description: The variables of the response
                          example: &a2
                            variable1: answer1
                            variable2: 2
                        ttc:
                          type: object
                          additionalProperties:
                            type: number
                          description: The TTC of the response
                          example: &a3
                            question1: 10
                            question2: 20
                        meta:
                          type: object
                          properties:
                            source:
                              type: string
                              description: The source of the response
                              example: https://example.com
                            url:
                              type: string
                              description: The URL of the response
                              example: https://example.com
                            userAgent:
                              type: object
                              properties:
                                browser:
                                  type: string
                                os:
                                  type: string
                                device:
                                  type: string
                            country:
                              type: string
                            action:
                              type: string
                          description: The meta data of the response
                          example: &a4
                            source: https://example.com
                            url: https://example.com
                            userAgent:
                              browser: Chrome
                              os: Windows
                              device: Desktop
                            country: US
                            action: click
                        contactAttributes:
                          type:
                            - object
                            - "null"
                          additionalProperties:
                            type: string
                          description: The attributes of the contact
                          example: &a5
                            attribute1: value1
                            attribute2: value2
                        singleUseId:
                          type:
                            - string
                            - "null"
                          description: The single use ID of the response
                        language:
                          type:
                            - string
                            - "null"
                          description: The language of the response
                          example: en
                        displayId:
                          type:
                            - string
                            - "null"
                          description: The display ID of the response
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createResponse
      summary: Create a response
      description: Creates a response in the database. This will trigger the response
        pipeline, including webhooks, integrations, follow-up emails, and other
        configured actions.
      tags:
        - Management API - Responses
      requestBody:
        required: true
        description: The response to create
        content:
          application/json:
            schema:
              type: object
              properties:
                createdAt:
                  type: string
                  description: The date and time the response was created
                  example: 2021-01-01T00:00:00.000Z
                updatedAt:
                  type: string
                  description: The date and time the response was last updated
                  example: 2021-01-01T00:00:00.000Z
                surveyId:
                  type: string
                  description: The ID of the survey
                displayId:
                  type:
                    - string
                    - "null"
                  description: The display ID of the response
                singleUseId:
                  type:
                    - string
                    - "null"
                  description: The single use ID of the response
                finished:
                  type: boolean
                  description: Whether the response is finished
                  example: true
                endingId:
                  type:
                    - string
                    - "null"
                  description: The ID of the ending
                language:
                  type:
                    - string
                    - "null"
                  description: The language of the response
                  example: en
                data:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                      - type: array
                        items:
                          type: string
                      - type: object
                        additionalProperties:
                          type: string
                  description: The data of the response
                  example: *a1
                variables:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                  description: The variables of the response
                  example: *a2
                ttc:
                  type: object
                  additionalProperties:
                    type: number
                  description: The TTC of the response
                  example: *a3
                meta:
                  type: object
                  properties:
                    source:
                      type: string
                      description: The source of the response
                      example: https://example.com
                    url:
                      type: string
                      description: The URL of the response
                      example: https://example.com
                    userAgent:
                      type: object
                      properties:
                        browser:
                          type: string
                        os:
                          type: string
                        device:
                          type: string
                    country:
                      type: string
                    action:
                      type: string
                  description: The meta data of the response
                  example: *a4
                userId:
                  type: string
              required:
                - surveyId
                - finished
                - data
      responses:
        "201":
          description: Response created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the response
                  createdAt:
                    type: string
                    description: The date and time the response was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the response was last updated
                    example: 2021-01-01T00:00:00.000Z
                  finished:
                    type: boolean
                    description: Whether the response is finished
                    example: true
                  surveyId:
                    type: string
                    description: The ID of the survey
                  contactId:
                    type:
                      - string
                      - "null"
                    description: The ID of the contact
                  endingId:
                    type:
                      - string
                      - "null"
                    description: The ID of the ending
                  data:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: string
                    description: The data of the response
                    example: *a1
                  variables:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                    description: The variables of the response
                    example: *a2
                  ttc:
                    type: object
                    additionalProperties:
                      type: number
                    description: The TTC of the response
                    example: *a3
                  meta:
                    type: object
                    properties:
                      source:
                        type: string
                        description: The source of the response
                        example: https://example.com
                      url:
                        type: string
                        description: The URL of the response
                        example: https://example.com
                      userAgent:
                        type: object
                        properties:
                          browser:
                            type: string
                          os:
                            type: string
                          device:
                            type: string
                      country:
                        type: string
                      action:
                        type: string
                    description: The meta data of the response
                    example: *a4
                  contactAttributes:
                    type:
                      - object
                      - "null"
                    additionalProperties:
                      type: string
                    description: The attributes of the contact
                    example: *a5
                  singleUseId:
                    type:
                      - string
                      - "null"
                    description: The single use ID of the response
                  language:
                    type:
                      - string
                      - "null"
                    description: The language of the response
                    example: en
                  displayId:
                    type:
                      - string
                      - "null"
                    description: The display ID of the response
  /management/responses/{id}:
    get:
      operationId: getResponse
      summary: Get a response
      description: Gets a response from the database.
      tags:
        - Management API - Responses
      parameters:
        - in: path
          name: id
          description: The ID of the response
          schema:
            $ref: "#/components/schemas/responseId"
          required: true
      responses:
        "200":
          description: Response retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the response
                  createdAt:
                    type: string
                    description: The date and time the response was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the response was last updated
                    example: 2021-01-01T00:00:00.000Z
                  finished:
                    type: boolean
                    description: Whether the response is finished
                    example: true
                  surveyId:
                    type: string
                    description: The ID of the survey
                  contactId:
                    type:
                      - string
                      - "null"
                    description: The ID of the contact
                  endingId:
                    type:
                      - string
                      - "null"
                    description: The ID of the ending
                  data:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: string
                    description: The data of the response
                    example: *a1
                  variables:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                    description: The variables of the response
                    example: *a2
                  ttc:
                    type: object
                    additionalProperties:
                      type: number
                    description: The TTC of the response
                    example: *a3
                  meta:
                    type: object
                    properties:
                      source:
                        type: string
                        description: The source of the response
                        example: https://example.com
                      url:
                        type: string
                        description: The URL of the response
                        example: https://example.com
                      userAgent:
                        type: object
                        properties:
                          browser:
                            type: string
                          os:
                            type: string
                          device:
                            type: string
                      country:
                        type: string
                      action:
                        type: string
                    description: The meta data of the response
                    example: *a4
                  contactAttributes:
                    type:
                      - object
                      - "null"
                    additionalProperties:
                      type: string
                    description: The attributes of the contact
                    example: *a5
                  singleUseId:
                    type:
                      - string
                      - "null"
                    description: The single use ID of the response
                  language:
                    type:
                      - string
                      - "null"
                    description: The language of the response
                    example: en
                  displayId:
                    type:
                      - string
                      - "null"
                    description: The display ID of the response
    put:
      operationId: updateResponse
      summary: Update a response
      description: Updates a response in the database. This will trigger the response
        pipeline, including webhooks, integrations, follow-up emails (if the
        response is marked as finished), and other configured actions.
      tags:
        - Management API - Responses
      parameters:
        - in: path
          name: id
          description: The ID of the response
          schema:
            $ref: "#/components/schemas/responseId"
          required: true
      requestBody:
        required: true
        description: The response fields to update
        content:
          application/json:
            schema:
              type: object
              properties:
                finished:
                  type: boolean
                endingId:
                  type:
                    - string
                    - "null"
                data:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                      - type: array
                        items:
                          type: string
                      - type: object
                        additionalProperties:
                          type: string
                variables:
                  type: object
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                ttc:
                  type: object
                  additionalProperties:
                    type: number
                language:
                  type: string
      responses:
        "200":
          description: Response updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the response
                  createdAt:
                    type: string
                    description: The date and time the response was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the response was last updated
                    example: 2021-01-01T00:00:00.000Z
                  finished:
                    type: boolean
                    description: Whether the response is finished
                    example: true
                  surveyId:
                    type: string
                    description: The ID of the survey
                  contactId:
                    type:
                      - string
                      - "null"
                    description: The ID of the contact
                  endingId:
                    type:
                      - string
                      - "null"
                    description: The ID of the ending
                  data:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: string
                    description: The data of the response
                    example: *a1
                  variables:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                    description: The variables of the response
                    example: *a2
                  ttc:
                    type: object
                    additionalProperties:
                      type: number
                    description: The TTC of the response
                    example: *a3
                  meta:
                    type: object
                    properties:
                      source:
                        type: string
                        description: The source of the response
                        example: https://example.com
                      url:
                        type: string
                        description: The URL of the response
                        example: https://example.com
                      userAgent:
                        type: object
                        properties:
                          browser:
                            type: string
                          os:
                            type: string
                          device:
                            type: string
                      country:
                        type: string
                      action:
                        type: string
                    description: The meta data of the response
                    example: *a4
                  contactAttributes:
                    type:
                      - object
                      - "null"
                    additionalProperties:
                      type: string
                    description: The attributes of the contact
                    example: *a5
                  singleUseId:
                    type:
                      - string
                      - "null"
                    description: The single use ID of the response
                  language:
                    type:
                      - string
                      - "null"
                    description: The language of the response
                    example: en
                  displayId:
                    type:
                      - string
                      - "null"
                    description: The display ID of the response
    delete:
      operationId: deleteResponse
      summary: Delete a response
      description: Deletes a response from the database.
      tags:
        - Management API - Responses
      parameters:
        - in: path
          name: id
          description: The ID of the response
          schema:
            $ref: "#/components/schemas/responseId"
          required: true
      responses:
        "200":
          description: Response deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the response
                  createdAt:
                    type: string
                    description: The date and time the response was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the response was last updated
                    example: 2021-01-01T00:00:00.000Z
                  finished:
                    type: boolean
                    description: Whether the response is finished
                    example: true
                  surveyId:
                    type: string
                    description: The ID of the survey
                  contactId:
                    type:
                      - string
                      - "null"
                    description: The ID of the contact
                  endingId:
                    type:
                      - string
                      - "null"
                    description: The ID of the ending
                  data:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: string
                    description: The data of the response
                    example: *a1
                  variables:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                    description: The variables of the response
                    example: *a2
                  ttc:
                    type: object
                    additionalProperties:
                      type: number
                    description: The TTC of the response
                    example: *a3
                  meta:
                    type: object
                    properties:
                      source:
                        type: string
                        description: The source of the response
                        example: https://example.com
                      url:
                        type: string
                        description: The URL of the response
                        example: https://example.com
                      userAgent:
                        type: object
                        properties:
                          browser:
                            type: string
                          os:
                            type: string
                          device:
                            type: string
                      country:
                        type: string
                      action:
                        type: string
                    description: The meta data of the response
                    example: *a4
                  contactAttributes:
                    type:
                      - object
                      - "null"
                    additionalProperties:
                      type: string
                    description: The attributes of the contact
                    example: *a5
                  singleUseId:
                    type:
                      - string
                      - "null"
                    description: The single use ID of the response
                  language:
                    type:
                      - string
                      - "null"
                    description: The language of the response
                    example: en
                  displayId:
                    type:
                      - string
                      - "null"
                    description: The display ID of the response
  /management/contacts/bulk:
    put:
      operationId: uploadBulkContacts
      summary: Upload Bulk Contacts
      description: Uploads contacts in bulk. Each contact in the payload must have an
        'email' attribute present in their attributes array. The email attribute
        is mandatory and must be a valid email format. Without a valid email,
        the contact will be skipped during processing.
      tags:
        - Management API - Contacts
      requestBody:
        required: true
        description: The contacts to upload. Each contact must include an 'email'
          attribute in their attributes array. The email is used as the unique
          identifier for the contact.
        content:
          application/json:
            schema:
              type: object
              properties:
                environmentId:
                  type: string
                contacts:
                  type: array
                  items:
                    type: object
                    properties:
                      attributes:
                        type: array
                        items:
                          type: object
                          properties:
                            attributeKey:
                              type: object
                              properties:
                                key:
                                  type: string
                                name:
                                  type: string
                              required:
                                - key
                                - name
                            value:
                              type: string
                          required:
                            - attributeKey
                            - value
                    required:
                      - attributes
                  maxItems: 250
              required:
                - environmentId
                - contacts
            example:
              environmentId: env_01h2xce9q8p3w4x5y6z7a8b9c0
              contacts:
                - attributes:
                    - attributeKey:
                        key: email
                        name: Email Address
                      value: john.doe@example.com
                    - attributeKey:
                        key: firstName
                        name: First Name
                      value: John
                    - attributeKey:
                        key: lastName
                        name: Last Name
                      value: Doe
                - attributes:
                    - attributeKey:
                        key: email
                        name: Email Address
                      value: jane.smith@example.com
                    - attributeKey:
                        key: firstName
                        name: First Name
                      value: Jane
                    - attributeKey:
                        key: lastName
                        name: Last Name
                      value: Smith
      responses:
        "200":
          description: Contacts uploaded successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      status:
                        type: string
                      message:
                        type: string
                    required:
                      - status
                      - message
                required:
                  - data
        "207":
          description: Contacts uploaded partially successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      status:
                        type: string
                      message:
                        type: string
                      skippedContacts:
                        type: array
                        items:
                          type: object
                          properties:
                            index:
                              type: number
                            userId:
                              type: string
                          required:
                            - index
                            - userId
                    required:
                      - status
                      - message
                      - skippedContacts
                required:
                  - data
  /management/contacts:
    post:
      operationId: createContact
      summary: Create a contact
      description: Creates a contact in the database. Each contact must have a valid
        email address in the attributes. All attribute keys must already exist
        in the environment. The email is used as the unique identifier along
        with the environment.
      tags:
        - Management API - Contacts
      requestBody:
        required: true
        description: The contact to create. Must include an email attribute and all
          attribute keys must already exist in the environment.
        content:
          application/json:
            schema:
              type: object
              properties:
                environmentId:
                  type: string
                attributes:
                  type: object
                  additionalProperties:
                    type: string
              required:
                - environmentId
                - attributes
            example:
              environmentId: env_01h2xce9q8p3w4x5y6z7a8b9c0
              attributes:
                email: john.doe@example.com
                firstName: John
                lastName: Doe
                userId: h2xce9q8p3w4x5y6z7a8b9c1
      responses:
        "201":
          description: Contact created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  createdAt:
                    type: string
                  environmentId:
                    type: string
                  attributes:
                    type: object
                    additionalProperties:
                      type: string
              example:
                id: ctc_01h2xce9q8p3w4x5y6z7a8b9c2
                createdAt: 2023-01-01T12:00:00.000Z
                environmentId: env_01h2xce9q8p3w4x5y6z7a8b9c0
                attributes:
                  email: john.doe@example.com
                  firstName: John
                  lastName: Doe
                  userId: h2xce9q8p3w4x5y6z7a8b9c1
  /management/contact-attribute-keys:
    get:
      operationId: getContactAttributeKeys
      summary: Get contact attribute keys
      description: Gets contact attribute keys from the database.
      tags:
        - Management API - Contact Attribute Keys
      parameters:
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: *a6
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: *a7
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: *a8
            description: Date field to filter by
        - in: query
          name: environmentId
          description: The environment ID to filter by
          schema:
            type: string
            description: The environment ID to filter by
      responses:
        "200":
          description: Contact attribute keys retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the contact attribute key
                        createdAt:
                          type: string
                          description: The date and time the contact attribute key was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the contact attribute key was last updated
                          example: 2021-01-01T00:00:00.000Z
                        isUnique:
                          type: boolean
                          description: Whether the attribute must have unique values across contacts
                          example: false
                        key:
                          type: string
                          description: The attribute identifier used in the system
                          example: email
                        name:
                          type:
                            - string
                            - "null"
                          description: Display name for the attribute
                          example: Email Address
                        description:
                          type:
                            - string
                            - "null"
                          description: Description of the attribute
                          example: The user's email address
                        type:
                          type: string
                          enum:
                            - default
                            - custom
                          description: Whether this is a default or custom attribute
                          example: custom
                        environmentId:
                          type: string
                          description: The ID of the environment this attribute belongs to
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createContactAttributeKey
      summary: Create a contact attribute key
      description: Creates a contact attribute key in the database.
      tags:
        - Management API - Contact Attribute Keys
      requestBody:
        required: true
        description: The contact attribute key to create
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/contactAttributeKeyInput"
      responses:
        "201":
          description: Contact attribute key created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the contact attribute key
                  createdAt:
                    type: string
                    description: The date and time the contact attribute key was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the contact attribute key was last updated
                    example: 2021-01-01T00:00:00.000Z
                  isUnique:
                    type: boolean
                    description: Whether the attribute must have unique values across contacts
                    example: false
                  key:
                    type: string
                    description: The attribute identifier used in the system
                    example: email
                  name:
                    type:
                      - string
                      - "null"
                    description: Display name for the attribute
                    example: Email Address
                  description:
                    type:
                      - string
                      - "null"
                    description: Description of the attribute
                    example: The user's email address
                  type:
                    type: string
                    enum:
                      - default
                      - custom
                    description: Whether this is a default or custom attribute
                    example: custom
                  environmentId:
                    type: string
                    description: The ID of the environment this attribute belongs to
  /management/contact-attribute-keys/{id}:
    get:
      operationId: getContactAttributeKey
      summary: Get a contact attribute key
      description: Gets a contact attribute key from the database.
      tags:
        - Management API - Contact Attribute Keys
      parameters:
        - in: path
          name: id
          description: The ID of the contact attribute key
          schema:
            $ref: "#/components/schemas/contactAttributeKeyId"
          required: true
      responses:
        "200":
          description: Contact attribute key retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the contact attribute key
                  createdAt:
                    type: string
                    description: The date and time the contact attribute key was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the contact attribute key was last updated
                    example: 2021-01-01T00:00:00.000Z
                  isUnique:
                    type: boolean
                    description: Whether the attribute must have unique values across contacts
                    example: false
                  key:
                    type: string
                    description: The attribute identifier used in the system
                    example: email
                  name:
                    type:
                      - string
                      - "null"
                    description: Display name for the attribute
                    example: Email Address
                  description:
                    type:
                      - string
                      - "null"
                    description: Description of the attribute
                    example: The user's email address
                  type:
                    type: string
                    enum:
                      - default
                      - custom
                    description: Whether this is a default or custom attribute
                    example: custom
                  environmentId:
                    type: string
                    description: The ID of the environment this attribute belongs to
    put:
      operationId: updateContactAttributeKey
      summary: Update a contact attribute key
      description: Updates a contact attribute key in the database.
      tags:
        - Management API - Contact Attribute Keys
      parameters:
        - in: path
          name: id
          description: The ID of the contact attribute key
          schema:
            $ref: "#/components/schemas/contactAttributeKeyId"
          required: true
      requestBody:
        required: true
        description: The contact attribute key to update
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/contactAttributeKeyUpdate"
      responses:
        "200":
          description: Contact attribute key updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the contact attribute key
                  createdAt:
                    type: string
                    description: The date and time the contact attribute key was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the contact attribute key was last updated
                    example: 2021-01-01T00:00:00.000Z
                  isUnique:
                    type: boolean
                    description: Whether the attribute must have unique values across contacts
                    example: false
                  key:
                    type: string
                    description: The attribute identifier used in the system
                    example: email
                  name:
                    type:
                      - string
                      - "null"
                    description: Display name for the attribute
                    example: Email Address
                  description:
                    type:
                      - string
                      - "null"
                    description: Description of the attribute
                    example: The user's email address
                  type:
                    type: string
                    enum:
                      - default
                      - custom
                    description: Whether this is a default or custom attribute
                    example: custom
                  environmentId:
                    type: string
                    description: The ID of the environment this attribute belongs to
    delete:
      operationId: deleteContactAttributeKey
      summary: Delete a contact attribute key
      description: Deletes a contact attribute key from the database.
      tags:
        - Management API - Contact Attribute Keys
      parameters:
        - in: path
          name: id
          description: The ID of the contact attribute key
          schema:
            $ref: "#/components/schemas/contactAttributeKeyId"
          required: true
      responses:
        "200":
          description: Contact attribute key deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the contact attribute key
                  createdAt:
                    type: string
                    description: The date and time the contact attribute key was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the contact attribute key was last updated
                    example: 2021-01-01T00:00:00.000Z
                  isUnique:
                    type: boolean
                    description: Whether the attribute must have unique values across contacts
                    example: false
                  key:
                    type: string
                    description: The attribute identifier used in the system
                    example: email
                  name:
                    type:
                      - string
                      - "null"
                    description: Display name for the attribute
                    example: Email Address
                  description:
                    type:
                      - string
                      - "null"
                    description: Description of the attribute
                    example: The user's email address
                  type:
                    type: string
                    enum:
                      - default
                      - custom
                    description: Whether this is a default or custom attribute
                    example: custom
                  environmentId:
                    type: string
                    description: The ID of the environment this attribute belongs to
  /management/surveys/{surveyId}/contact-links/contacts/{contactId}/:
    get:
      operationId: getPersonalizedSurveyLink
      summary: Get personalized survey link for a contact
      description: Retrieves a personalized link for a specific survey.
      tags:
        - Management API - Surveys - Contact Links
      parameters:
        - in: path
          name: surveyId
          description: The ID of the survey
          schema:
            type: string
            description: The ID of the survey
          required: true
        - in: path
          name: contactId
          description: The ID of the contact
          schema:
            type: string
            description: The ID of the contact
          required: true
        - in: query
          name: expirationDays
          description: Number of days until the generated JWT expires. If not provided,
            there is no expiration.
          schema:
            type: integer
            minimum: 1
            maximum: 365
            description: Number of days until the generated JWT expires. If not provided,
              there is no expiration.
      responses:
        "200":
          description: Personalized survey link retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      surveyUrl:
                        type: string
                        format: uri
                      expiresAt:
                        type:
                          - string
                          - "null"
                        description: The date and time the link expires, null if no expiration
                    required:
                      - surveyUrl
                      - expiresAt
  /management/surveys/{surveyId}/contact-links/segments/{segmentId}:
    get:
      operationId: getContactLinksBySegment
      summary: Get survey links for contacts in a segment
      description: Generates personalized survey links for contacts in a segment.
      tags:
        - Management API - Surveys - Contact Links
      parameters:
        - in: path
          name: surveyId
          description: The ID of the survey
          schema:
            type: string
            description: The ID of the survey
          required: true
        - in: path
          name: segmentId
          description: The ID of the segment
          schema:
            type: string
            description: The ID of the segment
          required: true
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: expirationDays
          description: Number of days until the generated JWT expires. If not provided,
            there is no expiration.
          schema:
            type:
              - number
              - "null"
            minimum: 1
            maximum: 365
            default: null
            description: Number of days until the generated JWT expires. If not provided,
              there is no expiration.
        - in: query
          name: attributeKeys
          schema:
            type: string
            description: Comma-separated list of contact attribute keys to include in the
              response. You can have max 20 keys. If not provided, no attributes
              will be included.
      responses:
        "200":
          description: Contact links generated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        contactId:
                          type: string
                          description: The ID of the contact
                        surveyUrl:
                          type: string
                          format: uri
                          description: Personalized survey link
                        expiresAt:
                          type:
                            - string
                            - "null"
                          description: The date and time the link expires, null if no expiration
                        attributes:
                          type: object
                          additionalProperties:
                            type: string
                          description: The attributes of the contact
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
  /management/webhooks:
    get:
      operationId: getWebhooks
      summary: Get webhooks
      description: Gets webhooks from the database.
      tags:
        - Management API - Webhooks
      parameters:
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: *a6
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: *a7
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: *a8
            description: Date field to filter by
        - in: query
          name: surveyIds
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Webhooks retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the webhook
                        name:
                          type:
                            - string
                            - "null"
                          description: The name of the webhook
                        createdAt:
                          type: string
                          description: The date and time the webhook was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the webhook was last updated
                          example: 2021-01-01T00:00:00.000Z
                        url:
                          type: string
                          format: uri
                          description: The URL of the webhook
                        source:
                          type: string
                          enum: &a9
                            - user
                            - zapier
                            - make
                            - n8n
                          description: The source of the webhook
                        environmentId:
                          type: string
                          description: The ID of the environment
                        triggers:
                          type: array
                          items:
                            type: string
                            enum: &a10
                              - responseFinished
                              - responseCreated
                              - responseUpdated
                          minItems: 1
                          description: The triggers of the webhook
                        surveyIds:
                          type: array
                          items:
                            type: string
                          description: "The IDs of the surveys "
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createWebhook
      summary: Create a webhook
      description: Creates a webhook in the database.
      tags:
        - Management API - Webhooks
      requestBody:
        required: true
        description: The webhook to create
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type:
                    - string
                    - "null"
                  description: The name of the webhook
                url:
                  type: string
                  format: uri
                  description: The URL of the webhook
                source:
                  type: string
                  enum: *a9
                  description: The source of the webhook
                environmentId:
                  type: string
                  description: The ID of the environment
                triggers:
                  type: array
                  items:
                    type: string
                    enum: *a10
                  minItems: 1
                  description: The triggers of the webhook
                surveyIds:
                  type: array
                  items:
                    type: string
                  description: "The IDs of the surveys "
              required:
                - name
                - url
                - source
                - environmentId
                - triggers
                - surveyIds
      responses:
        "201":
          description: Webhook created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the webhook
                  name:
                    type:
                      - string
                      - "null"
                    description: The name of the webhook
                  createdAt:
                    type: string
                    description: The date and time the webhook was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the webhook was last updated
                    example: 2021-01-01T00:00:00.000Z
                  url:
                    type: string
                    format: uri
                    description: The URL of the webhook
                  source:
                    type: string
                    enum: *a9
                    description: The source of the webhook
                  environmentId:
                    type: string
                    description: The ID of the environment
                  triggers:
                    type: array
                    items:
                      type: string
                      enum: *a10
                    minItems: 1
                    description: The triggers of the webhook
                  surveyIds:
                    type: array
                    items:
                      type: string
                    description: "The IDs of the surveys "
  /management/webhooks/{id}:
    get:
      operationId: getWebhook
      summary: Get a webhook
      description: Gets a webhook from the database.
      tags:
        - Management API - Webhooks
      parameters:
        - in: path
          name: id
          description: The ID of the webhook
          schema:
            $ref: "#/components/schemas/webhookId"
          required: true
      responses:
        "200":
          description: Webhook retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the webhook
                  name:
                    type:
                      - string
                      - "null"
                    description: The name of the webhook
                  createdAt:
                    type: string
                    description: The date and time the webhook was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the webhook was last updated
                    example: 2021-01-01T00:00:00.000Z
                  url:
                    type: string
                    format: uri
                    description: The URL of the webhook
                  source:
                    type: string
                    enum: *a9
                    description: The source of the webhook
                  environmentId:
                    type: string
                    description: The ID of the environment
                  triggers:
                    type: array
                    items:
                      type: string
                      enum: *a10
                    minItems: 1
                    description: The triggers of the webhook
                  surveyIds:
                    type: array
                    items:
                      type: string
                    description: "The IDs of the surveys "
    put:
      operationId: updateWebhook
      summary: Update a webhook
      description: Updates a webhook in the database.
      tags:
        - Management API - Webhooks
      parameters:
        - in: path
          name: id
          description: The ID of the webhook
          schema:
            $ref: "#/components/schemas/webhookId"
          required: true
      requestBody:
        required: true
        description: The webhook to update
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type:
                    - string
                    - "null"
                  description: The name of the webhook
                url:
                  type: string
                  format: uri
                  description: The URL of the webhook
                source:
                  type: string
                  enum: *a9
                  description: The source of the webhook
                environmentId:
                  type: string
                  description: The ID of the environment
                triggers:
                  type: array
                  items:
                    type: string
                    enum: *a10
                  minItems: 1
                  description: The triggers of the webhook
                surveyIds:
                  type: array
                  items:
                    type: string
                  description: "The IDs of the surveys "
              required:
                - name
                - url
                - source
                - environmentId
                - triggers
                - surveyIds
      responses:
        "200":
          description: Webhook updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the webhook
                  name:
                    type:
                      - string
                      - "null"
                    description: The name of the webhook
                  createdAt:
                    type: string
                    description: The date and time the webhook was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the webhook was last updated
                    example: 2021-01-01T00:00:00.000Z
                  url:
                    type: string
                    format: uri
                    description: The URL of the webhook
                  source:
                    type: string
                    enum: *a9
                    description: The source of the webhook
                  environmentId:
                    type: string
                    description: The ID of the environment
                  triggers:
                    type: array
                    items:
                      type: string
                      enum: *a10
                    minItems: 1
                    description: The triggers of the webhook
                  surveyIds:
                    type: array
                    items:
                      type: string
                    description: "The IDs of the surveys "
    delete:
      operationId: deleteWebhook
      summary: Delete a webhook
      description: Deletes a webhook from the database.
      tags:
        - Management API - Webhooks
      parameters:
        - in: path
          name: id
          description: The ID of the webhook
          schema:
            $ref: "#/components/schemas/webhookId"
          required: true
      responses:
        "200":
          description: Webhook deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the webhook
                  name:
                    type:
                      - string
                      - "null"
                    description: The name of the webhook
                  createdAt:
                    type: string
                    description: The date and time the webhook was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the webhook was last updated
                    example: 2021-01-01T00:00:00.000Z
                  url:
                    type: string
                    format: uri
                    description: The URL of the webhook
                  source:
                    type: string
                    enum: *a9
                    description: The source of the webhook
                  environmentId:
                    type: string
                    description: The ID of the environment
                  triggers:
                    type: array
                    items:
                      type: string
                      enum: *a10
                    minItems: 1
                    description: The triggers of the webhook
                  surveyIds:
                    type: array
                    items:
                      type: string
                    description: "The IDs of the surveys "
  /organizations/{organizationId}/teams:
    get:
      operationId: getTeams
      summary: Get teams
      description: Gets teams from the database.
      tags:
        - Organizations API - Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: *a6
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: *a7
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: *a8
            description: Date field to filter by
      responses:
        "200":
          description: Teams retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the team
                        createdAt:
                          type: string
                          description: The date and time the team was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the team was last updated
                          example: 2021-01-01T00:00:00.000Z
                        name:
                          type: string
                          description: The name of the team
                          example: My team
                        organizationId:
                          type: string
                          description: The ID of the organization
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createTeam
      summary: Create a team
      description: Creates a team in the database.
      tags:
        - Organizations API - Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The team to create
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the team
                  example: My team
              required:
                - name
      responses:
        "201":
          description: Team created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the team
                  createdAt:
                    type: string
                    description: The date and time the team was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  name:
                    type: string
                    description: The name of the team
                    example: My team
                  organizationId:
                    type: string
                    description: The ID of the organization
  /organizations/{organizationId}/teams/{id}:
    get:
      operationId: getTeam
      summary: Get a team
      description: Gets a team from the database.
      tags:
        - Organizations API - Teams
      parameters:
        - in: path
          name: id
          description: The ID of the team
          schema:
            $ref: "#/components/schemas/teamId"
          required: true
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      responses:
        "200":
          description: Team retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the team
                  createdAt:
                    type: string
                    description: The date and time the team was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  name:
                    type: string
                    description: The name of the team
                    example: My team
                  organizationId:
                    type: string
                    description: The ID of the organization
    put:
      operationId: updateTeam
      summary: Update a team
      description: Updates a team in the database.
      tags:
        - Organizations API - Teams
      parameters:
        - in: path
          name: id
          description: The ID of the team
          schema:
            $ref: "#/components/schemas/teamId"
          required: true
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The team to update
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the team
                  example: My team
              required:
                - name
      responses:
        "200":
          description: Team updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the team
                  createdAt:
                    type: string
                    description: The date and time the team was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  name:
                    type: string
                    description: The name of the team
                    example: My team
                  organizationId:
                    type: string
                    description: The ID of the organization
    delete:
      operationId: deleteTeam
      summary: Delete a team
      description: Deletes a team from the database.
      tags:
        - Organizations API - Teams
      parameters:
        - in: path
          name: id
          description: The ID of the team
          schema:
            $ref: "#/components/schemas/teamId"
          required: true
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      responses:
        "200":
          description: Team deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the team
                  createdAt:
                    type: string
                    description: The date and time the team was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  name:
                    type: string
                    description: The name of the team
                    example: My team
                  organizationId:
                    type: string
                    description: The ID of the organization
  /organizations/{organizationId}/project-teams:
    get:
      operationId: getProjectTeams
      summary: Get project teams
      description: Gets projectTeams from the database.
      tags:
        - Organizations API - Project Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: *a6
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: *a7
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: *a8
            description: Date field to filter by
        - in: query
          name: teamId
          schema:
            type: string
        - in: query
          name: projectId
          schema:
            type: string
      responses:
        "200":
          description: Project teams retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        createdAt:
                          type: string
                          description: The date and time the project tem was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the project team was last updated
                          example: 2021-01-01T00:00:00.000Z
                        projectId:
                          type: string
                          description: The ID of the project
                        teamId:
                          type: string
                          description: The ID of the team
                        permission:
                          type: string
                          enum:
                            - read
                            - readWrite
                            - manage
                          description: Level of access granted to the project
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createProjectTeam
      summary: Create a projectTeam
      description: Creates a project team in the database.
      tags:
        - Organizations API - Project Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The project team to create
        content:
          application/json:
            schema:
              type: object
              properties:
                teamId:
                  type: string
                  description: The ID of the team
                projectId:
                  type: string
                  description: The ID of the project
                permission:
                  type: string
                  enum:
                    - read
                    - readWrite
                    - manage
                  description: Level of access granted to the project
              required:
                - teamId
                - projectId
                - permission
      responses:
        "201":
          description: Project team created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  createdAt:
                    type: string
                    description: The date and time the project tem was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the project team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  projectId:
                    type: string
                    description: The ID of the project
                  teamId:
                    type: string
                    description: The ID of the team
                  permission:
                    type: string
                    enum:
                      - read
                      - readWrite
                      - manage
                    description: Level of access granted to the project
    put:
      operationId: updateProjectTeam
      summary: Update a project team
      description: Updates a project team in the database.
      tags:
        - Organizations API - Project Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The project team to update
        content:
          application/json:
            schema:
              type: object
              properties:
                teamId:
                  type: string
                  description: The ID of the team
                projectId:
                  type: string
                  description: The ID of the project
                permission:
                  type: string
                  enum:
                    - read
                    - readWrite
                    - manage
                  description: Level of access granted to the project
              required:
                - teamId
                - projectId
                - permission
      responses:
        "200":
          description: Project team updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  createdAt:
                    type: string
                    description: The date and time the project tem was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the project team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  projectId:
                    type: string
                    description: The ID of the project
                  teamId:
                    type: string
                    description: The ID of the team
                  permission:
                    type: string
                    enum:
                      - read
                      - readWrite
                      - manage
                    description: Level of access granted to the project
    delete:
      operationId: deleteProjectTeam
      summary: Delete a project team
      description: Deletes a project team from the database.
      tags:
        - Organizations API - Project Teams
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
        - in: query
          name: teamId
          schema:
            type: string
          required: true
        - in: query
          name: projectId
          schema:
            type: string
          required: true
      responses:
        "200":
          description: Project team deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  createdAt:
                    type: string
                    description: The date and time the project tem was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the project team was last updated
                    example: 2021-01-01T00:00:00.000Z
                  projectId:
                    type: string
                    description: The ID of the project
                  teamId:
                    type: string
                    description: The ID of the team
                  permission:
                    type: string
                    enum:
                      - read
                      - readWrite
                      - manage
                    description: Level of access granted to the project
  /organizations/{organizationId}/users:
    get:
      operationId: getUsers
      summary: Get users
      description: Gets users from the database.<br />Only available for self-hosted
        Formbricks.
      tags:
        - Organizations API - Users
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
        - in: query
          name: limit
          description: Number of items to return
          schema:
            type: number
            minimum: 1
            maximum: 250
            default: 50
            description: Number of items to return
        - in: query
          name: skip
          description: Number of items to skip
          schema:
            type: number
            minimum: 0
            default: 0
            description: Number of items to skip
        - in: query
          name: sortBy
          description: Sort by field
          schema:
            type: string
            enum: *a6
            default: createdAt
            description: Sort by field
        - in: query
          name: order
          description: Sort order
          schema:
            type: string
            enum: *a7
            default: desc
            description: Sort order
        - in: query
          name: startDate
          description: Start date
          schema:
            type: string
            description: Start date
        - in: query
          name: endDate
          description: End date
          schema:
            type: string
            description: End date
        - in: query
          name: filterDateField
          description: Date field to filter by
          schema:
            type: string
            enum: *a8
            description: Date field to filter by
        - in: query
          name: id
          schema:
            type: string
        - in: query
          name: email
          schema:
            type: string
      responses:
        "200":
          description: Users retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the user
                        createdAt:
                          type: string
                          description: The date and time the user was created
                          example: 2021-01-01T00:00:00.000Z
                        updatedAt:
                          type: string
                          description: The date and time the user was last updated
                          example: 2021-01-01T00:00:00.000Z
                        lastLoginAt:
                          type: string
                          description: The date and time the user last logged in
                          example: 2021-01-01T00:00:00.000Z
                        isActive:
                          type: boolean
                          description: Whether the user is active
                          example: true
                        name:
                          type: string
                          pattern: ^[\p{L}\p{M}\s'\d-]+$
                          minLength: 1
                          description: The name of the user
                          example: John Doe
                        email:
                          type: string
                          format: email
                          maxLength: 255
                          description: The email of the user
                          example: example@example.com
                        role:
                          type: string
                          enum: &a11
                            - owner
                            - manager
                            - member
                          description: The role of the user in the organization
                          example: member
                        teams:
                          type: array
                          items:
                            type: string
                          description: The list of teams the user is a member of
                          example: &a12
                            - team1
                            - team2
                  meta:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
    post:
      operationId: createUser
      summary: Create a user
      description: Create a new user in the database.<br />Only available for
        self-hosted Formbricks.
      tags:
        - Organizations API - Users
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The user to create
        content:
          application/json:
            schema:
              type: object
              properties:
                isActive:
                  type: boolean
                  description: Whether the user is active
                  example: true
                name:
                  type: string
                  pattern: ^[\p{L}\p{M}\s'\d-]+$
                  minLength: 1
                  description: The name of the user
                  example: John Doe
                email:
                  type: string
                  format: email
                  maxLength: 255
                  description: The email of the user
                  example: example@example.com
                role:
                  type: string
                  enum: *a11
                  description: The role of the user in the organization
                  example: member
                teams:
                  type: array
                  items:
                    type: string
                  description: The list of teams the user is a member of
                  example: *a12
              required:
                - name
                - email
                - role
      responses:
        "201":
          description: User created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the user
                  createdAt:
                    type: string
                    description: The date and time the user was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the user was last updated
                    example: 2021-01-01T00:00:00.000Z
                  lastLoginAt:
                    type: string
                    description: The date and time the user last logged in
                    example: 2021-01-01T00:00:00.000Z
                  isActive:
                    type: boolean
                    description: Whether the user is active
                    example: true
                  name:
                    type: string
                    pattern: ^[\p{L}\p{M}\s'\d-]+$
                    minLength: 1
                    description: The name of the user
                    example: John Doe
                  email:
                    type: string
                    format: email
                    maxLength: 255
                    description: The email of the user
                    example: example@example.com
                  role:
                    type: string
                    enum: *a11
                    description: The role of the user in the organization
                    example: member
                  teams:
                    type: array
                    items:
                      type: string
                    description: The list of teams the user is a member of
                    example: *a12
    patch:
      operationId: updateUser
      summary: Update a user
      description: Updates an existing user in the database.<br />Only available for
        self-hosted Formbricks.
      tags:
        - Organizations API - Users
      parameters:
        - in: path
          name: organizationId
          description: The ID of the organization
          schema:
            $ref: "#/components/schemas/organizationId"
          required: true
      requestBody:
        required: true
        description: The user to update
        content:
          application/json:
            schema:
              type: object
              properties:
                isActive:
                  type: boolean
                  description: Whether the user is active
                  example: true
                name:
                  type: string
                  pattern: ^[\p{L}\p{M}\s'\d-]+$
                  minLength: 1
                email:
                  type: string
                  format: email
                  maxLength: 255
                  description: The email of the user
                  example: example@example.com
                role:
                  type: string
                  enum: *a11
                  description: The role of the user in the organization
                  example: member
                teams:
                  type: array
                  items:
                    type: string
                  description: The list of teams the user is a member of
                  example: *a12
              required:
                - email
      responses:
        "200":
          description: User updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the user
                  createdAt:
                    type: string
                    description: The date and time the user was created
                    example: 2021-01-01T00:00:00.000Z
                  updatedAt:
                    type: string
                    description: The date and time the user was last updated
                    example: 2021-01-01T00:00:00.000Z
                  lastLoginAt:
                    type: string
                    description: The date and time the user last logged in
                    example: 2021-01-01T00:00:00.000Z
                  isActive:
                    type: boolean
                    description: Whether the user is active
                    example: true
                  name:
                    type: string
                    pattern: ^[\p{L}\p{M}\s'\d-]+$
                    minLength: 1
                    description: The name of the user
                    example: John Doe
                  email:
                    type: string
                    format: email
                    maxLength: 255
                    description: The email of the user
                    example: example@example.com
                  role:
                    type: string
                    enum: *a11
                    description: The role of the user in the organization
                    example: member
                  teams:
                    type: array
                    items:
                      type: string
                    description: The list of teams the user is a member of
                    example: *a12
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Use your Formbricks x-api-key to authenticate.
  schemas:
    health:
      type: object
      properties:
        main_database:
          type: boolean
          description: Main database connection status - true if database is reachable and
            running
          example: true
        cache_database:
          type: boolean
          description: Cache database connection status - true if cache database is
            reachable and running
          example: true
      required:
        - main_database
        - cache_database
      title: Health Check Response
      description: Health check status for critical application dependencies
    role:
      type: object
      properties:
        data:
          type: array
          items:
            anyOf:
              - type: string
                const: owner
              - type: string
                const: manager
              - type: string
                const: member
              - type: string
                const: billing
      required:
        - data
    me:
      type: object
      properties:
        organizationId:
          type: string
        organizationAccess:
          type: object
          properties:
            accessControl:
              type: object
              properties:
                read:
                  type: boolean
                write:
                  type: boolean
              required:
                - read
                - write
              additionalProperties: false
          required:
            - accessControl
        environments:
          type: array
          items:
            type: object
            properties:
              environmentId:
                type: string
              environmentType:
                type: string
                enum:
                  - production
                  - development
              permission:
                type: string
                enum:
                  - read
                  - write
                  - manage
              projectId:
                type: string
              projectName:
                type: string
            required:
              - environmentId
              - environmentType
              - permission
              - projectId
              - projectName
      required:
        - organizationId
        - organizationAccess
        - environments
    response:
      type: object
      properties:
        id:
          type: string
          description: The ID of the response
        createdAt:
          type: string
          description: The date and time the response was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the response was last updated
          example: 2021-01-01T00:00:00.000Z
        finished:
          type: boolean
          description: Whether the response is finished
          example: true
        surveyId:
          type: string
          description: The ID of the survey
        contactId:
          type:
            - string
            - "null"
          description: The ID of the contact
        endingId:
          type:
            - string
            - "null"
          description: The ID of the ending
        data:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
              - type: array
                items:
                  type: string
              - type: object
                additionalProperties:
                  type: string
          description: The data of the response
          example: *a1
        variables:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
          description: The variables of the response
          example: *a2
        ttc:
          type: object
          additionalProperties:
            type: number
          description: The TTC of the response
          example: *a3
        meta:
          type: object
          properties:
            source:
              type: string
              description: The source of the response
              example: https://example.com
            url:
              type: string
              description: The URL of the response
              example: https://example.com
            userAgent:
              type: object
              properties:
                browser:
                  type: string
                os:
                  type: string
                device:
                  type: string
            country:
              type: string
            action:
              type: string
          description: The meta data of the response
          example: *a4
        contactAttributes:
          type:
            - object
            - "null"
          additionalProperties:
            type: string
          description: The attributes of the contact
          example: *a5
        singleUseId:
          type:
            - string
            - "null"
          description: The single use ID of the response
        language:
          type:
            - string
            - "null"
          description: The language of the response
          example: en
        displayId:
          type:
            - string
            - "null"
          description: The display ID of the response
      required:
        - id
        - createdAt
        - updatedAt
        - finished
        - surveyId
        - contactId
        - endingId
        - data
        - variables
        - ttc
        - meta
        - contactAttributes
        - singleUseId
        - language
        - displayId
    contact:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the contact
        userId:
          type:
            - string
            - "null"
          description: Optional external user identifier
        createdAt:
          type: string
          description: When the contact was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: When the contact was last updated
          example: 2021-01-01T00:00:00.000Z
        environmentId:
          type: string
          description: The environment this contact belongs to
      required:
        - id
        - userId
        - createdAt
        - updatedAt
        - environmentId
    contactAttribute:
      type: object
      properties:
        id:
          type: string
          description: The ID of the contact attribute
        createdAt:
          type: string
          description: The date and time the contact attribute was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the contact attribute was last updated
          example: 2021-01-01T00:00:00.000Z
        attributeKeyId:
          type: string
          description: The ID of the attribute key
        contactId:
          type: string
          description: The ID of the contact
        value:
          type: string
          description: The value of the attribute
          example: example@email.com
      required:
        - id
        - createdAt
        - updatedAt
        - attributeKeyId
        - contactId
        - value
    contactAttributeKey:
      type: object
      properties:
        id:
          type: string
          description: The ID of the contact attribute key
        createdAt:
          type: string
          description: The date and time the contact attribute key was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the contact attribute key was last updated
          example: 2021-01-01T00:00:00.000Z
        isUnique:
          type: boolean
          description: Whether the attribute must have unique values across contacts
          example: false
        key:
          type: string
          description: The attribute identifier used in the system
          example: email
        name:
          type:
            - string
            - "null"
          description: Display name for the attribute
          example: Email Address
        description:
          type:
            - string
            - "null"
          description: Description of the attribute
          example: The user's email address
        type:
          type: string
          enum:
            - default
            - custom
          description: Whether this is a default or custom attribute
          example: custom
        environmentId:
          type: string
          description: The ID of the environment this attribute belongs to
      required:
        - id
        - createdAt
        - updatedAt
        - isUnique
        - key
        - name
        - description
        - type
        - environmentId
    survey:
      type: object
      properties:
        id:
          type: string
          description: The ID of the survey
        createdAt:
          type: string
          description: The date and time the survey was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the survey was last updated
          example: 2021-01-01T00:00:00.000Z
        name:
          type: string
          description: The name of the survey
        redirectUrl:
          type:
            - string
            - "null"
          format: uri
          description: The URL to redirect to after the survey is completed
        type:
          type: string
          enum:
            - link
            - app
          description: The type of the survey
        status:
          type: string
          enum:
            - draft
            - inProgress
            - paused
            - completed
          description: The status of the survey
        thankYouMessage:
          type:
            - string
            - "null"
          description: The thank you message of the survey
        showLanguageSwitch:
          type:
            - boolean
            - "null"
          description: Whether to show the language switch
        showThankYouMessage:
          type:
            - boolean
            - "null"
          description: Whether to show the thank you message
        welcomeCard:
          type: object
          properties:
            enabled:
              type: boolean
            timeToFinish:
              type: boolean
            showResponseCount:
              type: boolean
            headline:
              type: object
              additionalProperties:
                type: string
            subheader:
              type: object
              additionalProperties:
                type: string
            fileUrl:
              type: string
            buttonLabel:
              type: object
              additionalProperties:
                type: string
            videoUrl:
              type: string
          required:
            - enabled
            - timeToFinish
            - showResponseCount
          description: The welcome card configuration
        displayProgressBar:
          type:
            - boolean
            - "null"
          description: Whether to display the progress bar
        pin:
          type:
            - string
            - "null"
          description: The pin of the survey
        createdBy:
          type:
            - string
            - "null"
          description: The user who created the survey
        environmentId:
          type: string
          description: The environment ID of the survey
        blocks:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              name:
                type: string
                minLength: 1
              elements:
                type: array
                items:
                  anyOf:
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: openText
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: &a13
                            - number
                            - smiley
                            - star
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        placeholder:
                          type: object
                          additionalProperties:
                            type: string
                        longAnswer:
                          type: boolean
                        inputType:
                          type: string
                          enum:
                            - text
                            - email
                            - url
                            - number
                            - phone
                          default: text
                        insightsEnabled:
                          type: boolean
                          default: false
                        charLimit:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                              default: false
                            min:
                              type: number
                            max:
                              type: number
                          default:
                            enabled: false
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - inputType
                        - charLimit
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: consent
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        label:
                          type: object
                          additionalProperties:
                            type: string
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - label
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          anyOf:
                            - type: string
                              const: multipleChoiceSingle
                            - type: string
                              const: multipleChoiceMulti
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        choices:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              label:
                                type: object
                                additionalProperties:
                                  type: string
                            required:
                              - id
                              - label
                          minItems: 2
                        shuffleOption:
                          type: string
                          enum: &a14
                            - none
                            - all
                            - exceptLast
                        otherOptionPlaceholder:
                          type: object
                          additionalProperties:
                            type: string
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - choices
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: nps
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        lowerLabel:
                          type: object
                          additionalProperties:
                            type: string
                        upperLabel:
                          type: object
                          additionalProperties:
                            type: string
                        isColorCodingEnabled:
                          type: boolean
                          default: false
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - isColorCodingEnabled
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: cta
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        buttonExternal:
                          type: boolean
                          default: false
                        buttonUrl:
                          type: string
                        ctaButtonLabel:
                          type: object
                          additionalProperties:
                            type: string
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - buttonExternal
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: rating
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum:
                            - number
                            - smiley
                            - star
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 6
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        lowerLabel:
                          type: object
                          additionalProperties:
                            type: string
                        upperLabel:
                          type: object
                          additionalProperties:
                            type: string
                        isColorCodingEnabled:
                          type: boolean
                          default: false
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - scale
                        - range
                        - isColorCodingEnabled
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: pictureSelection
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        allowMulti:
                          type: boolean
                          default: false
                        choices:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              imageUrl:
                                type: string
                            required:
                              - id
                              - imageUrl
                          minItems: 2
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - allowMulti
                        - choices
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: date
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        html:
                          type: object
                          additionalProperties:
                            type: string
                        format:
                          type: string
                          enum:
                            - M-d-y
                            - d-M-y
                            - y-M-d
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - format
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: fileUpload
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        allowMultipleFiles:
                          type: boolean
                        maxSizeInMB:
                          type: number
                        allowedFileExtensions:
                          type: array
                          items:
                            type: string
                            enum:
                              - heic
                              - png
                              - jpeg
                              - jpg
                              - webp
                              - pdf
                              - eml
                              - doc
                              - docx
                              - xls
                              - xlsx
                              - ppt
                              - pptx
                              - txt
                              - csv
                              - mp4
                              - mov
                              - avi
                              - mkv
                              - webm
                              - zip
                              - rar
                              - 7z
                              - tar
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - allowMultipleFiles
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: cal
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        calUserName:
                          type: string
                          minLength: 1
                        calHost:
                          type: string
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - calUserName
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: matrix
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        rows:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              label:
                                type: object
                                additionalProperties:
                                  type: string
                            required:
                              - id
                              - label
                        columns:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              label:
                                type: object
                                additionalProperties:
                                  type: string
                            required:
                              - id
                              - label
                        shuffleOption:
                          type: string
                          enum: *a14
                          default: none
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - rows
                        - columns
                        - shuffleOption
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: address
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        addressLine1:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        addressLine2:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        city:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        state:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        zip:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        country:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - addressLine1
                        - addressLine2
                        - city
                        - state
                        - zip
                        - country
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: ranking
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        choices:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              label:
                                type: object
                                additionalProperties:
                                  type: string
                            required:
                              - id
                              - label
                          minItems: 2
                          maxItems: 25
                        otherOptionPlaceholder:
                          type: object
                          additionalProperties:
                            type: string
                        shuffleOption:
                          type: string
                          enum: *a14
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - choices
                    - type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          const: contactInfo
                        headline:
                          type: object
                          additionalProperties:
                            type: string
                        subheader:
                          type: object
                          additionalProperties:
                            type: string
                        imageUrl:
                          type: string
                          format: uri
                        videoUrl:
                          type: string
                          format: uri
                        required:
                          type: boolean
                        scale:
                          type: string
                          enum: *a13
                        range:
                          anyOf:
                            - type: number
                              const: 5
                            - type: number
                              const: 3
                            - type: number
                              const: 4
                            - type: number
                              const: 7
                            - type: number
                              const: 10
                        isDraft:
                          type: boolean
                        firstName:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        lastName:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        email:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        phone:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                        company:
                          type: object
                          properties:
                            show:
                              type: boolean
                            required:
                              type: boolean
                            placeholder:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - show
                            - required
                            - placeholder
                      required:
                        - id
                        - type
                        - headline
                        - required
                        - firstName
                        - lastName
                        - email
                        - phone
                        - company
                minItems: 1
              logic:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    conditions:
                      $ref: "#/components/schemas/conditionGroup"
                    actions:
                      type: array
                      items:
                        anyOf:
                          - anyOf:
                              - type: object
                                properties:
                                  id:
                                    type: string
                                  objective:
                                    type: string
                                    const: calculate
                                  variableId:
                                    type: string
                                  operator:
                                    type: string
                                    enum:
                                      - assign
                                      - concat
                                  value:
                                    anyOf:
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            const: static
                                          value:
                                            type: string
                                            minLength: 1
                                        required:
                                          - type
                                          - value
                                      - anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: element
                                              value:
                                                type: string
                                                minLength: 1
                                              meta:
                                                type: object
                                                additionalProperties:
                                                  type: string
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: variable
                                              value:
                                                type: string
                                                minLength: 1
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: hiddenField
                                              value:
                                                type: string
                                                minLength: 1
                                            required:
                                              - type
                                              - value
                                required:
                                  - id
                                  - objective
                                  - variableId
                                  - operator
                                  - value
                              - type: object
                                properties:
                                  id:
                                    type: string
                                  objective:
                                    type: string
                                    const: calculate
                                  variableId:
                                    type: string
                                  operator:
                                    type: string
                                    enum:
                                      - add
                                      - subtract
                                      - multiply
                                      - divide
                                      - assign
                                  value:
                                    anyOf:
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            const: static
                                          value:
                                            type: number
                                        required:
                                          - type
                                          - value
                                      - anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: element
                                              value:
                                                type: string
                                                minLength: 1
                                              meta:
                                                type: object
                                                additionalProperties:
                                                  type: string
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: variable
                                              value:
                                                type: string
                                                minLength: 1
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: hiddenField
                                              value:
                                                type: string
                                                minLength: 1
                                            required:
                                              - type
                                              - value
                                required:
                                  - id
                                  - objective
                                  - variableId
                                  - operator
                                  - value
                          - type: object
                            properties:
                              id:
                                type: string
                              objective:
                                type: string
                                const: requireAnswer
                              target:
                                type: string
                                minLength: 1
                            required:
                              - id
                              - objective
                              - target
                          - type: object
                            properties:
                              id:
                                type: string
                              objective:
                                type: string
                                const: jumpToBlock
                              target:
                                type: string
                                minLength: 1
                            required:
                              - id
                              - objective
                              - target
                  required:
                    - id
                    - conditions
                    - actions
              logicFallback:
                type: string
              buttonLabel:
                type: object
                additionalProperties:
                  type: string
              backButtonLabel:
                type: object
                additionalProperties:
                  type: string
            required:
              - id
              - name
              - elements
          default: []
          description: The blocks of the survey
        endings:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    const: endScreen
                  headline:
                    type: object
                    additionalProperties:
                      type: string
                  subheader:
                    type: object
                    additionalProperties:
                      type: string
                  buttonLabel:
                    type: object
                    additionalProperties:
                      type: string
                  buttonLink:
                    type: string
                    format: uri
                  imageUrl:
                    type: string
                    format: uri
                  videoUrl:
                    type: string
                    format: uri
                required:
                  - id
                  - type
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    const: redirectToUrl
                  url:
                    type: string
                    format: uri
                  label:
                    type: string
                required:
                  - id
                  - type
          default: []
          description: The endings of the survey
        hiddenFields:
          type: object
          properties:
            enabled:
              type: boolean
            fieldIds:
              type: array
              items:
                type: string
          required:
            - enabled
          description: Hidden fields configuration
        variables:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  type:
                    type: string
                    const: number
                  value:
                    type: number
                    default: 0
                required:
                  - id
                  - name
                  - type
                  - value
              - type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  type:
                    type: string
                    const: text
                  value:
                    type: string
                    default: ""
                required:
                  - id
                  - name
                  - type
                  - value
          description: Survey variables
        displayOption:
          type: string
          enum:
            - displayOnce
            - displayMultiple
            - displaySome
            - respondMultiple
          description: Display options for the survey
        recontactDays:
          type:
            - number
            - "null"
          description: Days before recontacting
        displayLimit:
          type:
            - number
            - "null"
          description: Display limit for the survey
        autoClose:
          type:
            - number
            - "null"
          description: Auto close time in seconds
        autoComplete:
          type:
            - number
            - "null"
          description: Auto complete time in seconds
        delay:
          type: number
          description: Delay before showing survey
        surveyClosedMessage:
          type:
            - object
            - "null"
          properties:
            enabled:
              type: boolean
            heading:
              type: string
            subheading:
              type: string
          required:
            - enabled
            - heading
            - subheading
          description: Message shown when survey is closed
        segmentId:
          type:
            - string
            - "null"
          description: ID of the segment
        projectOverwrites:
          type:
            - object
            - "null"
          properties:
            brandColor:
              type:
                - string
                - "null"
              pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
            highlightBorderColor:
              type:
                - string
                - "null"
              pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
            placement:
              type:
                - string
                - "null"
              enum:
                - bottomLeft
                - bottomRight
                - topLeft
                - topRight
                - center
                - null
            clickOutsideClose:
              type:
                - boolean
                - "null"
            overlay:
              type:
                - string
                - "null"
              enum:
                - none
                - light
                - dark
                - null
          description: Project specific overwrites
        styling:
          type:
            - object
            - "null"
          properties:
            brandColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            questionColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            inputColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            inputBorderColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            cardBackgroundColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            cardBorderColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            highlightBorderColor:
              type:
                - object
                - "null"
              properties:
                light:
                  type: string
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
                dark:
                  type:
                    - string
                    - "null"
                  pattern: ^#(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
              required:
                - light
            isDarkModeEnabled:
              type:
                - boolean
                - "null"
            roundness:
              type:
                - number
                - "null"
            cardArrangement:
              type:
                - object
                - "null"
              properties:
                linkSurveys:
                  type: string
                  enum: &a15
                    - casual
                    - straight
                    - simple
                appSurveys:
                  type: string
                  enum: *a15
              required:
                - linkSurveys
                - appSurveys
            background:
              type:
                - object
                - "null"
              properties:
                bg:
                  type:
                    - string
                    - "null"
                bgType:
                  type:
                    - string
                    - "null"
                  enum:
                    - animation
                    - color
                    - image
                    - upload
                    - null
                brightness:
                  type:
                    - number
                    - "null"
            hideProgressBar:
              type:
                - boolean
                - "null"
            isLogoHidden:
              type:
                - boolean
                - "null"
            logo:
              type:
                - object
                - "null"
              properties:
                url:
                  type: string
                bgColor:
                  type: string
          description: Survey styling configuration
        singleUse:
          type: object
          properties:
            enabled:
              type: boolean
            isEncrypted:
              type: boolean
          required:
            - enabled
            - isEncrypted
          description: Single use configuration
        isVerifyEmailEnabled:
          type: boolean
          description: Whether email verification is enabled
        isSingleResponsePerEmailEnabled:
          type: boolean
          description: Whether single response per email is enabled
        inlineTriggers:
          type:
            - array
            - "null"
          items: {}
          description: Inline triggers configuration
        isBackButtonHidden:
          type: boolean
          description: Whether the back button is hidden
        recaptcha:
          type:
            - object
            - "null"
          properties:
            enabled:
              type: boolean
            threshold:
              type: number
              multipleOf: 0.1
              minimum: 0.1
              maximum: 0.9
          required:
            - enabled
            - threshold
          description: Google reCAPTCHA configuration
        metadata:
          type: object
          properties:
            title:
              type: object
              additionalProperties:
                type: string
            description:
              type: object
              additionalProperties:
                type: string
            ogImage:
              type: string
              format: uri
          description: Custom link metadata for social sharing
        displayPercentage:
          type:
            - number
            - "null"
          description: The display percentage of the survey
        questions:
          type: array
          items: {}
          description: The questions of the survey.
      required:
        - id
        - createdAt
        - updatedAt
        - name
        - redirectUrl
        - type
        - status
        - thankYouMessage
        - showLanguageSwitch
        - showThankYouMessage
        - welcomeCard
        - displayProgressBar
        - pin
        - createdBy
        - environmentId
        - blocks
        - endings
        - hiddenFields
        - variables
        - displayOption
        - recontactDays
        - displayLimit
        - autoClose
        - autoComplete
        - delay
        - surveyClosedMessage
        - segmentId
        - projectOverwrites
        - styling
        - singleUse
        - isVerifyEmailEnabled
        - isSingleResponsePerEmailEnabled
        - inlineTriggers
        - isBackButtonHidden
        - recaptcha
        - metadata
        - displayPercentage
        - questions
    webhook:
      type: object
      properties:
        id:
          type: string
          description: The ID of the webhook
        name:
          type:
            - string
            - "null"
          description: The name of the webhook
        createdAt:
          type: string
          description: The date and time the webhook was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the webhook was last updated
          example: 2021-01-01T00:00:00.000Z
        url:
          type: string
          format: uri
          description: The URL of the webhook
        source:
          type: string
          enum: *a9
          description: The source of the webhook
        environmentId:
          type: string
          description: The ID of the environment
        triggers:
          type: array
          items:
            type: string
            enum: *a10
          minItems: 1
          description: The triggers of the webhook
        surveyIds:
          type: array
          items:
            type: string
          description: "The IDs of the surveys "
      required:
        - id
        - name
        - createdAt
        - updatedAt
        - url
        - source
        - environmentId
        - triggers
        - surveyIds
    team:
      type: object
      properties:
        id:
          type: string
          description: The ID of the team
        createdAt:
          type: string
          description: The date and time the team was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the team was last updated
          example: 2021-01-01T00:00:00.000Z
        name:
          type: string
          description: The name of the team
          example: My team
        organizationId:
          type: string
          description: The ID of the organization
      required:
        - id
        - createdAt
        - updatedAt
        - name
        - organizationId
    projectTeam:
      type: object
      properties:
        createdAt:
          type: string
          description: The date and time the project tem was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the project team was last updated
          example: 2021-01-01T00:00:00.000Z
        projectId:
          type: string
          description: The ID of the project
        teamId:
          type: string
          description: The ID of the team
        permission:
          type: string
          enum:
            - read
            - readWrite
            - manage
          description: Level of access granted to the project
      required:
        - createdAt
        - updatedAt
        - projectId
        - teamId
        - permission
    user:
      type: object
      properties:
        id:
          type: string
          description: The ID of the user
        createdAt:
          type: string
          description: The date and time the user was created
          example: 2021-01-01T00:00:00.000Z
        updatedAt:
          type: string
          description: The date and time the user was last updated
          example: 2021-01-01T00:00:00.000Z
        lastLoginAt:
          type: string
          description: The date and time the user last logged in
          example: 2021-01-01T00:00:00.000Z
        isActive:
          type: boolean
          description: Whether the user is active
          example: true
        name:
          type: string
          pattern: ^[\p{L}\p{M}\s'\d-]+$
          minLength: 1
          description: The name of the user
          example: John Doe
        email:
          type: string
          format: email
          maxLength: 255
          description: The email of the user
          example: example@example.com
        role:
          type: string
          enum: *a11
          description: The role of the user in the organization
          example: member
        teams:
          type: array
          items:
            type: string
          description: The list of teams the user is a member of
          example: *a12
      required:
        - id
        - createdAt
        - updatedAt
        - lastLoginAt
        - isActive
        - name
        - email
        - role
    responseId:
      type: string
      description: The ID of the response
    contactAttributeKeyInput:
      type: object
      properties:
        key:
          type: string
          description: The attribute identifier used in the system
          example: email
        name:
          type:
            - string
            - "null"
          description: Display name for the attribute
          example: Email Address
        description:
          type:
            - string
            - "null"
          description: Description of the attribute
          example: The user's email address
        environmentId:
          type: string
          description: The ID of the environment this attribute belongs to
      required:
        - key
        - name
        - description
        - environmentId
      description: Input data for creating or updating a contact attribute
    contactAttributeKeyId:
      type: string
      description: The ID of the contact attribute key
    contactAttributeKeyUpdate:
      type: object
      properties:
        name:
          type:
            - string
            - "null"
          description: Display name for the attribute
          example: Email Address
        description:
          type:
            - string
            - "null"
          description: Description of the attribute
          example: The user's email address
        key:
          type: string
          description: The attribute identifier used in the system
          example: email
      required:
        - name
        - description
        - key
      description: A contact attribute key to update.
    webhookId:
      type: string
      description: The ID of the webhook
    organizationId:
      type: string
      description: The ID of the organization
    teamId:
      type: string
      description: The ID of the team
    conditionGroup:
      type: object
      properties:
        id:
          type: string
        connector:
          type: string
          enum:
            - and
            - or
        conditions:
          type: array
          items:
            anyOf:
              - allOf:
                  - type: object
                    properties:
                      id:
                        type: string
                      leftOperand:
                        anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                const: element
                              value:
                                type: string
                                minLength: 1
                              meta:
                                type: object
                                additionalProperties:
                                  type: string
                            required:
                              - type
                              - value
                          - type: object
                            properties:
                              type:
                                type: string
                                const: variable
                              value:
                                type: string
                                minLength: 1
                            required:
                              - type
                              - value
                          - type: object
                            properties:
                              type:
                                type: string
                                const: hiddenField
                              value:
                                type: string
                                minLength: 1
                            required:
                              - type
                              - value
                      operator:
                        type: string
                        enum:
                          - equals
                          - doesNotEqual
                          - contains
                          - doesNotContain
                          - startsWith
                          - doesNotStartWith
                          - endsWith
                          - doesNotEndWith
                          - isSubmitted
                          - isSkipped
                          - isGreaterThan
                          - isLessThan
                          - isGreaterThanOrEqual
                          - isLessThanOrEqual
                          - equalsOneOf
                          - includesAllOf
                          - includesOneOf
                          - doesNotIncludeOneOf
                          - doesNotIncludeAllOf
                          - isClicked
                          - isNotClicked
                          - isAccepted
                          - isBefore
                          - isAfter
                          - isBooked
                          - isPartiallySubmitted
                          - isCompletelySubmitted
                          - isSet
                          - isNotSet
                          - isEmpty
                          - isNotEmpty
                          - isAnyOf
                      rightOperand:
                        anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                const: static
                              value:
                                anyOf:
                                  - type: string
                                  - type: number
                                  - type: array
                                    items:
                                      type: string
                            required:
                              - type
                              - value
                          - anyOf:
                              - type: object
                                properties:
                                  type:
                                    type: string
                                    const: element
                                  value:
                                    type: string
                                    minLength: 1
                                  meta:
                                    type: object
                                    additionalProperties:
                                      type: string
                                required:
                                  - type
                                  - value
                              - type: object
                                properties:
                                  type:
                                    type: string
                                    const: variable
                                  value:
                                    type: string
                                    minLength: 1
                                required:
                                  - type
                                  - value
                              - type: object
                                properties:
                                  type:
                                    type: string
                                    const: hiddenField
                                  value:
                                    type: string
                                    minLength: 1
                                required:
                                  - type
                                  - value
                    required:
                      - id
                      - leftOperand
                      - operator
                  - type: object
                    properties: {}
              - $ref: "#/components/schemas/conditionGroup"
      required:
        - id
        - connector
        - conditions
