API Documentation - LeagueApps

Extend the LeagueApps Experience

Start innovating by leveraging your data

LeagueApps APIs are built to support the ever growing needs of our partners. Our current infrastructure includes a Public API and Private API which provide secure access to information from LeagueApps such as member details, registration, transactions, as well as public facing information like program lists, teams and schedules.

Innovative Ideas
– Integrate with sport applications for recruiting, player evaluations, stats, etc.
– Add custom displays of schedules or program registration to your website
– Build custom player profiles, applications or reports
– Sync data to your CRM, central database or other online tools

Read the documentation below for a comprehensive list of data included in our Private and Public API. Then begin building right away with self-serve API access through the LeagueApps Admin Console.

 

Private API

https://admin.leagueapps.io

The Private API provides secure access to a suite of information which is managed within the LeagueApps Admin Console for a given site. This includes information such as registration details, transaction histories, and member details. This API is intended for more advanced integrations that need to access private or sensitive data.

Private Access Requirements

Access to this private information requires secure authentication. Accessing this API requires the use of our token-based security scheme, based on OpenID Connect. This scheme utilizes OAuth2 and Javascript Web Tokens (JWT), and enforces SSL/TLS on all connections.

Follow these steps to generate access to the Private API:

  1. Login to LeagueApps, click ‘Connect’ on the side navigation bar, then click ‘API’
  2.  

  3. Click ‘Generate Service Account’
    • Your browser will automatically download a secret PKCS12 key file (extension is .p12) with ‘notasecret’ as the passphrase. Keep this p12 file safe, your developer will need it to connect to the Private API.
    • Your Client ID will also display on the browser page; our developer needs the Client Id to complete the API authentication steps.
  4. Download a JWT library for your programming language. This library is needed for one of the first steps in the client code implementation section.
    • There are libraries for generating JWTs in a variety of languages, available here: https://jwt.io
  5. Implement client code authentication. Your client code must implement steps 4A – 4D in order to authenticate to the Private API.
    • Step 4A: Use the secure p12 key file to generate a pem file for use in the next step.
      • Open terminal and on command line, do the following:
        openssl pkcs12 -nodes -in my_example.p12 -out my_example.pem
      • When prompted for passphrase, enter: notasecret
    • Step 4B: Use the pem file to generate a JWT assertion encoded in base64 for URLs
      • Key inputs:
        • Important JWT header fields
          • alg: RS256
        • Important JWT claim fields
      • Example Code snippet:
        #!/usr/bin/env python
        # requires pyjwt and requests
        # ubuntu 16.04: sudo apt install python-jwt python-crypto python-requests
        # or: pip install pyjwt crypto requests2
        
        import time
        import jwt
        import requests
        
        AUTH_HOST='https://auth.leagueapps.io/v2/auth/token'
        API_HOST='https://admin.leagueapps.io'
        
        
        //Step 2: Generate JWT Assertion
        
        with open('key.pem', 'r') as f:
            key = f.read()  //Reading in your pem file, which was converted from your p12 in STEP 1 
        
        client_id = '<YOUR_CLIENT_ID>'
        
        now = int(time.time())
        
        claims = {
                'aud': AUTH_HOST,
                'iss': client_id,
                'sub': client_id,
                'iat': now,
                'exp': now + 300
                }
        
        assertion = jwt.encode(claims, key, algorithm='RS256')
                  
    • Step 4C: Request an access_token. To do this, do an HTTP POST assertion to the Private API auth end-point: https://auth.leagueapps.io/v2/auth/token
      • Key Inputs:
        • grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
        • assertion=<generated JWT assertion>
      • The response of this API call will include an access_token. You will use this in the next step, to make API calls to the Private endpoints.
      • Example code:
        //Step 3:  Request an Access Token
        
        r = requests.post(AUTH_HOST,
              data={ 'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
                  'assertion': assertion })
        
        if r.status_code == 200:
            access_token = r.json()['access_token']
            print('access_token: {}'.format(access_token))
        else:
            print('failed to get access_token: status {}\n{}'.format(r.status_code, r.text))
              
    • Step 4D: Make API calls to desired end-points, using the access_token provided in the previous step.

      Use the Authorization header with value “Bearer <ACCESS-TOKEN>” to make HTTP GET requests to desired end-points.

      • Notes:
        • ‘?debug-json’ as an HTTP parameter pretty prints the output and includes all fields. Fields with null values are normally not returned.
      • Example code:
        //Step 4:  Make API call, using the Access Token
        
        headers={ 'authorization': 'Bearer {}'.format(access_token) }
        r = requests.get(API_HOST + '/v2/sites/1/export/registrations
        ?debug-json', headers=headers)
        registrations = r.json()

Private Endpoints

Export Registrations

End Point https://admin.leagueapps.io/v2/sites/{SITE-ID}/export/registrations
Description Returns a list of registrants, with basic member information, parent information, invoice details, program data, and custom registration form fields.
Intended to pull large exports of registration records.
Parameters last-updated (required) Date
includeDeleted (optional) Boolean
program-id (optional) Integer
Results (JSON)
[{
      	"registrationId": 3396235,
      	"registrationStatus": "SPOT_RESERVED",
      	"siteName": "LeagueApps Academy",
      	"lastUpdated": 1469216630000,
      	"created": 1469216627000,
      	"userId": 946336,
      	"firstName": "Robbie",
      	"lastName": "Smith",
      	"userType": "CHILD",
      	"birthDate": 916117200000,
      	"gender": "Male",
      	"zipCode": "11215",
        "groupName": "Smith Family",
      	"groupId": 18890,
      	"parentUserId": 2465341,
      	"parentFirstName": "Bob",
      	"parentLastName": "Smith",
      	"parentEmail": "bob.smith@gmail.com",
      	"parentPhone": "+12125551212",
      	"paymentStatus": "PAID",
      	"invoiceId": 2714068,
      	"totalAmountDue": 80.0,
      	"outstandingBalance": 0.0,
      	"amountPaid": 80.0,
      	"price": 75.0,
      	"programId": 65959,
      	"programType": "CAMP",
      	"programName": "Summer Camp",
      	"programState": "UPCOMING",
      	"programStartDate" : 1446350400000,
      	"sportId": 2,
      	"sport": "Basketball",
        "teamID": "554518",
        "team": "Marlins",
      	"waiverAcceptedTimestamp": 1469216627000,
        "role": "FREEAGENT",
      	"Position": "Forward",
      	"Special Requests": "None"
      }]

Export Members

End Point https://admin.leagueapps.io/v2/sites/{SITE-ID}/export/members
Description Returns a list of members on the site including basic member information, custom member profile fields, and family/group information.
Intended to pull large exports of member records.
Parameters last-updated (required) Date
includeDeleted (optional) Boolean
Results (JSON)
[{
	"userId": 946335,
	"firstName": "Bob",
	"lastName": "Smith",
	"email": "bob.smith@gmail.com",
	"mobilePhone": "+12125551212",
	"type": "ADULT",
	"username": "bsmith",
	"orgAccountRole": "UNAUTHORIZED",
	"lastLogin": 1407953042000,
	"lastUpdated": 1407953042000,
	"newsletterOptIn": false,
	"dateJoined": 1407953042000,
	"gender": "Male",
	"birthDate": 917067600000,
	"groupId": 18890,
	"groupName": "Smith Family",
	"address1": "123 Main Street",
	"city": "Brooklyn",
	"state": "NY",
	"zipCode": "11215"
}, {
	"userId": 946336,
	"firstName": "Robbie",
	"lastName": "Smith",
	"type": "CHILD",
	"username": "kidt79",
	"orgAccountRole": "UNAUTHORIZED",
	"lastUpdated": 1411661003000,
	"newsletterOptIn": true,
	"dateJoined": 1411661003000,
	"gender": "Male",
	"birthDate": 1073883600000,
	"groupId": 18890,
	"groupName": "Smith Family",
	"address1": "123 Main Street",
	"city": "Brooklyn",
	"state": "NY",
	"zipCode": "11215",
	"School": "Bayside High School",
	"Graduation Year": "2020"
}]

Member Detail

End Point https://admin.leagueapps.io/v2/sites/{SITE-ID}/members/{USER-ID}
Description Returns the full profile detail for a single site members.
Parameters userId (required) Integer
Results (JSON)
[{
        "userId": 2668506,
        "deleted": "False",
      	"userProfileId": 2666787,
      	"dateJoined": 1476381602000,
      	"lastUpdated": 1527889693000,
      	"lastLogin": 1527889693000,
      	"type": "ADULT",
      	"orgAccountRole": "UNAUTHORIZED",
        "groupId": 640935,
        "email": "test@leagueapps.com",
        "newsletterOptIn": True,
        "membershipExpiration": "None",
      	"firstName": "Robbie",
      	"lastName": "Smith",
      	"birthDate": 916117200000,
      	"gender": "Male",
        "address1": "100 Main St",
        "address2": "2nd floor",
        "city": "New York",
        "state": "NY",
        "country": "None",
      	"zipCode": "11215",
      }]

Export Transactions

End Point https://admin.leagueapps.io/v2/sites/{SITE-ID}/export/transactions
Description Returns transaction data along with user, payments, and basic registration detail.
Intended to pull large exports of transaction records.
Parameters last-updated (required) Date
last-id (optional) Integer
Results (JSON)
[{
    "siteId": 1,
    "id": 1234,
    "lastUpdated": 1469216630000,
    "type": "CHARGE",
    "gateway": "Stripe",
    "amount": 45.00,
    "netAmount": 40.00,
    "userId": 2,
    "firstName": "Stanley",
    "lastName": "Jackson",
    "programId": 13929,
    "programName": "Intermediate Soccer Program",
    "programType": "LEAGUE",
    "programCode": "code001",
    "masterProgramId": null,
    "masterProgramName": null,
    "masterProgramType": null,
    "masterProgramCode": null,
    "productId": null,
    "productName": null
}]

Public API

https://public.leagueapps.io

The Public API provides access to a full suite of publicly accessible content and functionality for a specific site. This includes information that is typically displayed on public facing websites, such as program listings, teams, and schedules. This API is intended for integrations that need programmatic access to public content (e.g., schedules) in order to create custom apps, pages, content, and tools.

Access Requirements

Public content is accessed using a simple key based approach, and supports lightweight client implementations such as Javascript-based fetching of content for inclusion into external websites or apps. The Public API is structured as REST endpoints which return results in JSON format. Every request must include a valid API Key in order to be granted access. Calls to endpoints are made as HTTP GET requests, and the API key is included in the header as ‘la-api-key’.

The following illustrates the operation of the API via an example of a request to fetch a list of programs for a given site:

Endpoint URL: https://public.leagueapps.io/v1/sites/{SITE_ID}/programs/current

Replace {SITE_ID} with your Site’s unique ID. This can be found in the URL of your site when you are logged into the console (https://manager.leagueapps.com/console/sites/{SITE_ID}).

The API Key is added into the header of the GET request as: la-api-key: {API_KEY}
{API_KEY} is replaced with your provided API Key.

Follow these steps to generate access to the Public API:

  1. Login to LeagueApps, click ‘Connect’ on the side navigation bar, then click ‘API’
  2. Click ‘Generate API Key’
  3. Copy the generated API Key

TIP: If you’ve already created a Service Account for the Private API, you can use the Client ID provided by that step as the Public API Key for the Public API.

Public Endpoints

Site Info

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}
Description Returns basic information about the site. It includes the hex code for color selections made in the theme editor for the site. This can be useful if you want to style your client implementation with the same colors as used on your LA powered site.
Results (JSON)
[
  {
      "id": "1482",
      "name": "My Site Name",
      "subdomain": "mysite",
      "domain": null,
      "url": "//mysite.leagueapps.com//",
      "logoUrl": null,
      "theme": {
          "colors": {
              "alerts": "#ffffdd",
              "alternateText": "#aaaaaa",
              "bodyText": "#484848",
              "buttonBackground": "#2d6cbe",
              "buttonBackgroundHover": "#1d4483",
              "buttonText": "#ffffff",
              "buttonTextHover": "#ffffff",
              "contentBackground": "#ffffff",
              "headerBackground": "#333333",
              "headings": "#484848",
              "links": "#2d6cbe",
              "linksHover": "#1d4483",
              "logo": "#ffffff",
              "mainNavBackground": "#212121",
              "mainNavLinks": "#bbbbbb",
              "mainNavLinksHover": "#ffffff",
              "pageBackground": "#6f727a",
              "sidebarBackground": "#f6f6f6",
              "widgetBackground": ""
          }
      }
  }
]

Sports

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/sports
Description Returns the list of sports which have live or upcoming programs for this site.
Results (JSON)
[
    {
        "sportId": 11,
        "name": "Lacrosse",
        "leagueCount": 2,
        "leaguesUrlHtml": "//api.leagueapps.com//leagues/lacrosse"
    }
]

Announcements

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/announcements
Description Returns a reverse chronological list of posted site announcements
Results (JSON)
[
    {
        "announcementId": 401049,
        "userId": 2,
        "username": "steve",
        "userFirstName": "Steve",
        "userLastName": "McQueen",
        "admin": true,
        "createdTime": 1435251085000,
        "message": "Just a reminder to everyone that there are just 2 days until tryouts!",
        "userUrlHtml": "//api.leagueapps.com//members/steve",
        "userIconUrl": "https://svite-league-apps-img.s3.amazonaws.com/profile-0-s1.jpg"
    },
    {
        "announcementId": 401048,
        "userId": 2,
        "username": "steve",
        "userFirstName": "Steve",
        "userLastName": "McQueen",
        "admin": true,
        "createdTime": 1435251060000,
        "message": "Lacrosse tryouts are coming up in 2 weeks.  Registerbefore spots fill up!",
        "userUrlHtml": "//api.leagueapps.com//members/steve",
        "userIconUrl": "https://svite-league-apps-img.s3.amazonaws.com/profile-0-s1.jpg"
    }
]

Programs – Current List

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/programs/current
Description Returns a list of all programs which are have a state of either LIVE or UPCOMING. For each program, the several relevant details are included.
Results (JSON)
[
    {
        "programId": 59621,
        "name": "Intermediate Lacrosse Program 1",
        "state": "UPCOMING",
        "type": "LEAGUE",
        "description": "",
        "startTime": 1496289600000,
        "tentativeStartTime": false,
        "publicRegstrationTime": 1433131200000,
        "gender": "CO_ED",
        "mode": "MIXED",
        "sponsor": "Under Armour",
        "freeAgentLabel": "Free Agent",
        "teamLabel": "Team",
        "captainLabel": "Captain",
        "divisionLabel": "Division",
        "processingFeeLabel": "Processing Fee",
        "additionalTeamFeeLabel": "Additional Team Fee",
        "sportId": 11,
        "sport": "Lacrosse",
        "season": "Summer",
        "experienceLevel": "Intermediate",
        "leagueFormat": "",
        "feeRequired": true,
        "regularRegistrationTime": 1433131200000,
        "teamIndividualFee": 100,
        "freeAgentFee": 100,
        "chargeProcessingFee": false,
        "usingVariableTeamFee": true,
        "chargeMembershipFee": false,
        "hasPaymentPlans": false,
        "ageLimitEffectiveDate": 1496289600000,
        "hasWaitlist": true,
        "programUrlHtml": "//api.leagueapps.com//leagues/lacrosse/59621-intermediate-lacrosse-program-1",
        "registerUrlHtml": "//api.leagueapps.com//registration/init?bid=59621",
        "scheduleUrlHtml": "//api.leagueapps.com//leagues/59621/schedule",
        "standingsUrlHtml": "//api.leagueapps.com//leagues/59621/standings",
        "programLogo150": "//svite-league-apps-img.s3.amazonaws.com/program-54787-s3.jpg"
    }
]

Programs – Individual Program Detail

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/programs/{PROGRAM-ID}
Description Returns the full details and description for one particular program, based on {PROGRAM_ID}.
Results (JSON)
[
  {
      "programId": 59621,
      "name": "Intermediate Lacrosse Program 1",
      "state": "UPCOMING",
      "type": "LEAGUE",
      "description": "",
      "startTime": 1496289600000,
      "tentativeStartTime": false,
      "publicRegstrationTime": 1433131200000,
      "gender": "CO_ED",
      "mode": "MIXED",
      "sponsor": "Under Armour",
      "freeAgentLabel": "Free Agent",
      "teamLabel": "Team",
      "captainLabel": "Captain",
      "divisionLabel": "Division",
      "processingFeeLabel": "Processing Fee",
      "additionalTeamFeeLabel": "Additional Team Fee",
      "sportId": 11,
      "sport": "Lacrosse",
      "season": "Summer",
      "experienceLevel": "Intermediate",
      "leagueFormat": "",
      "feeRequired": true,
      "regularRegistrationTime": 1433131200000,
      "teamIndividualFee": 100,
      "freeAgentFee": 100,
      "chargeProcessingFee": false,
      "usingVariableTeamFee": true,
      "chargeMembershipFee": false,
      "hasPaymentPlans": false,
      "ageLimitEffectiveDate": 1496289600000,
      "hasWaitlist": true,
      "programUrlHtml": "//api.leagueapps.com//leagues/lacrosse/59621-intermediate-lacrosse-program-1",
      "registerUrlHtml": "//api.leagueapps.com//registration/init?bid=59621",
      "scheduleUrlHtml": "//api.leagueapps.com//leagues/59621/schedule",
      "standingsUrlHtml": "//api.leagueapps.com//leagues/59621/standings",
      "programLogo150": "//svite-league-apps-img.s3.amazonaws.com/program-54787-s3.jpg"
  }
]  

Program Schedule

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/programs/{PROGRAM-ID}/schedule
Description Returns the full schedule for a given program, as specified by {PROGRAM_ID}. The results include both games (with their corresponding details) as well as “date notes”.
Results (JSON)
"games": [
    {
      "scheduleItemType": "EVENT",
      "eventId": 334398,
      "teamId": 1075848,
      "teamName": "U14 Blizards",
      "type": "Practice",
      "title": "Tuesday Practive",
      "startDate": 1511301600000,
      "endDate": 1511307000000,
      "description": "Strength and Conditioning Practice",
      "location": "Downtown Ice Rink",
      "locationLabel": "",
      "allowEdit": false
    },
    {
      "scheduleItemType": "EVENT",
      "eventId": 334401,
      "teamId": 1075848,
      "teamName": "U14 Blizards",
      "type": "Practice",
      "title": "Tuesday Practive",
      "startDate": 1511906400000,
      "endDate": 1511911800000,
      "description": "Strength and Conditioning Practice",
      "location": "Downtown Ice Rink",
      "locationLabel": "",
      "allowEdit": false
    },
    {
      "scheduleItemType": "STRUCTURED_GAME",
      "gameId": 4626927,
      "type": "SCHEDULED",
      "typeLabel": "Regular Season",
      "state": "SCHEDULED",
      "stateLabel": "Scheduled",
      "startTime": 1512838800000,
      "team1Id": 1075848,
      "team1": "U14 Blizards",
      "team1Seed": null,
      "team1Score": null,
      "team1Result": null,
      "team2Id": 305051,
      "team2": "Hurricanes",
      "team2Seed": null,
      "team2Score": null,
      "team2Result": null,
      "locationId": 10649,
      "locationName": "Downtown Ice Rink",
      "subLocationId": null,
      "subLocationName": null,
      "latitude": null,
      "longitude": null,
      "round": null,
      "notes": null
    },
    {
      "scheduleItemType": "STRUCTURED_GAME",
      "gameId": 4626930,
      "type": "SCHEDULED",
      "typeLabel": "Regular Season",
      "state": "SCHEDULED",
      "stateLabel": "Scheduled",
      "startTime": 1513443600000,
      "team1Id": 1075848,
      "team1": "U14 Blizards",
      "team1Seed": null,
      "team1Score": null,
      "team1Result": null,
      "team2Id": 305052,
      "team2": "Thunder",
      "team2Seed": null,
      "team2Score": null,
      "team2Result": null,
      "locationId": 10649,"locationName": "Downtown Ice Rink",
      "subLocationId": null,
      "subLocationName": null,
      "latitude": null,
      "longitude": null,
      "round": null,
      "notes": null
    }
  ],
  "notes": [

{
              "noteId": 22023,
              "startTime": 1437192000000,
              "color": "date-note-type0",
              "message": "This is a \"date note\" on the schedule"
          }

  ]
}

