Turkish Airlines (SXM) Routes API
Finding Turkish Airlines routes requires more than searching for the code in the title: Turkish Airlines uses the IATA airline code TK, while SXM identifies Princess Juliana International Airport in Sint Maarten. This guide shows how to use FlightLabs schedule data to identify Turkish Airlines flights and build route views without treating an airport code as an airline code.
Turkish Airlines is based in Türkiye, with its main hub at Istanbul Airport. For a route view involving SXM, keep the airport filter separate from the airline identifier and verify that the returned records actually match both.
Choose the right data for a route view
FlightLabs exposes schedule, real-time tracking and route-reference capabilities. The documented schedule endpoint is https://api.goflightlabs.com/flights-schedules, with iataCode and type parameters. Before making a request, check the Documentation for API-key authentication, supported parameter values and pagination behavior.
A schedule record can provide an airline, departure airport, arrival airport and scheduled times. Those fields are useful for constructing an observed route list, but a schedule-derived list is not necessarily a complete catalogue of every route an airline operates. Use the route-reference documentation when you need to establish the coverage and filtering rules of the routes product itself.
In particular, do not assume that setting iataCode to SXM is equivalent to filtering by Turkish Airlines. Inspect airline.iata in each returned schedule and retain TK only when the task is specifically about Turkish Airlines. Likewise, confirm the meaning of type before using it to select a schedule view.
Read the schedule response
The supplied schedule response structure has a top-level success value and a data.schedules array. Each schedule can contain flight_number, airline, departure and arrival. The airport values in the departure and arrival objects identify the endpoints of the scheduled flight.
The following Python function processes an already-decoded response. It keeps Turkish Airlines records involving SXM and returns the fields needed for a simple route display. It does not make an API request; configure authentication and request parameters using the documentation before passing the response to it.
def turkish_airlines_sxm_schedules(payload):
if not payload.get("success"):
raise ValueError("Schedule request was not successful")
schedules = payload.get("data", {}).get("schedules", [])
matches = []
for schedule in schedules:
airline = schedule.get("airline") or {}
departure = schedule.get("departure") or {}
arrival = schedule.get("arrival") or {}
if airline.get("iata") != "TK":
continue
if "SXM" not in (departure.get("airport"), arrival.get("airport")):
continue
matches.append(
dict(
flight_number=schedule.get("flight_number"),
departure_airport=departure.get("airport"),
departure_scheduled=departure.get("scheduled"),
departure_terminal=departure.get("terminal"),
arrival_airport=arrival.get("airport"),
arrival_scheduled=arrival.get("scheduled"),
arrival_terminal=arrival.get("terminal"),
)
)
return matches
The function returns an empty list when no matching records are present in the supplied response. That result alone does not establish that Turkish Airlines has no SXM service: it may reflect the request’s scope, the period covered or an incomplete set of pages.
For a route summary, group the retained records by departure and arrival airport. Preserve the direction of travel: a departure from SXM and an arrival at SXM are distinct scheduled movements. Keep the underlying flight records available so a reader can trace each summary back to its scheduled times.
Handle times and live changes
The example schedule timestamps use ISO 8601 strings ending in Z, indicating UTC. Store or compare those instants in UTC, then convert them to the relevant airport’s local time for display. Include the time zone in the interface so that a departure time is not mistaken for the viewer’s local time.
Schedules and live tracking serve different purposes. Scheduled departure and arrival times describe the plan; the real-time response example includes flight.status, departure actual and arrival estimated fields. A status page should label each time by its meaning rather than replacing a scheduled time with an estimate without explanation.
The live example also includes terminal and gate fields under departure and arrival. Treat them as changeable operational information, and display a clear unavailable state when a value is absent. The schedule example includes terminals, but it should not be assumed to provide every live gate update.
A delay can be represented to users by comparing a scheduled time with an actual or estimated time when both are available. Distinguish an estimate from a completed event, and avoid calculating a delay from a missing timestamp. Check the relevant product documentation before relying on a dedicated delay field or prediction.
Make polling and pagination predictable
Cache schedule results for route browsing and refresh live information more frequently for an active flight-status screen. Choose the polling interval based on how quickly the display must react, the age of cached data users can tolerate and the limits applicable to your account. Show when the displayed information was last refreshed rather than implying that a cached result is live.
When several users request the same flight or airport view, share a cached result instead of issuing a separate upstream request for each page load. Refresh in the background where appropriate, and retain the last successful result with an explicit stale-data indication if an update fails.
For schedules, follow the pagination mechanism described for the endpoint and collect all relevant pages before producing route counts. Do not assume that the first response contains every matching flight. If retrieval stops partway through, mark the route view as incomplete rather than presenting partial results as a complete network.
Handle a reported cancellation or diversion as an operational exception. Do not infer either solely from a missing gate, a missing actual time or an unchanged estimate. Check the applicable live-data documentation for status values and diversion details, then make the distinction visible to users when the API provides it.
Three practical uses
SXM flight-status display
Start with schedules whose airline.iata is TK and whose departure or arrival airport is SXM. Show the flight number, scheduled time and terminal from the schedule, then add live status, estimated or actual times, and gate information when the corresponding tracking data is available. Keep missing live fields separate from a confirmed status.
Delay monitoring
For a matched flight, compare the scheduled time with the relevant actual or estimated time in the live response. A monitoring screen can surface a change while retaining the scheduled time for context. Make clear whether the comparison uses an estimate or an actual event, and avoid treating an estimate as a final outcome.
Route analysis
Use departure.airport and arrival.airport to group the returned Turkish Airlines schedules by directional airport pair. Retain the request scope and collection completeness alongside the results: a count of schedule records is a count within that retrieved dataset, not a claim about the airline’s full network or operating frequency.
FAQ
Is SXM the IATA code for Turkish Airlines?
No. Turkish Airlines uses TK; SXM is the airport code for Princess Juliana International Airport. Use each code for its respective entity.
Can a schedule tell me whether a flight is cancelled?
The schedule example focuses on planned times and terminals. Use the appropriate live-status data and its documented status values to report operational changes.
How should I handle codeshares?
The supplied schedule fields identify an airline, but they do not establish a codeshare relationship. Check the relevant documentation before deciding whether a record represents a marketing or operating carrier, and avoid merging flights on that basis without supporting data.
What if an airport or gate is missing?
Keep the record if it is otherwise useful, display the missing value as unavailable and avoid inferring it from another flight. Refresh operational fields according to the needs of the display.
To start building, Register for an API key. You can also explore the MCP interface for working with FlightLabs data.