Create and Update Event

Learn how to create and update an event on the Eventbrite platform using the Eventbrite API.

The event’s organization

We can create an event using an API call, but the organization ID is required. Every event is associated with an organization, and we need to specify the organization for an event. A default organization is created when we create the Eventbrite account. Visit this page to see the organization profile. We can upload “Organization Logo,” update the “Organization Name,” and set the “Preferred Country.”

The following URL utilizes the GET request method to fetch the details of the organizations:

https://www.eventbriteapi.com/v3/users/me/organizations/

This API call does not take any input parameters and returns a JSON object with organization details. Let’s see some important response parameters:

Request Parameters

Object

Type

Description

organizations.id

String

Unique ID of the organization

organizations.name

String

Name of the organization

Let’s retrieve the organization details by calling the API:

Press + to interact
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/users/me/organizations/');
const headerParameters = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
};
const options = {
method: 'GET',
headers: headerParameters,
};
async function fetchOrganizationDetails() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
// Calling function to make API call
fetchOrganizationDetails();

We have imported the node-fetch library to make the API call in the code above. The import code is hidden from the user.

  • Line 1: We define the endpoint URL.
  • Line 3–6: We define the header, which includes the authorization token and content type.
  • 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 fetchOrganizationDetails to make an API call using fetch and to handle any exception if it occurs. The printResponse and printError are the hidden custom functions to print the respective objects.
  • Line 23: We invoke the fetchOrganizationDetails function.

Create an event

Let’s use the organization ID to create an event within the organization. The following URL utilizes the POST request method to create an event within the organization:

https://www.eventbriteapi.com/v3/organizations/{organization_id}/events/

Some important request parameters are provided in the table below:

Request Parameters

Object

Type

Category

Description

event.name.html

String

Required

Name of the event written in HTML format

event.description.html

String

Required

Description of the event written in HTML format

event.start.timezone

String

Required

Timezone of start date

event.start.utc

String

Required

UTC standard is used to provide the date and time

event.end.timezone

String

Required

Timezone of end date

event.end.utc

String

Required

UTC standard is used to provide the date and time

event.currency

String

Required

The ISO 4217 currency code for this event

event.online_event

Boolean

Optional

Specifies if the event is online; possible values are true or false

event.listed

Boolean

Optional

Specifies if the event is publicly searchable; possible values true or false

event.shareable

Boolean

Optional

Specifies if the event is shareable on social networks; possible values are true or false

event.invite_only

Boolean

Optional

Only invitees of the event will be able to see the event page; possible values are true or false

event.show_remaining

Boolean

Optional

Specifies whether or not remaining tickets should be displayed; possible values are true or false

event.password

String

Optional

Event password to access the details of the event

event.capacity

Integer

Optional

Value of capacity allowed in the event

event.venue_id

String

Optional

Venue ID of the event

Note: Start and end dates must be in the future.

Let’s try to create an event by calling the API:

Press + to interact
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/organizations/{{ORGANIZATION_ID}}/events/');
const headerParameters = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
};
const bodyParameters = JSON.stringify({
"event": {
"name": {
"html": "My event name"
},
"description": {
"html": "Long description of the event."
},
"start": {
"timezone": "America/Los_Angeles",
"utc": "2022-12-01T02:00:00Z"
},
"end": {
"timezone": "America/Los_Angeles",
"utc": "2022-12-01T05:00:00Z"
},
"currency": "USD"
}
});
const options = {
method: 'POST',
headers: headerParameters,
body: bodyParameters,
};
async function createEvent() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
// Calling function to make API call
createEvent();
  • Line 1: We define the endpoint URL and it has ORGANIZATION_ID as the URL parameter.
  • Line 3–6: We define the header, which includes the authorization token and content type.
  • Line 8–26: We define the request parameters required to create an event.
  • Line 28–32: We set the API call options by specifying the header and body, and by setting the request method as POST.
  • Line 34–41: We create a function createEvent to make an API call using fetch and to handle any exception if it occurs. The printResponse and printError are the custom functions to print the respective objects.
  • Line 44: We invoke the createEvent function.

The above API call returns a JSON object. The table below explains some important attributes of the response object. This response object contains all the input parameters that we have provided with all others that are optional, and their values are set to default.

Response Fields

Object

Type

Description

response.id

String

Unique ID of the event

response.url

String

URL of the event to preview the event page after publishing

response.status

String

The event's status can be draft, started, ended, completed, canceled, or live

Retrieve an event

If we want to retrieve a specific event, the event_id can be used to retrieve the event’s details. The following URL utilizes the GET request method to retrieve the event:

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

The {event_id} is the required input parameter, which returns a JSON object with the event details.

Press + to interact
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/');
const headerParameters = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
};
const options = {
method: 'GET',
headers: headerParameters,
};
async function retrieveEvent() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
// Calling function to make API call
retrieveEvent();

Update an event

We can update an event by providing event_id and valid attributes that are to be updated by the API call.

The following URL utilizes the POST request method to update an event:

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

The fields that can be updated are the same as those for creating an event, and they can be referred to in the table above.

To update an event, we must provide at least one parameter. Let’s try to update the capacity and name of the event we have recently created.

Press + to interact
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/events/{{EVENT_ID}}/');
const headerParameters = {
'Authorization': 'Bearer {{PRIVATE_TOKEN}}',
'Content-Type': 'application/json'
};
const bodyParameters = JSON.stringify({
"event": {
"name": {
"html": "Updated name of the Event"
},
"capacity": 100
}
});
const options = {
method: 'POST',
headers: headerParameters,
body: bodyParameters,
};
async function updateEvent() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
// Calling function to make API call
updateEvent();
  • Line 1: We define the endpoint URL, and it has EVENT_ID as the the URL parameter.
  • Line 8–15: We define the request parameters with new values to update the event.

The response is an object of the event with the updated values.