TeamSnap Logo
Log inFind My Team
  • Solutions
    • For Business
      For Business

      Tools for clubs, leagues, tournament organizers, and associations to run their business

      For Teams
      For Teams

      For coaches, players & fans to stay connected on our top-rated mobile app

      Promo image
      • Overview
      • Program ManagementManage all aspects of your organization
      • SponsorshipAccess our network of opportunities
      • RegistrationPayments, dues, and more
      • TournamentsBuild and manage your events
      • PaymentsA better way to manage payments
      • Website BuilderProfessional & mobile friendly sites
      • SchedulingAutomate games & practices
      • Services & SupportIndustry-leading account support
      • MessagesSimple, reliable communication
      • Get started!Chat with our team right now
  • Pricing
  • Resources
    • Community

      Our mission is to enhance the lives of kids by enabling participation in sport

        Other resources
        • Blog
        • Coaches’ Corner
        • For Business Resources
        • TeamSnap Updates
        • Help Center
        Company
        • About
        • Careers
        • Partners
    • For Brands
      • Build relationships in the moments that matter.

        Convert families into superfans with TeamSnap for brands.

          • OverviewThe #1 way to reach the Chief Household Officer
          • AudienceLearn about our audience and network
          • CapabilitiesExplore our products and measurement solutions
          • Download Media Kit

      Find My Team

      Sign upLog in
      Sign upLog in
      • Home
      • Ruby SDK
      • API
      • API Help / Feedback
      • Getting Started
      • API Objects
      • Authorization
      • Collection+JSON
      • Example

      Collection+JSON

      The TeamSnap API is a hypermedia JSON API, using Collection+JSON. There are resources on the web available to describe Collection+JSON (including the official Collection+JSON specification), so this document is only intended as a brief overview, and includes descriptions of TeamSnap API specific Collection+JSON extensions in use in our API.

      Basics

      There are 2 basic principles for Collection+JSON:

      1. The API should be discoverable
      2. The client should not be responsible for constructing URLs

      Discoverable API

      Collection+JSON is designed to be inherently discoverable. Each response is always a collection, and each collection always contains all the pertinent actions performable on objects in that collection.

      Links

      A Collection+JSON client should not construct a URL because the Collection+JSON API makes no guarantee that URLs will remain static for the same actions on the API.

      The API guarantees that the rel will remain static (unless there is a major version revision), but the href is subject to change. You should always use the rel to determine what href to follow.

      {
        "href": "https://apiv3.teamsnap.com/members/search?user_id=695269",
        "rel": "members"
      }
      

      In the example above, you can see that there are 2 components per link: the rel and the href. In this example, you would find this particular link via the rel members, and then navigate to the href provided: https://apiv3.teamsnap.com/members/search?user_id=695269.

      It is sometimes helpful to think of Collection+JSON as a machine-optimized webpage. When you browse the internet, you generally do not construct your own URLs to a page of interest; instead, you click on existing links provided by the website author to navigate the website hierarchy as the website author intended.

      REST

      Collection+JSON is a RESTful specification. All interactions against the API follow this pattern:

      Action Verb
      create POST Make a POST request against the href provided in the collection to create an object, using the template specified parameters. Do not include any parameters that are not being set.
      read GET
      update PATCH Make a PATCH request against the href provided for the specific object, using the template specified parameters. Do not include any parameters that are not being updated.
      destroy DELETE Make a DELETE request against the href provided for the specific object

      Response

      There are multiple components in a Collection+JSON response body.

      Items

      Items are the meat of a Collection+JSON response. The items key in the collection body will contain an array of multiple JSON objects, and each object will contain data and a href, and can contain any of the other Collection+JSON components described later.

      "items": [
        {
        "data": [ "..." ],
        "href": "https://apiv3.teamsnap.com/users/695269",
        "links": [ "..." ]
        }
      ]
      

      In the example above, the items key contains a solitary object, which itself contains data, a href, and links. Data is always specified in key value pairs as follows:

      "data": [
        {
          "name": "id",
          "value": 695269
        },
      ]
      

      Each data object will contain a name and value, and can optionally contain a type. The name key represents the key of the key-value pair, while the value key represents the value of the key-value pair.

      If a type is present, it will represent the data type of the key-value pair:

      {
        "name": "updated_at",
        "type": "DateTime",
        "value": "2014-10-01T09:19:36.000+00:00"
      }
      

      In the above example, the type is DateTime and indicates that the value is a DateTime (encoded in ISO 8601 Format).

      Links

      Links, as described above, indicate related objects that will be of interest. Links can be present in both the items in a collection, and on the collection itself.

      "links": [
        {
          "href": "https://apiv3.teamsnap.com/teams/search?user_id=695269",
          "rel": "teams"
        }
      ]
      

      In the example above, the links array only contains one object. For links, the rel is the key and the href is the value of the key-value pair. Since the hrefs are subject to change at any time, it is unwise to construct your own URLs!

      Queries

      Queries are similar to links, in that they represent potential objects of interest. However, a query will require some construction (which is explicitly defined by the query object).

      A query will contain a data array, an href, and a rel. As with links, you should rely on the rel to locate the specific query you are looking for.

      "queries": [
        {
          "data": [
            {
              "name": "id",
              "value": null
            }
          ],
          "href": "https://apiv3.teamsnap.com/users/search",
          "rel": "search"
        }
      ]
      

      In the example above, the queries array contains a single query object. To construct this URL, you must take the href parameter, and then add the data parameters as URL parameters.

      If we wanted to query for the user with the id of 40, you would hit the following endpoint:

        OAUTH_ACCESS_TOKEN=your_oauth_access_token_here
        curl -H "Authorization: Bearer $OAUTH_ACCESS_TOKEN" -X GET https://apiv3.teamsnap.com/users/search -d 'id=40'
      

      If you are not using cURL, you will need to URL encode the parameters:

        GET https://apiv3.teamsnap.com/users/search?id=40
      

      As with links, under no circumstances should you modify the href itself or rely on the href to remain static as it is subject to change at any time.

      Template

      A template is a recipe for updating or creating an object via the API. Each template will contain a data array, which will contain acceptable data to POST or PATCH against the collection or object hrefs.

      "template": {
        "data": [
          {
            "name": "first_name",
            "value": null
          }
        ]
      }
      

      In the template above, it contains a single datum. The client should use this datum to construct POST or PATCH form or multipart body encoded parameters.

      Given the following (truncated) collection:

      {
        "collection": {
          "href": "https://apiv3.teamsnap.com/users",
          "items": [
            {
              "data": [
                {
                  "name": "first_name",
                  "value": "Charles"
                }
              ],
              "href": "https://apiv3.teamsnap.com/users/695269"
            }
          ],
          "template": {
            "data": [
              {
                "name": "first_name",
                "value": null
              }
            ]
          }
        }
      }
      

      If you wanted to create a new user, you would POST against the href specified in line 3:

        OAUTH_ACCESS_TOKEN=your_oauth_access_token_here
        HREF_OF_COLLECTION=https://apiv3.teamsnap.com/users
        # NOTE: The above href should be obtained from the response and not constructed manually.
        curl -H "Authorization: Bearer $OAUTH_ACCESS_TOKEN" -X POST $HREF_OF_COLLECTION -d 'first_name=Bob'
      

      and you will receive a response similar to the following:

      {
        "collection": {
          "href": "https://apiv3.teamsnap.com/users",
          "items": [
            {
              "data": [
                {
                  "name": "first_name",
                  "value": "Bob"
                }
              ],
              "href": "https://apiv3.teamsnap.com/users/1234567"
            }
          ],
          "template": {
            "data": [
              {
                "name": "first_name",
                "value": null
              }
            ]
          }
        }
      }
      

      If you wanted to modify the user instead, you would PATCH against the href specified in the object itself (on line 12):

        OAUTH_ACCESS_TOKEN=your_oauth_access_token_here
        HREF_OF_OBJECT=https://apiv3.teamsnap.com/users/695269
        # NOTE: The above href should be obtained from the response and not constructed manually
        curl -H "Authorization: Bearer $OAUTH_ACCESS_TOKEN" -X PATCH $HREF_OF_OBJECT -d 'first_name=Robert'
      

      and you would receive a response similar to the following:

      {
        "collection": {
          "href": "https://apiv3.teamsnap.com/users",
          "items": [
            {
              "data": [
                {
                  "name": "first_name",
                  "value": "Robert"
                }
              ],
              "href": "https://apiv3.teamsnap.com/users/1234567"
            }
          ],
          "template": {
            "data": [
              {
                "name": "first_name",
                "value": null
              }
            ]
          }
        }
      }
      

      Extensions

      The Collection+JSON spec supports the addition of extensions. These are the extensions in use for TeamSnap's API:

      Command Templates

      The Command Templates extension allows the discovery of commands in the Collection+JSON response. These commands are generally actions that don't fit cleanly in the normal RESTful responses, such as disabling a user or inviting a new team member.

      {
        "commands": [
          {
            "href": "/users/disable",
            "rel": "disable",
            "name": "Disable",
            "prompt": "Disable user",
            "data": [{ "name": "id", "value": "", "prompt": "User id to disable" }]
          }
        ]
      }
      

      Type

      The Type extension allows the specification of a type for any data attribute in the Collection+JSON response.

      {
        "name": "updated_at",
        "type": "DateTime",
        "value": "2014-10-01T09:19:36.000+00:00"
      }
      

      Deprecated

      The Deprecated extension allows for an OPTIONAL deprecated property on items within the data array to indicate that the item is being removed. The value of the property SHOULD be a boolean value of true or false.

      data: [
        {
          "name": "old_name",
          "value": "Robert Tables",
          "prompt": "'old_name' is deprecated and will be removed in a future version, use 'new_name' instead."
          "deprecated": true
        },{
          "name": "new_name",
          "value": "Robert Tables",
          "prompt": "Name"
        }
      ]
      

      Read-only

      The Read-only extension informs the client that some collection items are read-only, while still allowing others to be updated and also new items to be created.

      { "collection":
        {
          "version":"1.0",
          "href":"http://example.org/issues/",
          "items":[
             {
                "href":"http://example.org/issues/1",
                "read-only":true,
                "data":[
                   { "name":"title", "value":"some non-updatable issue"}
                ]
             },
             {
                "href":"http://example.org/issues/2",
                "read-only":false,
                "data":[
                   { "name":"title", "value":"some updatable issue"}
                ]
             },
             {
                "href":"http://example.org/issues/3",
                "data":[
                   { "name":"title", "value":"some other updatable issue"}
                ]
             }
          ],
          "template": {(...)}
        }
      }
      

      Example

      The following is an example of a full Collection+JSON response.

      {
        "collection": {
          "href": "https://apiv3.teamsnap.com/users",
          "items": [
            {
              "data": [
                {
                  "name": "id",
                  "value": 695269
                },
                {
                  "name": "type",
                  "value": "user"
                },
                {
                  "name": "first_name",
                  "value": "Angus"
                },
                {
                  "name": "last_name",
                  "value": "McGillicuddy"
                },
                {
                  "name": "email",
                  "value": "angus.mcgillicudy@example.com"
                },
                {
                  "name": "is_admin",
                  "value": false
                },
                {
                  "name": "facebook_id",
                  "value": null
                },
                {
                  "name": "facebook_access_token",
                  "value": null
                },
                {
                  "name": "receives_newsletter",
                  "value": false
                },
                {
                  "name": "birthday",
                  "value": "1987-05-01"
                },
                {
                  "name": "updated_at",
                  "type": "DateTime",
                  "value": "2014-10-01T09:19:36.000+00:00"
                },
                {
                  "name": "created_at",
                  "type": "DateTime",
                  "value": "2012-11-12T17:05:51.000+00:00"
                }
              ],
              "href": "https://apiv3.teamsnap.com/users/695269",
              "links": [
                {
                  "href": "https://apiv3.teamsnap.com/apn_devices/search?user_id=695269",
                  "rel": "apn_devices"
                },
                {
                  "href": "https://apiv3.teamsnap.com/gcm_devices/search?user_id=695269",
                  "rel": "gcm_devices"
                },
                {
                  "href": "https://apiv3.teamsnap.com/members/search?user_id=695269",
                  "rel": "members"
                },
                {
                  "href": "https://apiv3.teamsnap.com/teams/search?user_id=695269",
                  "rel": "teams"
                }
              ]
            }
          ],
          "links": [
            {
              "href": "https://apiv3.teamsnap.com/apn_devices",
              "rel": "apn_devices"
            },
            {
              "href": "https://apiv3.teamsnap.com/gcm_devices",
              "rel": "gcm_devices"
            },
            {
              "href": "https://apiv3.teamsnap.com/members",
              "rel": "members"
            },
            {
              "href": "https://apiv3.teamsnap.com/teams",
              "rel": "teams"
            },
            {
              "href": "https://apiv3.teamsnap.com/",
              "rel": "root"
            },
            {
              "href": "https://apiv3.teamsnap.com/me",
              "rel": "self"
            }
          ],
          "queries": [
            {
              "data": [
                {
                  "name": "id",
                  "value": null
                }
              ],
              "href": "https://apiv3.teamsnap.com/users/search",
              "rel": "search"
            }
          ],
          "template": {
            "data": [
              {
                "name": "first_name",
                "value": null
              },
              {
                "name": "last_name",
                "value": null
              },
              {
                "name": "password",
                "value": null
              },
              {
                "name": "birthday",
                "value": null
              },
              {
                "name": "email",
                "value": null
              },
              {
                "name": "facebook_id",
                "value": null
              },
              {
                "name": "facebook_access_token",
                "value": null
              }
            ]
          },
          "version": "3.12.0"
        }
      }
      

      API Questions?
      Contact api@teamsnap.com

      Table of Contents
      • Basics
        • Discoverable API
        • Links
      • REST
      • Response
        • Items
        • Links
        • Queries
        • Template
      • Extensions
        • Command Templates
        • Type
        • Deprecated
        • Read-only
      API Status:

      loading
      Weekly API Changelog
      Want to be notified about changes in the TeamSnap API?
      Sign up here to receive our weekly changelog newsletter
      Products
      Sports Organizations
      • Get a demo
      • Features
      • Pricing
      • Tournaments
      • FAQs
      Coaches or Team Managers
      • Features
      • Pricing
      • Tournaments
      • Get Started
      Parents or Athletes
      • Features
      • Pricing
      • Find My Team
      • Get Started
      Sports
      Sports Organizations
      • Baseball
      • Basketball
      • Football
      • Ice Hockey
      • Lacrosse
      • Soccer
      • Softball
      • Volleyball
      Teams
      • Baseball
      • Basketball
      • Football
      • Ice Hockey
      • Soccer
      • Softball
      • +100s more
      Resources
      • Blog
      • Coaches’ Corner
      • Return To Play
      • For Business Resource Library
      • Skills & Drills
      • Press Releases
      • TeamSnap Updates
      • TeamSnap Help Center
      • Community
      • Why TeamSnap?
      Company
      • About
      • CareersHiring!
      • For Brands
      • Partners
      • TeamSnap API
      • Responsible Disclosure Policy
      • Youth sports team and sports org app Apple App Store Logo
      • Youth sports team and sports org app Google Play Store Logo
      • social-media-facebook
      • social-media-twitter
      • social-pinterest
      • social-instagram
      • social-video-youtube
      • professional-network-linkedin
      • social-tiktok

      TeamSnap Footer Logo

      Copyright © 2005–2025 TeamSnap, Inc.

      • Sitemap
      • Terms
      • Privacy Policy
      • California Privacy Policy
      • Your Privacy Choices