Overview
The Events API allows you to create, read, update, and delete events within your organization. Events are the core entity in PassTru, containing attendees and check-in configurations.
The Event Object
Unique UUID identifier for the event
UUID of the organization that owns this event
Event name (max 255 characters)
URL-friendly identifier for the event (unique per organization)
Event date in ISO 8601 format
Event category (e.g., “Conference”, “Wedding”, “Training”)
Event status: active or suspended
Additional event details or description
Array of custom field names for attendee data (e.g., ["Name", "Email", "Department"])
Total number of attendees registered
Number of attendees who have checked in
Whether the public check-in page is active
Branding configuration for attendee portal pages
Branding configuration for check-in pages
Branding configuration for post-check-in pages
confirmation_email_content
HTML template for confirmation emails with variables like {{name}}, {{unique_id}}, {{portal_url}}
Timestamp when the event was created
Timestamp when the event was last updated
List Events
Retrieve all events for your organization:
const { data : events , error } = await supabase
. from ( 'events' )
. select ( 'id, name, slug, date, venue, category, status, total_attendees, checked_in_count' )
. eq ( 'organization_id' , organizationId )
. order ( 'date' , { ascending: false })
if ( error ) {
console . error ( 'Error fetching events:' , error )
} else {
console . log ( 'Events:' , events )
}
Response
[
{
"id" : "123e4567-e89b-12d3-a456-426614174000" ,
"name" : "Annual Tech Conference 2026" ,
"slug" : "annual-tech-conference-2026" ,
"date" : "2026-06-15" ,
"venue" : "Convention Center" ,
"category" : "Conference" ,
"status" : "active" ,
"total_attendees" : 250 ,
"checked_in_count" : 0
}
]
Get Event
Retrieve a single event by ID:
const { data : event , error } = await supabase
. from ( 'events' )
. select ( '*' )
. eq ( 'id' , eventId )
. single ()
if ( error ) {
console . error ( 'Error fetching event:' , error )
} else {
console . log ( 'Event:' , event )
}
Create Event
Create a new event (requires 1 event token):
Basic
With Token Deduction
const { data : event , error } = await supabase
. from ( 'events' )
. insert ({
organization_id: organizationId ,
name: 'Summer Workshop 2026' ,
slug: 'summer-workshop-2026' ,
date: '2026-07-20' ,
venue: 'Training Center' ,
category: 'Training' ,
attendee_fields: [ 'Name' , 'Email' , 'Department' ]
})
. select ()
. single ()
if ( error ) {
console . error ( 'Error creating event:' , error )
} else {
console . log ( 'Event created:' , event )
}
Parameters
Update Event
Update event details:
const { data : event , error } = await supabase
. from ( 'events' )
. update ({
venue: 'Updated Venue' ,
details: 'Updated event description' ,
status: 'active'
})
. eq ( 'id' , eventId )
. select ()
. single ()
if ( error ) {
console . error ( 'Error updating event:' , error )
} else {
console . log ( 'Event updated:' , event )
}
Delete Event
Delete an event and return attendee tokens:
// First, return attendee tokens
const { data : returnedTokens } = await supabase . rpc (
'return_attendee_tokens_on_event_delete' ,
{
_event_id: eventId ,
_organization_id: organizationId
}
)
console . log ( `Returned ${ returnedTokens } attendee tokens` )
// Then delete the event
const { error } = await supabase
. from ( 'events' )
. delete ()
. eq ( 'id' , eventId )
if ( error ) {
console . error ( 'Error deleting event:' , error )
} else {
console . log ( 'Event deleted successfully' )
}
Toggle Check-in Page
Activate or deactivate the public check-in page:
const { error } = await supabase
. from ( 'events' )
. update ({ checkin_page_active: true })
. eq ( 'id' , eventId )
if ( error ) {
console . error ( 'Error toggling check-in page:' , error )
} else {
console . log ( 'Check-in page activated' )
}
Get Public Event Info
Retrieve public event information (no authentication required):
const { data : eventInfo } = await supabase . rpc (
'get_event_public_info' ,
{
_event_slug: 'summer-workshop-2026' ,
_org_id: organizationId
}
)
if ( eventInfo && eventInfo . length > 0 ) {
const event = eventInfo [ 0 ]
console . log ( 'Public event info:' , event )
}
Response
Whether check-in page is active
Check-in page branding configuration
Portal page branding configuration
Filter Events
By Status
const { data : activeEvents } = await supabase
. from ( 'events' )
. select ( '*' )
. eq ( 'organization_id' , organizationId )
. eq ( 'status' , 'active' )
By Date Range
const { data : upcomingEvents } = await supabase
. from ( 'events' )
. select ( '*' )
. eq ( 'organization_id' , organizationId )
. gte ( 'date' , new Date (). toISOString ())
. order ( 'date' , { ascending: true })
By Category
const { data : conferences } = await supabase
. from ( 'events' )
. select ( '*' )
. eq ( 'organization_id' , organizationId )
. eq ( 'category' , 'Conference' )
Error Handling
Always check for errors when creating events. Common issues include:
Insufficient event tokens
Duplicate slug within organization
Invalid date format
Missing required fields
const { data , error } = await supabase
. from ( 'events' )
. insert ({ /* ... */ })
if ( error ) {
// Handle specific error codes
if ( error . code === '23505' ) {
console . error ( 'Event slug already exists' )
} else if ( error . code === 'PGRST116' ) {
console . error ( 'Permission denied' )
} else {
console . error ( 'Error:' , error . message )
}
}
Next Steps
Attendees API Add attendees to your events
Check-ins API Manage attendee check-ins