Salta navigazione principale
Contenuto pagina

Quick Start

The Eventbrite API is REST-based (though we generally use POST rather than PUT), uses OAuth2 for authentication, and always returns responses in JSON.

All you’ll need to interact with the API are your favourite HTTP library and a JSON parser - in the examples below, we’ll be using Python with the requests library.

Authenticating

The first step is to authenticate with the API using OAuth2. Usually, this would involve you redirecting to our OAuth2 endpoint, approving app access, and then getting redirected back to your app with a token, but for ease of debugging we auto-generate personal OAuth tokens for any apps you have.

Simply go to your apps page, and make an app if you haven’t already. When you’ve made one, there will be a “Personal OAuth token” entry in the app’s Keys column - that’s a token you can use straight away to access the API as you.

Don’t give this token to anyone - it grants full access to your account.

Exploring the API

A full list of endpoints is available, but for now let’s just explore two of the more basic ones:

  • /users/me/: Shows information about the current user (you)
  • /users/me/owned_events: A list of events you’re organizing

The Eventbrite API comes complete with an API Explorer, which lets you see detailed debugging information for any endpoint just by going to it in a web browser. For this example, go to (replace MYTOKEN with your token):

https://www.eventbriteapi.com/v3/users/me/?token=MYTOKEN

You’ll see details of what parameters we parsed from the request, what token and user we’ve identified you as, the headers and status code of the response, and the full JSON response, syntax highlighted and with clickable links to other endpoints if they’re included in the response.

The initial response you’ll get back from /users/me/ won’t be that exciting, though, and will look something like this:

{
    "emails": [
        {
            "email": "andrewgodwin@eventbrite.com",
            "verified": false,
            "primary": true
        }
    ],
    "id": 85329145958,
    "name": "Andrew Godwin",
    "first_name": "Andrew",
    "last_name": "Godwin"
}

It’s very simple; /users/me/ just returns a single User object of the current user.

Now, let’s look at a more complex example: events. Make sure you’ve got at least one event created on the site (you can make an event very easily; just visit our Create an Event page, give your event a title and one or two ticket types, and mark it as private).

Once you’ve got an event, just look at /users/me/owned_events/:

https://www.eventbriteapi.com/v3/users/me/owned_events/?token=MYTOKEN

The response will look something like this:

{
    "pagination": {
        "object_count": 1,
        "page_number": 1,
        "page_size": 50,
        "page_count": 1
    },
    "events": [
        {
            "resource_uri": "https://www.eventbriteapi.com/v3/events/10067458038/",
            "name": {
                "text": "Test Event 1",
                "html": "Test Event 1"
            },
            "description": {
                "text": null,
                "html": null
            },
            "organizer": {
                "description": {
                    "text": "An organizer",
                    "html": "<P>An organizer<\/P>"
                },
                "id": 5867211989,
                "name": "Andrew's Amazing Conferences"
            },
            "venue": null,
            "ticket_classes": [
                {
                    "id": 22717678,
                    "name": "Standard Entry",
                    "cost": "54.11",
                    "fee": "3.97",
                    "currency": "USD",
                    "free": false,
                    "minimum_quantity": 1,
                    "maximum_quantity": null,
                    "quantity_total": 100,
                    "quantity_sold": 1,
                    "sales_start": null,
                    "sales_end": "2014-02-22T18:00:00Z"
                },
            ],
            "id": 10067458038,
            "url": "http://www.eventbrite.com/e/test-event-1-tickets-10067458038",
            "start": "2014-02-22T19:00:00Z",
            "end": "2014-02-22T22:00:00Z",
            "created": "2014-01-13T06:25:19Z",
            "changed": "2014-01-14T03:15:50Z",
            "timezone": "America/Los_Angeles",
            "capacity": 100,
            "categories": [],
            "status": "live"
        }
    ]
}

This is a paginated response of all the events your user account is organizing. The result of the call - inside that pagination - is just a list of event objects.

Using Code

Now, let’s interact with the API using some code. Rather than include the token as a GET parameter - as we’ve been doing with the API explorer - it’s better to include it as an Authorization header (with the value “Bearer MYTOKEN”, replacing MYTOKEN for your OAuth token).

Here’s an example in Python:

import requests
response = requests.get(
    "https://www.eventbriteapi.com/v3/users/me/owned_events/",
    headers = {
        "Authorization": "Bearer SESXYS4X3FJ5LHZRWGKQ",
    },
    verify = True,  # Verify SSL certificate
)
print response.json()['events'][0]['name']['text']

Rate Limiting

Eventbrite starts everyone off at 1,000 calls per hour on each OAuth token. Please attempt to work within these constraints. If you hit your limit, email us at api@eventbrite.com and make a case for an increase.

Further Steps

Now you’ve got some basic responses out of the API, we recommend reading: