PostHog · Schema

Survey

Mixin for serializers to add user access control fields

A/B TestingAnalyticsFeature FlagsOpen SourceProduct AnalyticsSession Recording

Properties

Name Type Description
id string
name string
description string
type object
schedule string
linked_flag object
linked_flag_id integer
linked_insight_id integer
targeting_flag object
internal_targeting_flag object
questions object The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice. Basic (open-ended question) - `id`: The quest
conditions object
appearance object
created_at string
created_by object
start_date string
end_date string
archived boolean
responses_limit integer
feature_flag_keys array
iteration_count integer
iteration_frequency_days integer
iteration_start_dates array
current_iteration integer
current_iteration_start_date string
response_sampling_start_date string
response_sampling_interval_type object
response_sampling_interval integer
response_sampling_limit integer
response_sampling_daily_limits object
enable_partial_responses boolean
enable_iframe_embedding boolean
translations object
user_access_level string The effective access level the user has for this object
form_content object
View JSON Schema on GitHub

JSON Schema

posthog-survey-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/Survey",
  "title": "Survey",
  "type": "object",
  "description": "Mixin for serializers to add user access control fields",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "maxLength": 400
    },
    "description": {
      "type": "string"
    },
    "type": {
      "$ref": "#/components/schemas/SurveyType"
    },
    "schedule": {
      "type": "string",
      "nullable": true
    },
    "linked_flag": {
      "allOf": [
        {
          "$ref": "#/components/schemas/MinimalFeatureFlag"
        }
      ],
      "readOnly": true
    },
    "linked_flag_id": {
      "type": "integer",
      "nullable": true
    },
    "linked_insight_id": {
      "type": "integer",
      "nullable": true
    },
    "targeting_flag": {
      "allOf": [
        {
          "$ref": "#/components/schemas/MinimalFeatureFlag"
        }
      ],
      "readOnly": true
    },
    "internal_targeting_flag": {
      "allOf": [
        {
          "$ref": "#/components/schemas/MinimalFeatureFlag"
        }
      ],
      "readOnly": true
    },
    "questions": {
      "nullable": true,
      "description": "\n        The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n        Basic (open-ended question)\n        - `id`: The question ID\n        - `type`: `open`\n        - `question`: The text of the question.\n        - `description`: Optional description of the question.\n        - `descriptionContentType`: Content type of the description (`html` or `text`).\n        - `optional`: Whether the question is optional (`boolean`).\n        - `buttonText`: Text displayed on the submit button.\n        - `branching`: Branching logic for the question. See branching types below for details.\n\n        Link (a question with a link)\n        - `id`: The question ID\n        - `type`: `link`\n        - `question`: The text of the question.\n        - `description`: Optional description of the question.\n        - `descriptionContentType`: Content type of the description (`html` or `text`).\n        - `optional`: Whether the question is optional (`boolean`).\n        - `buttonText`: Text displayed on the submit button.\n        - `link`: The URL associated with the question.\n        - `branching`: Branching logic for the question. See branching types below for details.\n\n        Rating (a question with a rating scale)\n        - `id`: The question ID\n        - `type`: `rating`\n        - `question`: The text of the question.\n        - `description`: Optional description of the question.\n        - `descriptionContentType`: Content type of the description (`html` or `text`).\n        - `optional`: Whether the question is optional (`boolean`).\n        - `buttonText`: Text displayed on the submit button.\n        - `display`: Display style of the rating (`number` or `emoji`).\n        - `scale`: The scale of the rating (`number`).\n        - `lowerBoundLabel`: Label for the lower bound of the scale.\n        - `upperBoundLabel`: Label for the upper bound of the scale.\n        - `isNpsQuestion`: Whether the question is an NPS rating.\n        - `branching`: Branching logic for the question. See branching types below for details.\n\n        Multiple choice\n        - `id`: The question ID\n        - `type`: `single_choice` or `multiple_choice`\n        - `question`: The text of the question.\n        - `description`: Optional description of the question.\n        - `descriptionContentType`: Content type of the description (`html` or `text`).\n        - `optional`: Whether the question is optional (`boolean`).\n        - `buttonText`: Text displayed on the submit button.\n        - `choices`: An array of choices for the question.\n        - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n        - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n        - `branching`: Branching logic for the question. See branching types below for details.\n\n        Branching logic can be one of the following types:\n\n        Next question: Proceeds to the next question\n        ```json\n        {\n            \"type\": \"next_question\"\n        }\n        ```\n\n        End: Ends the survey, optionally displaying a confirmation message.\n        ```json\n        {\n            \"type\": \"end\"\n        }\n        ```\n\n        Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n        ```json\n        {\n            \"type\": \"response_based\",\n            \"responseValues\": {\n                \"responseKey\": \"value\"\n            }\n        }\n        ```\n\n        Specific question: Proceeds to a specific question by index.\n        ```json\n        {\n            \"type\": \"specific_question\",\n            \"index\": 2\n        }\n        ```\n\n        Translations: Each question can include inline translations.\n        - `translations`: Object mapping language codes to translated fields.\n        - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n        - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n        Example with translations:\n        ```json\n        {\n            \"id\": \"uuid\",\n            \"type\": \"rating\",\n            \"question\": \"How satisfied are you?\",\n            \"lowerBoundLabel\": \"Not satisfied\",\n            \"upperBoundLabel\": \"Very satisfied\",\n            \"translations\": {\n                \"es\": {\n                    \"question\": \"\u00bfQu\u00e9 tan satisfecho est\u00e1s?\",\n                    \"lowerBoundLabel\": \"No satisfecho\",\n                    \"upperBoundLabel\": \"Muy satisfecho\"\n                },\n                \"fr\": {\n                    \"question\": \"Dans quelle mesure \u00eates-vous satisfait?\"\n                }\n            }\n        }\n        ```\n        "
    },
    "conditions": {
      "type": "object",
      "additionalProperties": true,
      "nullable": true,
      "readOnly": true
    },
    "appearance": {
      "nullable": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "created_by": {
      "allOf": [
        {
          "$ref": "#/components/schemas/UserBasic"
        }
      ],
      "readOnly": true
    },
    "start_date": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "end_date": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "archived": {
      "type": "boolean"
    },
    "responses_limit": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": 0,
      "nullable": true
    },
    "feature_flag_keys": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "nullable": true
        }
      },
      "readOnly": true
    },
    "iteration_count": {
      "type": "integer",
      "maximum": 500,
      "minimum": 0,
      "nullable": true
    },
    "iteration_frequency_days": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": 0,
      "nullable": true
    },
    "iteration_start_dates": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "date-time",
        "nullable": true
      },
      "nullable": true
    },
    "current_iteration": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": 0,
      "nullable": true
    },
    "current_iteration_start_date": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "response_sampling_start_date": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "response_sampling_interval_type": {
      "nullable": true,
      "oneOf": [
        {
          "$ref": "#/components/schemas/ResponseSamplingIntervalTypeEnum"
        },
        {
          "$ref": "#/components/schemas/BlankEnum"
        },
        {
          "$ref": "#/components/schemas/NullEnum"
        }
      ]
    },
    "response_sampling_interval": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": 0,
      "nullable": true
    },
    "response_sampling_limit": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": 0,
      "nullable": true
    },
    "response_sampling_daily_limits": {
      "nullable": true
    },
    "enable_partial_responses": {
      "type": "boolean",
      "nullable": true
    },
    "enable_iframe_embedding": {
      "type": "boolean",
      "nullable": true
    },
    "translations": {
      "nullable": true
    },
    "user_access_level": {
      "type": "string",
      "nullable": true,
      "readOnly": true,
      "description": "The effective access level the user has for this object"
    },
    "form_content": {
      "nullable": true
    }
  },
  "required": [
    "conditions",
    "created_at",
    "created_by",
    "feature_flag_keys",
    "id",
    "internal_targeting_flag",
    "linked_flag",
    "name",
    "targeting_flag",
    "type",
    "user_access_level"
  ]
}