Order Questions
Learn about order questions and how to retrieve and create them.
Overview
There are two types of order questions, default and custom questions, that appear on the checkout screen while one is purchasing the tickets. Eventbrite uses these questions to collect information from the attendee. We can list the default questions and create new custom questions using the Eventbrite API.
Default questions
Eventbrite provides a list of default questions to inquire about the attendee’s basic information, such as first name, last name, and email address.
The following URL utilizes the GET
request method to retrieve the list of default questions for an event:
https://www.eventbriteapi.com/v3/events/{event_id}/canned_questions/
We provide the {event_id}
in the URL to retrieve the default questions. It returns a paginated JSON object of questions.
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/canned_questions/');const headerParameters = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'};const options = {method: 'GET',headers: headerParameters,};async function defaultQuestions() {try {const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}// Calling function to make API calldefaultQuestions();
- Line 1: We define the endpoint URL; it has
EVENT_ID
as the URL parameter. - Line 8–11: We set the API call options by specifying the header and by setting the request method as
GET
. - Line 13–20: We create a function
defaultQuestions
to make an API call using fetch and to handle any exception if it occurs. The custom functionsprintResponse
andprintError
print the respective objects. - Line 23: We invoke the
defaultQuestions
function.
Custom questions
Eventbrite provides the ability to create a custom question to ask the attendees for specific information, such as the attendee’s education and medical condition.
There are different types of custom questions. We must specify one of these question types: checkbox
, dropdown
, text
, radio
, or waiver
.
The following URL utilizes the POST
request method to create a custom question:
https://www.eventbriteapi.com/v3/events/{event_id}/questions/
The {event_id}
and {ticket_class_id}
are required to link the ticket class of the event with the question. The {event_id}
is provided in the URL and
{ticket_class_id}
is provided as the request parameter.
The input query parameters to create the custom question are as follows:
Request Parameters
Object | Type | Category | Description |
| String | Required | Statement of the question |
| Boolean | Required | Specifies if an answer to the question is necessary |
| Enum | Required | Type of question; possible values are |
| Enum | Optional | Specifies who will answer the question: |
| String | Optional | Content of the waiver question. |
| String [ ] | Required | List of answers |
| String [ ] | Required | One or more values of |
| String | Optional | ID of the parent question if the current question is the subquestion |
| String | Optional | ID of the parent choice if the current question is the subquestion |
| Boolean | Optional | Specifies whether or not to show the answer on the checkout screen |
Let’s create a question for an event:
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/questions/');const headerParameters = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'};const bodyParameters = JSON.stringify({"question": {"question": {"html": "Ticketing Terms of Service: I acknowledge that..."},"required": "True","type": "checkbox","choices": [{"answer": {"html": "yes"}}],"ticket_classes": [{"id": "{{TICKET_CLASS_ID}}"}]}});const options = {method: 'POST',headers: headerParameters,body: bodyParameters,};async function customQuestion() {try {const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}// Calling function to make API callcustomQuestion();
- Line 1: We define the endpoint URL; it has
EVENT_ID
as the URL parameter. - Line 3–6: We set the API call options by specifying the header and body parameters, and by setting the request method as
POST
. - Line 8–26: We provide the details of the custom question.
- Line 34–41: We create the function
customQuestion
to make an API call using fetch and to handle any exception if it occurs. The custom functionsprintResponse
andprintError
print the respective objects. - Line 44: We invoke the
customQuestion
function.
The above API call returns a JSON object of the custom question with the values of the attributes.
The question types checkbox
, dropdown
, and radio
are created in the same way, and in these kinds of questions, the attendee has to select the answer from multiple answers. A sample format is given below to add multiple answers:
{"question": {"question": {"html": "Question statement goes here..."},"required": "True","type": "checkbox","choices": [{"answer": {"html": "Choice goes here..."}},{"answer": {"html": "Another choice goes here..."}}],"ticket_classes": [{"id": "{{TICKET_CLASS_ID}}"}]}}
Retrieving an event’s custom questions
We can retrieve the list of the custom questions for an event using the following URL, which utilizes the GET
request method to call the API:
https://www.eventbriteapi.com/v3/events/{event_id}/questions/
It only takes {event_id}
as an input parameter and returns a paginated response with a list of custom questions.
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/questions/');const headerParameters = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'};const options = {method: 'GET',headers: headerParameters,};async function retrieveTickets() {try {const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}// Calling function to make API callretrieveTickets();
Delete a custom question
A custom question can be deleted by using the following URL, which utilizes the DELETE
request method to call the API:
https://www.eventbriteapi.com/v3/events/{event_id}/questions/{question_id}/
It requires the {event_id}
and {question_id}
to be provided in the URL while calling the API and returns a JSON object with one boolean attribute deleted
or an error object.
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/questions/{{QUESTION_ID}}/');const headerParameters = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'};const options = {method: 'DELETE',headers: headerParameters,};async function deleteCustomQuestion() {try {const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}// Calling function to make API calldeleteCustomQuestion();