Tickets Class

Learn to create, update, and list the tickets for an event using Eventbrite API.

Tickets are associated with events, and we create an object of ticket class for an event. We have to add at least one ticket class to an event before publishing it. Without it, Eventbrite won’t allow publishing the event on the platform.

Ticket creation

Eventbrite provides three fundamental ticket types: free, paid, and donation. Let’s create a ticket for an event. The following URL uses the POST method to create a ticket class:

https://www.eventbriteapi.com/v3/events/{event_id}/ticket_classes/

Request parameters

Some important request parameters of ticket_class are as follows:

Object

Type

Category

Description

name

string

required

This object indicates the name of the ticket class.

description

string

optional

This is the description of the ticket.

free

boolean

required

This object is a boolean variable that decides if the event is paid or free.

cost

string

optional

(required if the ticket is paid)

This object indicates the cost of the ticket. The cost is required if the event is paid. Otherwise, it is optional. The cost can be provided as "USD 2000," which means $20.

donation

boolean

optional

This object is a boolean variable that decides whether the ticket includes the donation or not.

capacity

number

required

This object specifies the audience capacity of the event.

minimum_quantity

number

optional

This object indicates the minimum tickets per order.

maximum_quantity

number

optional

This is the cost of the ticket.

sales_channels

array

optional

This object indicates a list of channels for sales. The supported channels include online or atd.

delivery_methods

string

optional

This object indicates a list of delivery methods. The supported methods are electronicwill_call, standard_shipping, third_party_shipping.

inventory_tier_id

string

optional

This object specifies the Inventory tier ID associated with the ticket class.

has_pdf_ticket

string

optional

This object indicates whether to include a PDF of the ticket or not.

Response parameters

If all goes well, the response will be an object of ticket class with additional information of ticket class id. Now, this ticket_class will be associated with the event provided.

Let’s create a free ticket for an event with a capacity of 100100.

Press + to interact
import requests
import json
url = 'https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/ticket_classes/'
headers = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
}
values = json.dumps({
"ticket_class": {
"name": "Ticket Name",
"free": True,
"capacity": "100",
"minimum_quantity": "1",
"maximum_quantity": "10",
"sales_channels": ["online", "atd"],
"delivery_methods": ["electronic"]
}
})
response = requests.request("POST", url, headers=headers, data=values).json()
print(json.dumps(response, indent=4))

The code in the below widget shows how to create a paid ticket costing 2020 dollars.

Press + to interact
{
"ticket_class": {
"name": "Ticket Name",
"free": False,
"cost": "USD,2000",
"capacity": "100",
"minimum_quantity": "1",
"maximum_quantity": "10",
"sales_channels": ["online", "atd"],
"delivery_methods": ["electronic"]
}
}

Note: One ticket class object represents one ticket associated with an event, and there can be more than one ticket for an event.

List tickets

We can list all the associated ticket classes with an event. The following URL uses the GET method to retrieve the ticket classes of an event:

https://www.eventbriteapi.com/v3/events/{event_id}/ticket_classes/

We have to provide the {event_id} in the URL, and it will return a paginated response with an array of all ticket classes associated with the {event_id}.

Press + to interact
import requests
import json
url = 'https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/ticket_classes/'
headers = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers).json()
print(json.dumps(response, indent=4))

Update ticket

We can update the ticket class by using the ticket class id. The following URL uses the POST method to update a ticket class:

https://www.eventbriteapi.com/v3/events/{event_id}/ticket_classes/{ticket_class_id}/

It requires the {event_id} and the {ticket_class_id} associated with the event in the URL. We can update any attribute with a valid value. Let’s update the ticket name, and capacity of the event.

Press + to interact
import requests
import json
url = 'https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/ticket_classes/{{TICKET_CLASS_ID}}/'
headers = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
}
values = json.dumps({
"ticket_class": {
"name": "New Ticket Name",
"capacity": "200"
}
})
response = requests.request("POST", url, headers=headers, data=values).json()
print(json.dumps(response, indent=4))

This operation will return the updated object of the ticket class associated with the given event ID.