An API for my API?7 min read
Last weekend, the kids and I hopped into the car for a long day trip. I drove the car a few hours south to Folkestone, UK. We had our passports examined, and after a short wait, I drove our car onto a train. While we were still inside the car. 30 minutes later, the train stopped in Calais, and we were in France.
The service is called Eurotunnel, and it is an easy way to get your right hand drive car to Europe, and drive on the right side of the road (or left hand drive car to drive on the left side in the UK).
Leaving the Eurotunnel train. Photo by my daughter.
In our case, we literally drove 2 roundabouts, and then took the train back to the UK (its a strange visa thing, probably better that you don’t ask :))
Boy, I’m glad you asked, but I was getting there… really.
When you book a trip on the Eurotunnel, you head over to Eurotunnel.com, and enter your travel dates, and your car’s license plate. They use an API to lookup the make and model of your car – so that they can establish the cost for you to travel. (We have a large van, so we had to go in the oversized car section). See, there. I talked about an API!
You pick your dates, and your departure times – just like choosing a flight (remember when we could book a flight and take a holiday?). You see the price, enter your card number, and you end up on a success page! Hooray, you’re heading to France!
A bit later, you check your email, and you see your confirmation email from Eurotunnel. At the top, it tells you about the times and that you need to get to the terminal 45 minutes before departure….blah blah blah. There’s a section on traveling during Coronavirus – which you might glance at.
If you’re still in the email, but before you get to the “follow Eurotunnel on Twitter” button, there was a section that drew my attention:
Oh – like an Open API Specification – make sure that my API is complete… Then I remember that I am not reading an industry e-mail, I’m reading my travel itinerary to take a train with my car.
“If you do not supply your API before travel” – that seems oddly specific. Again, I bet most people do not have their own API.
“Add an API to your booking”. Is this like a hackathon challenge? Will Eurotunnel refund some of my ticket if I build something cool? Alright – I’m actually going to click that link!!
I land on a webpage that reads like like weird and demented developer clickbait.
Need help populating your API – yes! yes I do! Are you going to provision some awesome API tokens or something?
API just got easier Awesome. Is there like a Zapier integration that I can leverage to connect your API? Will you help me become RESTful?
For developers, API means Application Programming Interface. What Eurotunnel really wanted was:
Advance Passenger Information? Lame.
The above screenshot (with the happy green checkbox) is what it looks like AFTER you add your API. Beforehand, all the text is red, with a pink background, and it warns you that without adding your API, you might not get past the ticket booth, or that the border control might not let you on the train.. Or that they’ll let you on the train, but never let you off…. I don’t remember all of the details, but there were dire consequences.
Needless to say, I provided my API. And it turns out, all they wanted was the information from my passport.
First Name, Surname, Nationality,
Date of Birth,
You know, the stuff we used to fill out on travel booking websites, back when we could travel internationally.
If you’ve ever applied for a job online, you know that you upload your resume, and the website scans all the text and autofills your name, address, email, and all your experience in a long form that you can then submit to a mailbox that nobody monitors.
It’s kind of cool that computers can read your whole resume and then ignore you.
But why can’t airlines (or the Eurotunnel) take a picture of my passport and extract all this standard passport data for me (and my kids)? Why did I fill out an online form for every flight (for for everyone traveling), when just uploading an image could have accomplished exactly the same thing?
Mindee.com has a passport extraction API. There is a tutorial on how to use it on their website (and if you sign up, there is a live demo that you can test for free. Basically, you upload a photo of your passport photo page to their API endpoint, and it will extract all the information you want into a JSON object.
The algorithm also gives you bounding boxes around the location of the information, allowing you to build images like this (this is the live demo on the API page):
This is a fake passport.
You also get a nice form with all of the extracted fields:
Country, passport number and name – all extracted automatically from the image.
Perhaps my family travels more than average, but I have images saved of all of my family member’s passports on my computer. Imagine how easy check-in would be if I could just upload 6 images, and the website could fill in all the passport dates (issue, expiration, birthdate) passport number and name for each traveller.
There would probably be fewer errors for Eurotunnel, and it would be a lot faster and easier for their users.
Then I thought…what if all the airlines did this? Give people an option. “Fill in this form, or upload a picture of your passport” (Kind of sounds like how you might apply for a job on LinkedIn, amirite?) It would make the whole process easier for customers!
ProTip: Ryanair- you could even offer automatic passport upload as an “add-on” (For €1.50 per traveller, would you like to upload your passport rather than enter the values manually?)
Why doesn’t EVERY travel company in the world offer this? It is not a security thing – many passport control gates look at the passport photo and decide if you are automatically allowed into the country or not. This should be a no-brainer for EVERY travel site in the world.
My initial joking about using APIs for passport data entry let me to look for an API that can actually parse passport data automatically. I found Mindee’s and found it very easy to implement. Solutions like this will make check-in process faster, have fewer errors, and easier for customers. I cannot wait to see it in service in 2021, the next time I plan to travel internationally.