Innovator Spotlight

Samtrafiken: APIs Providing a Path to Innovation in Public Transportation

"We've realized that APIs are the cheapest and fastest way to build applications. And most importantly, APIs let third parties extend our products and services."

Elias Arnestrand
Innovation Manager


Samtrafiken is a non-profit organization jointly owned by 34 public transport operators and authorities in Sweden. Samtrafiken’s vision is that public transport will be seen as simple, reliable, and convenient and become the number one choice for every journey. Their goal is to bind all of Sweden together by allowing the public to easily travel between destinations using a single ticket for any mode of public transportation.

Elias Arnestrand, Samtrafiken’s Innovation Manager, talked to us about the unique challenges faced in the public transportation industry and how APIs provided a path to innovation.

Please tell us more about Samtrafiken, what is its purpose?

Simply put, we help people taking public transportation plan their journeys. This can be quite complicated when you have to plan several modes of transportation in a single trip using a combination of local, regional, and national carriers. In Sweden, Samtrafiken is the organizational body creating this system where you plan your whole journey from anywhere to anywhere. That’s one of the elements of our mission. The other part of our mission is to sell tickets combining different providers of public transport. Here in Sweden it’s called Resplus. It allows you to book, purchase, and receive one ticket for an entire journey, including transfers. It is quite unique in Europe to have this kind of cooperation across all of these public transport providers in a single ticketing system. Getting everyone to agree to common rules is very tricky. But we’ve figured out how to deal with these complexities.

How did Samtrafiken come to the realization that it needed an API strategy?

Samtrafiken came together with SL (The Public transport authority in Stockholm) and Viktoria Institute (an industrial research institute) to deal with the rapid innovation you see with mobile devices such as the iPhone and Android. We noticed that developers were screen scraping our sites gathering information and timetables to build mobile apps. This was something very new to public transport organizations that traditionally owned this information and kept it as part of their service. These third-party apps turned out to be quite popular with the public. People actually thought that these apps where being provided by the public transport authorities. From this point it became clear that sharing your data and information with third-parties who could deliver good services and innovative apps was the obvious thing to do. 

What were some of the initial challenges you were trying to overcome?

Historically it took us a long time to develop services and when we launched something it was immediately old news with our customers. With the rapid rise of smartphones, we simply could not keep up with the demand from our customers who needed information across these different channels and platforms.

We also had to deal with the rise of third-party apps and gadgets using screen scraping technology. It started to cause serious traffic problems for our sites. For example, there was one poorly programmed gadget-based app that was trying to get data from our systems. When it didn’t get a data response, it kept trying eventually bringing the system down. You would especially see this when there was bad weather and the buses were running late. Customers were overloading the systems trying to get updated information. So we started to shift our thinking from looking at this as a threat to looking at this as an opportunity to engage third parties from the outside to help drive innovative solutions. This was a significant mindshift in the industry and took several years to fully realize. The idea of losing control was unsettling. So it’s a big success story that we shifted to open APIs.

Tell us more about your API strategy.

We started this project around 2009 and created Trafiklab. It was formulated as an initiative for the industry to start to work with open data and open APIs. We wanted to make it simple to access this data and even make it fun for our industry and third party developers to discuss these issues. It was important for us to keep this industry initiative all together on one site instead of each public transport entity creating their own channel, data sources, set of agreements, and different types of APIs. This would have created a huge burden on third parties that wanted to access the complete set of public transportation data and services in Sweden.

We did our research and looked at the external drivers that motivate developers. What we saw was that developers were driven by finding challenge, the satisfaction of getting their app to work, and the ability to showcase their work to the greater public. These were the drivers that we focused on to help get this initiative successfully off the ground.

Today, our open APIs are a very important part of our strategy in providing customers with relevant public transport information and services. For example, for public transportation in Stockholm, more than 50% of the requests come from services created by third parties. Apigee is our API gateway for most of these services.

How are you using Apigee today?

Apigee was fundamental in the development of Trafiklab as it was essential in helping us open our APIs across all of our public transportation operators and authorities. We use Apigee in a hosted environment and it manages all of our API keys. All of our API requests go through Apigee and it does its magic and protects our back-end systems from bad requests and traffic spikes. So caching and rate limits are very important.

What benefits have you seen from your API program?

We have made a big impact in the community of open APIs and open data with developers. It’s a big step that our industry is moving forward with openness and that other parties are using our data in a good way.

Last fall we held a “travel hack” in Gothenburgh organized by Viktoria Insitute. It was a 24 hour innovation jam. We had about 100 developers broken into 20 development teams developing some amazing prototypes. One cool service that came out of this was an app that allowed you to search for a new apartment and enter your work location where you could see the time it takes to commute to your job utilizing public transportation. It’s fascinating because what looks close on a map could actually be a long commute, yet longer distance work locations could actually take much less time on public transport. We’ve also seen apps that deliver “gamification” of public transport where the more you utilize public transportation services, the more points you are rewarded and shared with your social network.

Fortunately, we’ve been recognized for our efforts and innovation. We received the 2012 European Public Sector Information Trailblazer award for Trafiklab, our open API initiative for developers. Trafiklab has also been awarded the Golden Link Award 2012 by the Swedish Association of Local Authorities and Regions (SALAR). Trafiklab also won the Good Intentions Award from the Swedish Public Transport Association and the Golden Mobile for public sector services in late 2011.

What is your vision for your API program?

I would say that we just started this project but there are numerous data sources that still need to be connected to the external world. It’s hard work but we need to keep opening up the data sets across the public transportation industry. For example, we still sometimes face long and challenging discussions about whether the industry should be charging for information or making it availble for free.. Another dimension that we are dealing with is sale of tickets through third party providers. Transactional related APIs are the natural next step in this program.

APIs are a marketing and distribution channel for our public transportation information and services. We’ve realized that APIs are the cheapest and fastest way to build applications. And most importantly, APIs let third parties extend our products and services.