Publish and Unpublish Event

Learn to publish and unpublish an event using Eventbrite API.

We'll cover the following

Publish an event

We need to publish the events to make them viewable to the targeted audience. The event should have all necessary data, including event name, description, organizer, ticket class, and valid payment method.

The following URL uses the POST method to publish an event:

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

We need to provide the {event_id} in the URL to publish it. It returns a JSON object with one attribute published with the value true if all goes well. Otherwise, it returns a JSON object with error_description and status_code attributes.

Let’s see an example to publish the previously created event, which should be associated with at least one ticket class.

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

Unpublish an event

Eventbrite also provides the facility to unpublish an event at any time. An event can only be unpublished if it doesn’t have any pending or completed ticket orders.

The following URL uses the POST method to unpublish an event:

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

We need to provide the {event_id} in the URL to unpublish the event. If all goes well, it returns a JSON object with one attribute unpublished with the value true. Otherwise, it returns a JSON object with error_description and status_code attributes.

Let’s see an example to unpublish a published event.

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