Program Teams

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/programs/{PROGRAM-ID}/teams
Description Returns a list of teams for a given program, as specified by {PROGRAM_ID}.
Results (JSON)
[{
    "teamName": "Wildcats",
    "teamId": 20939,
    "division": "Legends",
    "teamStatus": "COMPLETE",
    "teamProfileURL": "//api.leagueapps.com//leagues/1337/teams/311244",
    "dateCreated": 1447839864000
}, {
    "teamName": "Pumas",
    "teamId": 20938,
    "division": "Leaders",
    "teamStatus": "COMPLETE",
    "teamProfileURL": "//api.leagueapps.com//leagues/1337/teams/311245",
    "dateCreated": 1447839872000
}]

Locations – List

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/locations
Description Returns a list of locations for a given site, with pertinent info on each.
Results (JSON)
[
  {
    "locationId": 10649,
    "name": "Downtown Field House",
    "description": "Description goes here!",
    "address1": "1400 Key Blvd",
    "address2": "",
    "city": "Arlington ",
    "state": "Va",
    "zipCode": "22209",
    "country": "",
    "sublocations": [
      {
        "name": "Field 1",
        "description": "Field One"
      },
      {
        "name": "Field 2",
        "description": "Field Two"
      }
    ]
  },
  {
    "locationId": 10650,
    "name": "Uptown Field House",
    "description": "<html />",
    "address1": "2500 Wilson Blvd",
    "address2": "",
    "city": "Arlington",
    "state": "Va",
    "zipCode": "22201",
    "country": null,
    "sublocations": []
  }
]

