Skip to content

Archive a question

client.Questions.Archive(ctx, questionID) (*QuestionUnion, error)
DELETE/v5/questions/{question_id}

Soft-delete a question by setting its archived_at timestamp.

This is not a permanent delete: the row is retained and can be brought back with the restore endpoint. Once archived, the question is excluded from list results by default (unless include_archived is set) and can no longer be updated until it is restored. The archived question is returned in the response with its archived_at populated.

ParametersExpand Collapse
questionID string
ReturnsExpand Collapse
type QuestionUnion interface{…}
One of the following:
type CategoricalQuestion struct{…}
ID string

Unique identifier of the entity

Choices []string

Categorical answer choices (must contain at least one entry)

Multi boolOptional

Whether the question allows multiple answers.

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object CategoricalQuestionObjectOptional
QuestionType CategoricalQuestionQuestionTypeOptional
type RatingQuestion struct{…}
ID string

Unique identifier of the entity

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)

minimum1
CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object RatingQuestionObjectOptional
QuestionType RatingQuestionQuestionTypeOptional
type NumberQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration NumberQuestionConfigurationOptional
Max float64Optional

Maximum value for the number

Min float64Optional

Minimum value for the number

Object NumberQuestionObjectOptional
QuestionType NumberQuestionQuestionTypeOptional
type FreeTextQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration FreeTextQuestionConfigurationOptional
MaxLength int64Optional

Maximum characters allowed

minimum1
MinLength int64Optional

Minimum characters required

minimum0
Object FreeTextQuestionObjectOptional
QuestionType FreeTextQuestionQuestionTypeOptional
type FormQuestion struct{…}
ID string

Unique identifier of the entity

FormSchema map[string, any]

The JSON schema of the desired form object

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object FormQuestionObjectOptional
QuestionType FormQuestionQuestionTypeOptional
type TimestampQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration TimestampQuestionConfigurationOptional
Multi boolOptional

Whether to allow multiple timestamps

Object TimestampQuestionObjectOptional
QuestionType TimestampQuestionQuestionTypeOptional

Archive a question

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.Archive(context.TODO(), "question_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", question)
}
{
  "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"
}
Returns Examples
{
  "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"
}