I’m trying to use Python to change the ‘checked_in’ status of attendees of an Eventbrite event. Reading the status is quite easy but it’s not clear in the reference docs which endpoint needs to be accessed and what all has to be sent. I have some info that the endpoint might be related to the barcodes but I’m not sure.
This psudo-code successfully prints the attendee list:
import requests
import json
url = "https://www.eventbriteapi.com/v3/events/{EVENT_ID}/attendees/?token={TOKEN}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
for attendee in data['attendees']:
print("######################")
profile = attendee['profile']
print(profile)
else:
print(f"Error: {response.status_code}")
print(response.text)
Another part of the receied JSON data looks like this:
import requests
import json
# Replace these with your actual values
EVENT_ID = "your_event_id_here" # e.g., "123456789"
TOKEN = "your_oauth_token_here" # OAuth token with write permissions
# Step 1: Fetch attendees to get their IDs (your existing code)
url = f"https://www.eventbriteapi.com/v3/events/{EVENT_ID}/attendees/?token={TOKEN}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
for attendee in data['attendees']:
attendee_id = attendee['id'] # This is the key piece
print(f"Attendee ID: {attendee_id}, Checked In: {attendee['checked_in']}")
# Step 2: Check in the attendee
checkin_url = f"https://www.eventbriteapi.com/v3/events/{EVENT_ID}/attendees/{attendee_id}/checkin/"
headers = {
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json"
}
# The payload can be minimal; the endpoint assumes a check-in action
payload = {}
# Step 3: Send the POST request to check in
checkin_response = requests.post(checkin_url, headers=headers, data=json.dumps(payload))
if checkin_response.status_code == 200:
print(f"Successfully checked in attendee {attendee_id}")
else:
print(f"Failed to check in attendee {attendee_id}: {checkin_response.status_code}")
print(checkin_response.text)
else:
print(f"Error fetching attendees: {response.status_code}")
print(response.text)
Explanation
Attendee ID: In the JSON response from /attendees/, each attendee has an id field (e.g., “123456789”). This is distinct from the barcode value and is required for the check-in endpoint.
Endpoint: The checkin/ endpoint is undocumented in some older Eventbrite API references but is part of the v3 API. It’s specifically for toggling the check-in status.
Headers: The OAuth token must be passed as a Bearer token in the Authorization header, not as a query parameter like in your GET request. This is a more secure and standard practice for write operations.
Payload: The endpoint doesn’t require a specific body for a basic check-in (it assumes you’re setting checked_in to true). If you need to undo a check-in, you’d use a different approach (not covered here, as it’s less straightforward and involves barcode status manipulation).
Verifying the Change
After running the POST request, you can re-run your GET request to confirm the checked_in field is now true and the barcode status is “used”. For example: