DEV Community

Cover image for How I got amazing boarding passes with JS.
Christopher
Christopher

Posted on

How I got amazing boarding passes with JS.

Back Story

A group of friends an I were taking a trip to Florida for a week and we needed to check in for our flights which is never fun. We're taking Southwest Airlines which for those of you that may not know, they do not have assigned seating. The seating is on a first come first serve basis which makes your boarding pass/position very important.

We had a 6:05am flight so we needed to check in at 6:05am the day before. One of my friends joked "Couldn't you make a bot for this?", most of my experience is with bots and automation so this was a clever joke which i took very serious.

The Process

Taking a look at the check in page, there is a simple form which requires your Confirmation Number, First Name, and Last Name.

Check in Form

I entered my information and watched the requests in my dev tools...

After clicking Check In i see a POST request to their API to the url https://www.southwest.com/api/air-checkin/v1/air-checkin/page/air/check-in/review and got an error response that my check in window has not started yet.

This was enough information to assume that the check in process is a single request. I viewed the request body and the format was very simple JSON.

{
  "confirmationNumber": "A1B2C3",
  "passengerFirstName": "John",
  "passengerLastName": "Doe",
  "application": "air-check-in",
  "site": "southwest"
}
Enter fullscreen mode Exit fullscreen mode

I copied the url and post data into Insomnia to test the request outside of the browser to see if there were any Anti-Bot or user specific cookies that would prevent me from simply spamming requests to check in.

Insomnia SS

I got a different response error in Insomnia... I looked back at my dev tools and took a look at the request headers they send, I noticed the header X-API-Key, copying the header and the key from the requests into Insomnia. We got the outside of check in window error! Now i know that there's no other headers or cookies needed to make the request which meant I could keep sending the request.

I then used that bot the next day and secured very good boarding passes for my girlfriend and I.

Success

If you would like to check the bot out and/or use it for yourself it's open sourced here on my github. Take me to the repo

GitHub logo olduser221 / southwestBot

Auto check in bot for Southwest Airlines.

Top comments (1)

Collapse
 
codeworldindustries profile image
CodeWorldIndustries

They cracked down on this - It doesn't work anymore. I see something about "rogue api" :(