Skip to content
Keptslot
Start free

Replace a question

PUT
/v1/questions/{id}
curl --request PUT \
--url https://api.keptslot.com/v1/questions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "label": "example", "help_text": "example", "type": "short_text", "options": [ "example" ], "required": true, "applies_to": "all_services" }'

This endpoint replaces a question. Send the whole question: an omitted required becomes false, and an omitted type or applies_to is rejected with 422.

It does not change the services set with PUT /v1/questions/{id}/services, and the response has service_ids as [].

Answers already given keep the label and the answer as they were when the customer answered. A replace does not change them.

id
required
string format: uuid

The question id.

Media type application/json

A whole question. Create and replace use the same shape.

object
label
required

At most 200 characters. Plain text.

string
help_text

At most 500 characters. Plain text.

string | null
type
required

short_text is one line and long_text is several. single_select is one choice from options.

string
Allowed values: short_text long_text single_select
options

The choices of a single_select question: from 2 to 20, none blank, each at most 200 characters, and all different after spaces are trimmed from the start and end. For short_text and long_text, omit it or send []; any choice is rejected with 422 on options.

Array<string>
required

If you omit it, the question is optional.

boolean
applies_to
required

all_services asks the question for every service. selected_services asks it only for the services set with PUT /v1/questions/{id}/services. Those services have no effect under all_services.

string
Allowed values: all_services selected_services

The question, after the replace.

Media type application/json

A question on the booking form, as the workspace manages it. The Question schema is the customer’s view of the same row, and has no active.

object
id
required
string format: uuid
label
required
string
help_text
required
string | null
type
required
string
Allowed values: short_text long_text single_select
options
required

Empty unless type is single_select.

Array<string>
required
required
boolean
applies_to
required
string
Allowed values: all_services selected_services
service_ids
required

The services set with PUT /v1/questions/{id}/services. GET /v1/questions and that endpoint return them. Create, replace, archive and restore always return [] here, whatever the services are.

Array<string>
position
required

Active questions list first, then archived ones; within each, by this value, lowest first.

integer
active
required

False when the question is archived. An archived question is not on the booking form.

boolean
Example
{
"type": "short_text",
"applies_to": "all_services"
}

The key is missing, malformed or revoked.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

This is a server route and you sent a publishable key. Send a secret key from your server. The type field is secret_key_required.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

There is no such resource in this workspace.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

The request body or the query is not valid.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

A fault on our side. Do not retry the same request in a loop. The type field is internal_error.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}