---
title: "Create a micro survey"
method: POST
path: "/micro-surveys"
tags: ["Micro Surveys"]
---

# Create a micro survey

`POST /micro-surveys`

## Request

- Base URL: `https://api.produktly.com/api/v1`
- URL: `https://api.produktly.com/api/v1/micro-surveys`
- Auth: HTTP bearer

Creates the survey as a draft. Pass active: true to publish immediately — the survey must have at least one question and targeting set, otherwise it stays a draft and the response note explains why. The response includes a dashboardUrl for reviewing the survey in the builder.

## Request body

- object
  - `name` string, required
  - `settings` object, required
    - `questions` object[], required: Questions in order. Shown one at a time
      - `question` string, required: The question text. Response payloads key on this
      - `type` 'emoji' | 'thumbs' | 'rating' | 'text' | 'multi-choice': Default "emoji". thumbs (👍/👎), rating (fixed 1-5) and text take no options
      - `options` object[]: Only for type "emoji"
        - `name` string, required
        - `emoji` string, required
      - `multiChoiceOptions` string[]: Only for type "multi-choice"
    - `display` 'always' | 'until_answered': Default "always"
    - `displayTrigger` 'click' | 'hover' | 'focus' | 'element_visible' | 'immediate' | 'time_delay' | 'manual': Default "click". "manual" = only via Produktly.openMicroSurvey()
    - `cssSelector` string: Required for click, hover, focus and element_visible triggers
    - `displayDelay` number: Seconds, with displayTrigger "time_delay". Default 5
    - `autoClose` boolean
    - `autoCloseAfter` number: Seconds. Default 20
    - `position` 'element' | 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right'
    - `positionCssSelector` string: Falls back to cssSelector
    - `themeColor` string
    - `textColor` string
    - `onCompleteActions` union[]: What happens after the last question (max 1)
      - union
        - object
          - `type` 'start_tour', required
          - `tourId` integer, required
        - object
          - `type` 'open_micro_survey', required
          - `microSurveyId` integer, required
        - object
          - `type` 'open_url', required
          - `url` string, required
          - `openInNewTab` boolean
    - `slackWebhookUrl` string: Write-only. Never returned by read endpoints
    - `discordWebhookUrl` string: Write-only
    - `zapierWebhookUrl` string: Write-only
    - `customWebhookUrl` string: Write-only
    - `notificationEmails` string: Comma-separated. Write-only
  - `targeting` union
    - object
      - `showOnAllPages` true, required
    - object
      - `rules` object[], required
        - `type` union, required
          - 'url' | 'current_time' | 'time_of_day' | 'day_of_week' | 'location' | 'language' | 'produktly_user_created_at' | 'device_type' | 'screen_width' | 'screen_height' | 'produktly_user_visit_count' | 'produktly_user_days_active'
          - string
          - string
        - `comparisonOperator` 'equals' | 'not_equal' | 'contains' | 'no_contains' | 'starts_with' | 'ends_with' | 'one_of' | 'not_one_of' | 'greater' | 'greater_eq' | 'less' | 'less_eq' | 'exists' | 'not_exists' | 'time_ago' | 'within_last' | 'between', required
        - `value` union
          - string
          - number
          - union[]
            - union
              - …
          - object
            - `value` integer, required
            - `unit` 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years', required
      - `logicalOperator` 'AND' | 'OR' | 'and' | 'or': How multiple rules combine. Default "AND".
    - object
      - `userSegmentIds` integer[], required
  - `themeId` integer
  - `folderId` integer
  - `active` boolean: Publish immediately. Needs at least one question and targeting

## Response `201`

Created micro survey

- MicroSurvey
  - `id` integer, required
  - `name` string, required
  - `active` boolean, required
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required
  - `folderId` integer, nullable, required
  - `themeId` integer, nullable, required
  - `settings` object, required
  - `rules` object[], required
  - `ruleLogicalOperator` string, nullable, required
  - `dashboardUrl` string, required
  - `note` string

## Other responses

- `400`: Validation error
- `401`: Unauthorized
- `403`: Plan limit reached
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/produktly/apis/produktly-api.md) · [All operations](https://skmtc.dev/produktly/apis/produktly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/produktly/apis/produktly-api/revisions/fd942a97a7d1?raw)
