## Create a question

**post** `/v5/questions`

Create a new question owned by the caller's account.

The question is one of six types selected by the required `question_type`
discriminator (categorical, rating, number, free_text, form, or timestamp),
and each type carries its own `configuration` block; `name` and `prompt`
are required for every type. Questions are the reusable units that are grouped
into question sets and referenced by rubrics, so create them before assembling
a question set. The created question is scoped to the caller's account and
records the creating identity. The question type and its configuration are set
at creation time and cannot be changed afterward through the update endpoint.

### Body Parameters

- `question: object { configuration, name, prompt, 2 more }  or object { configuration, name, prompt, 2 more }  or object { name, prompt, conditions, 2 more }  or 3 more`

  - `Categorical object { configuration, name, prompt, 2 more }`

    - `configuration: CategoricalQuestionConfiguration`

      - `choices: array of string`

        Categorical answer choices (must contain at least one entry)

      - `dropdown: optional boolean`

        Whether the question is displayed as a dropdown in the UI.

      - `multi: optional boolean`

        Whether the question allows multiple answers.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `question_type: optional "categorical"`

      - `"categorical"`

  - `Rating object { configuration, name, prompt, 2 more }`

    - `configuration: RatingQuestionConfiguration`

      - `max_label: string`

        Label shown for the maximum rating

      - `min_label: string`

        Label shown for the minimum rating

      - `steps: number`

        Number of discrete points on the scale (e.g., 5 for a 1–5 scale)

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `question_type: optional "rating"`

      - `"rating"`

  - `Number object { name, prompt, conditions, 2 more }`

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional NumberQuestionConfiguration`

      - `max: optional number`

        Maximum value for the number

      - `min: optional number`

        Minimum value for the number

    - `question_type: optional "number"`

      - `"number"`

  - `FreeText object { name, prompt, conditions, 2 more }`

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional FreeTextQuestionConfiguration`

      - `max_length: optional number`

        Maximum characters allowed

      - `min_length: optional number`

        Minimum characters required

    - `question_type: optional "free_text"`

      - `"free_text"`

  - `Form object { configuration, name, prompt, 2 more }`

    - `configuration: FormQuestionConfiguration`

      - `form_schema: map[unknown]`

        The JSON schema of the desired form object

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `question_type: optional "form"`

      - `"form"`

  - `Timestamp object { name, prompt, conditions, 2 more }`

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional TimestampQuestionConfiguration`

      - `multi: optional boolean`

        Whether to allow multiple timestamps

    - `question_type: optional "timestamp"`

      - `"timestamp"`

### Returns

- `Question = CategoricalQuestion or RatingQuestion or NumberQuestion or 3 more`

  - `CategoricalQuestion object { id, configuration, created_at, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `configuration: CategoricalQuestionConfiguration`

      - `choices: array of string`

        Categorical answer choices (must contain at least one entry)

      - `dropdown: optional boolean`

        Whether the question is displayed as a dropdown in the UI.

      - `multi: optional boolean`

        Whether the question allows multiple answers.

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

      - `id: string`

      - `type: "user" or "service_account"`

        - `"user"`

        - `"service_account"`

      - `object: optional "identity"`

        - `"identity"`

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "categorical"`

      - `"categorical"`

  - `RatingQuestion object { id, configuration, created_at, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `configuration: RatingQuestionConfiguration`

      - `max_label: string`

        Label shown for the maximum rating

      - `min_label: string`

        Label shown for the minimum rating

      - `steps: number`

        Number of discrete points on the scale (e.g., 5 for a 1–5 scale)

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "rating"`

      - `"rating"`

  - `NumberQuestion object { id, created_at, created_by, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional NumberQuestionConfiguration`

      - `max: optional number`

        Maximum value for the number

      - `min: optional number`

        Minimum value for the number

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "number"`

      - `"number"`

  - `FreeTextQuestion object { id, created_at, created_by, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional FreeTextQuestionConfiguration`

      - `max_length: optional number`

        Maximum characters allowed

      - `min_length: optional number`

        Minimum characters required

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "free_text"`

      - `"free_text"`

  - `FormQuestion object { id, configuration, created_at, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `configuration: FormQuestionConfiguration`

      - `form_schema: map[unknown]`

        The JSON schema of the desired form object

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "form"`

      - `"form"`

  - `TimestampQuestion object { id, created_at, created_by, 7 more }`

    - `id: string`

      Unique identifier of the entity

    - `created_at: string`

      ISO-timestamp when the entity was created

    - `created_by: Identity`

      The identity that created the entity.

    - `name: string`

    - `prompt: string`

      user-facing question prompt

    - `archived_at: optional string`

      ISO-timestamp when the entity was archived

    - `conditions: optional array of map[unknown]`

      Conditions for the question to be shown

    - `configuration: optional TimestampQuestionConfiguration`

      - `multi: optional boolean`

        Whether to allow multiple timestamps

    - `object: optional "question"`

      - `"question"`

    - `question_type: optional "timestamp"`

      - `"timestamp"`

### Example

```http
curl https://api.egp.scale.com/v5/questions \
    -H 'Content-Type: application/json' \
    -H "x-api-key: $SGP_API_KEY" \
    -d '{
          "configuration": {
            "choices": [
              "string"
            ],
            "dropdown": true,
            "multi": true
          },
          "name": "name",
          "prompt": "prompt",
          "conditions": [
            {
              "foo": "bar"
            }
          ],
          "question_type": "categorical"
        }'
```

#### Response

```json
{
  "id": "id",
  "configuration": {
    "choices": [
      "string"
    ],
    "dropdown": true,
    "multi": true
  },
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "name": "name",
  "prompt": "prompt",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "conditions": [
    {
      "foo": "bar"
    }
  ],
  "object": "question",
  "question_type": "categorical"
}
```
