Getting started

Whether you're just starting to work with APIs or you're an expert, we're here to help you create apps that connect people to amazing live events. Here's an overview of what to do to get started working with StubHub APIs.

 

  1. Create your StubHub developer account
  2. Create your StubHub user account
  3. Create your app and subscribe to our APIs
  4. Get your access keys
  5. Generate your access token
  6. Start using our APIs
  7. Scale your app

You can learn more about each step in the following topics. We'll also talk about how to generate access tokens for your sellers and refresh access tokens.

 

Creating your StubHub developer account

To start working with StubHub APIs, you'll need to create a StubHub developer account. Already have a StubHub account? You'll still need to create a developer account, but you can use the same email address. From the home page, click Sign up, enter your info and you're all set!

 

Are you a seller using a point-of-sale (POS) system? No need to create a developer account – just get in touch with your POS contact and ask about accessing StubHub APIs. 

 

Creating your StubHub user account

You'll also need a StubHub user account to use the StubHub APIs. If you don't already have one, head over to www.stubhub.ie to create an account. You'll need this account credentials to generate an access token for the app you'll create in the next step.

 

Creating your app and subscribing to StubHub APIs

Once you have a StubHub developer account, you can create your app and subscribe to our APIs. Here's what you need to do:

 

  1. Sign in and click Apps under your email address
  2. On the apps page, click Create an app
  3. Tell us about your app
  4. Choose the API products you want to subscribe to and click Create app

Please note you need to get approval to subscribe to some API products. We'll review your request and get back to you within 1 business day.

 

Getting your access keys

After creating your app, you'll need access keys. Click the app name to view the consumer key and consumer secret. You'll use these keys to create an access token.

 

Generating an access token
You'll need to include your access token in your HTTP requests so StubHub can recognize and authenticate you. You'll need to refresh your token every 6 months.

 

To generate an access token:

  1. Concatenate your app’s consumer key and secret separated by a colon (:) like this - yourAppKey:yourAppSecret
  2. Generate the Base64 encoded value of this concatenated text.
  3. In the authorization header for generateToken API, enter Basic followed by the Base64 encoded value you generated using this format: Basic base64encodedValue
  4. In the request body, send the email and password for the applicable StubHub account you created, in Creating your StubHub user account section above, in this format: { "username":"www.stubhub.ie account email", "password":"www.stubhub.ie account password" }

Important: The email/password you send in the request body must belong to an account created on www.stubhub.ie and NOT your developer account created on beta-developer.stubhub.ie.

  1. Your access token will show up in the access_token field of the response

You can then use this token and pass it as a Bearer token authorization header while accessing other APIs.

 

Here's an example CURL request:

curl -X POST --header "Authorization: Basic base64encodedValue​" --header "Content-Type: application/json" -d '{
   "username": "www.stubhub.ie account email",
   "password": "www.stubhub.ie account password"
}' https://api.stubcloudprod.com/sellers/oauth/accesstoken?grant_type=client_credentials

Generating access tokens for your sellers

To generate access tokens for your sellers, please contact us.

 

Refreshing access tokens

Access tokens expire every 6 months. You can use the refreshToken API to refresh your token. Here's an example cURL request:

curl -X POST --header "Authorization: Basic base64encodedValue" --header "Content-Type: application/x-www-form-urlencoded" -d \
'grant_type=refresh_token&refresh_token=refresh-token-from-generateTokenAPI' https://api.stubcloudprod.com/sellers/oauth//refresh_accesstoken

Using our APIs
Once you generate your access token, you can start using the APIs from the product lines you subscribe to. You can try any API directly on the developer portal by accessing the API page, filling out the required fields and body, and then submitting the request. The appropriate response will then display there. You can also copy the CURL command for the request directly from the developer portal. Check out our products section to read detailed API interface descriptions, and to learn how to configure your HTTP requests and use your access token in your HTTP requests.

Here's an example CURL request for creating a listing:

curl -X POST --header "Authorization: Bearer **********************" --header "Accept: application/json" --header "Content-Type: application/json" --header "Accept-Language: en-US" -d '{
    "eventId": 103619888,
    "pricePerProduct": { "amount": 100, "currency": "USD"},
    "externalListingId": 159632,
    "products": [
        {
            "externalId": "12",
            "row": "JD",
            "seat": "1",
            "productType": "TICKET",
            "ga": false
        },
        {
            "externalId": "13",
            "row": "JD",
            "seat": "2",
            "productType": "TICKET",
            "ga": false
        },
        {
            "externalId": "14",
            "row": "JD",
            "seat": "3",
            "productType": "TICKET",
            "ga": false
        }
    ],
    "stockType": ["PDF"],
    "paymentType": 1
}' "https://api.stubcloudprod.com/sellers/inventory/listings/v3"

 

Scaling your app

You're working with StubHub APIs and building apps – that's great! When you're ready to take things to the next level, choose a plan that is right for your needs and submit an upgrade request for review by our governance team. You can find the available plans here.