Retrieve and Delete Discount

Learn to retrieve and delete a discount created for a ticket of an event.

List discounts by organization

For example, we can view the discount on a specific event. For example, we want to view the discount on a specific event.

The following URL uses the GET method to retrieve the list of discounts:

https://www.eventbriteapi.com/v3/organizations/{organization_id}/discounts?scope={scope_value}

Filter the list of discounts

We can append different parameters with the above URL to retrieve the list of discounts. The table below shows the different values that we can use to filter the list of discounts. It returns a paginated JSON object.

Object

Type

Category

Description

organization_id

string

required

This is the ID of the organization to list the discounts for.

scope

string

required

This provides the scope of the discounts that we have to retrieve. The possible values are event, multi_events, and user.

code_filter

string

optional

It helps retrieves discounts by an approximate match of text.

code

string

optional

It helps retrieve discounts with an exact match of the code provided.

page_size

number

optional

This object provides the number of discount objects to return per page.

type

string

optional

This object provides the type of discount. The possible values are coded, access, public, and hold.

ticket_group_id

string

optional

This object helps retrieve the ticket with the exact match provided ticket_group_id.

event_id

string

optional

This object helps retrieve the discount with an exact match of event_id.

order_by

string

optional

This object helps retrieve the discounts in the order manner. The possible orders are code_asc, code_desc, discount_type_asc, discount_type_desc, start_asc, and start_desc.

Note: The event_id is necessary when using the scope=event in the filter parameters. We can remove event_id from the filter criteria if we are not using scope=event.

Let’s see an example to retrieve the discounts list of an event:

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

Retrieve a specific discount

If we want to retrieve only one specific discount detail, then we can use the following URL, which uses the GET method:

https://www.eventbriteapi.com/v3/discounts/{discount_id}/

Only one input parameter, {discount_id} is required with the URL. It returns the JSON object with all details of the discount.

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

Delete a specific discount

If we want to delete a discount on a ticket, then we can use the following URL, which uses the DELETE method:

https://www.eventbriteapi.com/v3/discounts/{discount_id}/

Only one input parameter, {discount_id} is required with the URL. If all goes well, it will return the JSON object with two attributes:

{'deleted': True, 'discount_id': '{discount_id}'}
Press + to interact
import requests
import json
url = 'https://www.eventbriteapi.com/v3/discounts/{{DISCOUNT_ID}}/'
headers = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
}
response = requests.request("DELETE", url, headers=headers).json()
print(json.dumps(response, indent=4))