---
title: "Create an NPS widget"
method: POST
path: "/nps-widgets"
tags: ["NPS Widgets"]
---

# Create an NPS widget

`POST /nps-widgets`

## Request

- Base URL: `https://api.produktly.com/api/v1`
- URL: `https://api.produktly.com/api/v1/nps-widgets`
- Auth: HTTP bearer

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

## Request body

- object
  - `name` string, required
  - `settings` object
    - `selectedScale` 'ten' | 'five' | 'emojis': Rating scale. Default "ten" (0-10). "five" is 1-5, "emojis" is 0-2
    - `title` string: The question. Default "How likely are you to recommend us?"
    - `scaleLabelLeastLikely` string
    - `scaleLabelMostLikely` string
    - `collectEmail` boolean: Default true
    - `emailRequired` boolean: Default false
    - `shouldValidateEmail` boolean: Default true
    - `emailText` string
    - `emailMissingErrorText` string
    - `emailInvalidErrorText` string
    - `collectFeedback` boolean: Show the follow-up comment box. Default true
    - `msgText` string: The follow-up question
    - `msgPlaceholderText` string
    - `submitBtnText` string
    - `successText` string
    - `closeBtnText` string
    - `displayType` 'bottombar' | 'bottombar-hovering' | 'toast-left' | 'toast-right'
    - `displayTrigger` 'element_click' | 'element_visible' | 'immediate' | 'time_on_page' | 'manual': Default "immediate"
    - `displayTriggerTime` number: Seconds, required for "time_on_page"
    - `displayTriggerSelector` string: Required for element_click and element_visible
    - `display` 'once_a_month' | 'once_a_quarter' | 'once_a_year' | 'once_a_week' | 'once' | 'always': How often the same user is asked. Default "once_a_month"
    - `dismissOn` 'cross_click' | 'never'
    - `themeColor` string
    - `textColor` string
    - `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 targeting

## Response `201`

Created NPS widget

- NpsWidgetDetail
  - `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)
