## Create a question

`client.Questions.New(ctx, body) (*QuestionUnion, error)`

**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.

### Parameters

- `body QuestionNewParams`

  - `Question param.Field[QuestionNewParamsQuestionUnion]`

    - `type QuestionNewParamsQuestionCategorical struct{…}`

      - `Configuration CategoricalQuestionConfiguration`

        - `Choices []string`

          Categorical answer choices (must contain at least one entry)

        - `Dropdown bool`

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

        - `Multi bool`

          Whether the question allows multiple answers.

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `QuestionType string`

        - `const QuestionNewParamsQuestionCategoricalQuestionTypeCategorical QuestionNewParamsQuestionCategoricalQuestionType = "categorical"`

    - `type QuestionNewParamsQuestionRating struct{…}`

      - `Configuration RatingQuestionConfiguration`

        - `MaxLabel string`

          Label shown for the maximum rating

        - `MinLabel string`

          Label shown for the minimum rating

        - `Steps int64`

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

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `QuestionType string`

        - `const QuestionNewParamsQuestionRatingQuestionTypeRating QuestionNewParamsQuestionRatingQuestionType = "rating"`

    - `type QuestionNewParamsQuestionNumber struct{…}`

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `Configuration NumberQuestionConfiguration`

        - `Max float64`

          Maximum value for the number

        - `Min float64`

          Minimum value for the number

      - `QuestionType string`

        - `const QuestionNewParamsQuestionNumberQuestionTypeNumber QuestionNewParamsQuestionNumberQuestionType = "number"`

    - `type QuestionNewParamsQuestionFreeText struct{…}`

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `Configuration FreeTextQuestionConfiguration`

        - `MaxLength int64`

          Maximum characters allowed

        - `MinLength int64`

          Minimum characters required

      - `QuestionType string`

        - `const QuestionNewParamsQuestionFreeTextQuestionTypeFreeText QuestionNewParamsQuestionFreeTextQuestionType = "free_text"`

    - `type QuestionNewParamsQuestionForm struct{…}`

      - `Configuration FormQuestionConfiguration`

        - `FormSchema map[string, any]`

          The JSON schema of the desired form object

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `QuestionType string`

        - `const QuestionNewParamsQuestionFormQuestionTypeForm QuestionNewParamsQuestionFormQuestionType = "form"`

    - `type QuestionNewParamsQuestionTimestamp struct{…}`

      - `Name string`

      - `Prompt string`

        user-facing question prompt

      - `Conditions []map[string, any]`

        Conditions for the question to be shown

      - `Configuration TimestampQuestionConfiguration`

        - `Multi bool`

          Whether to allow multiple timestamps

      - `QuestionType string`

        - `const QuestionNewParamsQuestionTimestampQuestionTypeTimestamp QuestionNewParamsQuestionTimestampQuestionType = "timestamp"`

### Returns

- `type QuestionUnion interface{…}`

  - `type CategoricalQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `Configuration CategoricalQuestionConfiguration`

      - `Choices []string`

        Categorical answer choices (must contain at least one entry)

      - `Dropdown bool`

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

      - `Multi bool`

        Whether the question allows multiple answers.

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

      - `ID string`

      - `Type IdentityType`

        - `const IdentityTypeUser IdentityType = "user"`

        - `const IdentityTypeServiceAccount IdentityType = "service_account"`

      - `Object IdentityObject`

        - `const IdentityObjectIdentity IdentityObject = "identity"`

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Object CategoricalQuestionObject`

      - `const CategoricalQuestionObjectQuestion CategoricalQuestionObject = "question"`

    - `QuestionType CategoricalQuestionQuestionType`

      - `const CategoricalQuestionQuestionTypeCategorical CategoricalQuestionQuestionType = "categorical"`

  - `type RatingQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `Configuration RatingQuestionConfiguration`

      - `MaxLabel string`

        Label shown for the maximum rating

      - `MinLabel string`

        Label shown for the minimum rating

      - `Steps int64`

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

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Object RatingQuestionObject`

      - `const RatingQuestionObjectQuestion RatingQuestionObject = "question"`

    - `QuestionType RatingQuestionQuestionType`

      - `const RatingQuestionQuestionTypeRating RatingQuestionQuestionType = "rating"`

  - `type NumberQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Configuration NumberQuestionConfiguration`

      - `Max float64`

        Maximum value for the number

      - `Min float64`

        Minimum value for the number

    - `Object NumberQuestionObject`

      - `const NumberQuestionObjectQuestion NumberQuestionObject = "question"`

    - `QuestionType NumberQuestionQuestionType`

      - `const NumberQuestionQuestionTypeNumber NumberQuestionQuestionType = "number"`

  - `type FreeTextQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Configuration FreeTextQuestionConfiguration`

      - `MaxLength int64`

        Maximum characters allowed

      - `MinLength int64`

        Minimum characters required

    - `Object FreeTextQuestionObject`

      - `const FreeTextQuestionObjectQuestion FreeTextQuestionObject = "question"`

    - `QuestionType FreeTextQuestionQuestionType`

      - `const FreeTextQuestionQuestionTypeFreeText FreeTextQuestionQuestionType = "free_text"`

  - `type FormQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `Configuration FormQuestionConfiguration`

      - `FormSchema map[string, any]`

        The JSON schema of the desired form object

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Object FormQuestionObject`

      - `const FormQuestionObjectQuestion FormQuestionObject = "question"`

    - `QuestionType FormQuestionQuestionType`

      - `const FormQuestionQuestionTypeForm FormQuestionQuestionType = "form"`

  - `type TimestampQuestion struct{…}`

    - `ID string`

      Unique identifier of the entity

    - `CreatedAt Time`

      ISO-timestamp when the entity was created

    - `CreatedBy Identity`

      The identity that created the entity.

    - `Name string`

    - `Prompt string`

      user-facing question prompt

    - `ArchivedAt Time`

      ISO-timestamp when the entity was archived

    - `Conditions []map[string, any]`

      Conditions for the question to be shown

    - `Configuration TimestampQuestionConfiguration`

      - `Multi bool`

        Whether to allow multiple timestamps

    - `Object TimestampQuestionObject`

      - `const TimestampQuestionObjectQuestion TimestampQuestionObject = "question"`

    - `QuestionType TimestampQuestionQuestionType`

      - `const TimestampQuestionQuestionTypeTimestamp TimestampQuestionQuestionType = "timestamp"`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  question, err := client.Questions.New(context.TODO(), sgpdev.QuestionNewParams{
    OfCategorical: &sgpdev.QuestionNewParamsQuestionCategorical{
      Configuration: sgpdev.CategoricalQuestionConfigurationParam{
        Choices: []string{"string"},
      },
      Name: "name",
      Prompt: "prompt",
      QuestionType: "categorical",
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", question)
}
```

#### 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"
}
```
