Tickets Class
Learn to create, update, and list the tickets for an event using Eventbrite API.
We'll cover the following
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 |
| string | required | This object indicates the name of the ticket class. |
| string | optional | This is the description of the ticket. |
| boolean | required | This object is a boolean variable that decides if the event is paid or free. |
| 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 |
| boolean | optional | This object is a boolean variable that decides whether the ticket includes the donation or not. |
| number | required | This object specifies the audience capacity of the event. |
| number | optional | This object indicates the minimum tickets per order. |
| number | optional | This is the cost of the ticket. |
| array | optional | This object indicates a list of channels for sales. The supported channels include |
| string | optional | This object indicates a list of delivery methods. The supported methods are |
| string | optional | This object specifies the Inventory tier ID associated with the ticket class. |
| 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 .
import requestsimport jsonurl = '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 dollars.
{"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}
.
import requestsimport jsonurl = '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.
import requestsimport jsonurl = '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.