Locations – Individual Location Detail

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/locations/{LOCATION-ID}
Description Returns full detail for a single location.
Results (JSON)
[
  {
    "locationId": 10649,
    "name": "Downtown Ice Rink",
    "description": "Description goes here!",
    "address1": "1400 Key Blvd",
    "address2": "",
    "city": "Arlington ",
    "state": "Va",
    "zipCode": "22209",
    "country": "",
    "sublocations": [
      {
        "name": "Field 1",
        "description": "Field One"
      },
      {
        "name": "Field 2",
        "description": "Field Two"
      }
    ]
  }
]

Blog – List of Posts

End Point https://public.leagueapps.io/v1/sites/{SITE-ID}/blog
Description Returns a reverse chronological list of blog posts.
Results (JSON)
 {
    "blogId": 230343,
    "title": "Second Blog",
    "summary": "This is a mini description",
    "urlHtml": "//youth-baseball.leagueapps.com/blog/second",
    "createdOn": 1488580523000,
    "lastUpdated": 1488580523000,
    "featured": true,
    "imageUrl": "https://svite-league-apps-img.s3.amazonaws.com/page-a284dce1-b9a9-4fce-9b79-4a62b573e67f-s2.jpg",
    "halfImageUrl": "https://svite-league-apps-img.s3.amazonaws.com/page-a284dce1-b9a9-4fce-9b79-4a62b573e67f-s1.jpg"
  },
  {
    "blogId": 230340,
    "title": "First Blog",
    "summary": "This is a summary that shows up",
    "urlHtml": "//youth-baseball.leagueapps.com/blog/first",
    "createdOn": 1488580424000,
    "lastUpdated": 1488580424000,
    "featured": true,
    "imageUrl": "https://svite-league-apps-img.s3.amazonaws.com/page-56157463-96fc-45f8-aeb9-eca325caab82-s2.jpg",
    "halfImageUrl": "https://svite-league-apps-img.s3.amazonaws.com/page-56157463-96fc-45f8-aeb9-eca325caab82-s1.jpg"
  }
]

Back to top