---
title: "The active surveys the visitor making this request may see."
method: POST
path: "/_temps/surveys"
tags: ["Surveys"]
---

# The active surveys the visitor making this request may see.

`POST /_temps/surveys`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/_temps/surveys`
- Auth: none declared

Unauthenticated: the project comes from the `Host` the browser called.
Answers are recorded through the analytics event endpoint as
`survey_shown`, `survey_dismissed` and `survey_sent`.

## Request body

- PublicSurveysRequest: Body of `POST /api/_temps/surveys`. Both fields are optional.
  - `attributes` object: Attributes for the flag conditions. Override the implicit ones.
  - `key` string, nullable: Stable subject for sampling and flag conditions, e.g. a signed-in user id. Defaults to the Temps visitor cookie.

## Response `200`

Surveys this visitor may see

- PublicSurveysResponse
  - `surveys` PublicSurvey[], required
    - `display` PublicSurveyDisplay, required: The conditions the browser applies before showing a survey.
      - `once_per_visitor` boolean, required
      - `path_pattern` string, nullable: Page path pattern (`*` matches any run of characters); absent for every page.
      - `trigger_event` string, nullable: Show after the app tracks this event; absent to show on page load.
    - `id` integer, required
    - `name` string, required
    - `questions` SurveyQuestion[], required
      - `choices` string[]: Options for `single_choice` and `multiple_choice`: 2-20, unique.
      - `id` string, required: Stable id the answer is recorded under: `[a-z0-9_]`, 1-32 characters, unique within the survey. Keep it when rewording a question so its answers stay together.
      - `kind` 'open_text' | 'rating' | 'nps' | 'single_choice' | 'multiple_choice', required
      - `lower_label` string, nullable: Label under the low end of a `rating` or `nps` scale.
      - `optional` boolean: When true the visitor may skip it.
      - `prompt` string, required
      - `scale` integer, nullable: Top of a `rating` scale: 3, 5, 7 or 10. Defaults to 5.
      - `upper_label` string, nullable: Label under the high end of a `rating` or `nps` scale.

## Other responses

- `400`: Malformed or oversized context
- `404`: No environment serves this host
- `429`: Rate limit exceeded
- `503`: Surveys could not be loaded

## Changes

- **2026-11-20** `1167397f1408`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/_temps/surveys/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
