The Where to Credit API provides mileage earning calculations for frequent flyer programs around the world.

The API accepts a combination of flights and booking classes and, using our rules engine, returns the number of miles earned for each frequent flyer program in JSON format.

Accessing the API

The API can be accessed with these header values from here:

Content-Type: application/json
Accept: application/json

Authentication (Subscribers only)

Subscribers authenticate to API via the Authorization-Token request header value, which must be added to each API request.

Authorization-Token: {{ your-api-key-here }}

Rate Limits (Free users only)

The API is free for personal and small-scale use with no sign-up required. Clients are allowed at most 12 requests per minute and includes a progressive rate limit structure. Rate limits are calculated per request and includes CORS preflight requests.

If your application requires more than the permitted usage limits, consider starting a Subscription Plan or contact us at [email protected] with a description of your application and an estimated usage requirement.

Attribution (Free users only)

Free users must use the following text on every application screen or web page which displays API results: "Data provided by"

Linking from your application and web pages helps us improve the API.

Request Parameters

The API accepts an array of Itinerary to allow multiple result calculations at once.

optional string
Unique identifier for this itinerary that will be passed back to help correlate a result.
optional string
Two-letter IATA carrier code for the ticketing or plating airline. This is used for revenue programs (i.e. UA, DL, B6). Leaving this value blank will exclude revenue programs.
optional decimal, default is 0
Amount that will be used to calculate revenue program mileage earning. This amount should generally include carrier imposed surcharges but exclude other taxes.
required array of Segment
Every flight transfer or stopover should be considered a separate segment.
required string
Three-letter IATA airport code from which the flight will depart.
required string
Three-letter IATA airport code to which the flight is going.
optional integer
The number of miles for this flight segment. Otherwise, distance is calculated using the great-circle distance between the origin and destination and may not match other data sources exactly.
optional date
The date on the flight will depart from the origin to go to the destination. This is used to determine which earnings chart will be in effect at time of departure.
required string

Two-letter IATA carrier code for the marketing airline. This is used to determine which earnings chart will be applied for this segment.

NOTE: Frequent flyer programs based on operating carrier, including but not limited to Star Alliance carriers, cannot be reliably mapped to a booking class and will not be accurately reflected in this API.
optional string
Two-letter IATA carrier code for the operating airline. This value is only used when earning is based on marketing carrier but restricted to a specific operating carrier. Leaving this value blank will assume the flight is operated by the marketing carrier.
required string
Single-letter booking class used to determine the earning rate for this flight segment.
optional string
The identifier that the airline uses for this flight route. This is most commonly (but not always) a number and is used for earning charts that are restricted to specific flight numbers.

Sample Request Body

    "id" : "abcdxyz",
    "ticketingCarrier" : "DL",
    "baseFareUSD" : 153.10,
    "segments" : [{
        "origin" : "JFK",
        "destination" : "LAX",
        "departure" : "2016-02-04T18:57:00.000Z",
        "carrier" : "DL",
        "operatingCarrier" : "",
        "bookingClass" : "X",
        "flightNumber" : "472"

Response Format

Each API result is wrapped in a standard structure that holds the results of the API call. The array of results for each Itinerary is located in the value of the overall response.

Standard Result Format
Indicates whether the API call was successful.
Error message if the API call was not successful.
Value of the result.
Itinerary Result
Unique identifier provided for this itinerary.
Indicates that this itinerary includes revenue-based miles earnings.
Indicates that this itinerary may be missing miles due to unpublished earning rates from the program.
array of Program Result
Total miles earned for each frequent flyer program.
Program Result
Except for some independent programs, this is generally the two-letter IATA carrier code for the airline operating this frequent flyer program.
Either the airline name or frequent flyer program name for independent programs.
Total miles earned for this frequent flyer program.
array of string
Array of two-letter IATA carrier codes that are associated with this frequent flyer program.

Sample Response

    "success" : true,
    "errorMessage" : null,
    "value" : [{
        "success" : true,
        "errorMessage" : null,
        "value" : {
            "id" : "abcdxyz",
            "revenueBased" : false,
            "unpublished" : false,
            "totals" : [{
                "id": "AFB",
                "name": "Flying Blue",
                "value": 617,
                "airlines": [ "A5", "AF", "KL", "KQ", "RO", "SB", "UX" ]
            }, {
                "id" : "DL",
                "name" : "Delta Air Lines",
                "value" : 766,
                "airlines": [ "DL" ]
            }, {
                "id" : "VS",
                "name" : "Virgin Atlantic",
                "value" : 1235,
                "airlines": [ "VS" ]
            }, {
                "id" : "SV",
                "name" : "Saudi Arabian Airlines",
                "value" : 2470,
                "airlines": [ "SV" ]

HTTP Status Codes

200 - OK The request succeeded. However individual Itinerary results in the request could have failed.
429 - Too Many Requests Usage limits exceeded.
500 - Server Error This shouldn't happen. 😟

Sample Implementation

Mileage Calculator by

This userscript automatically displays the number of frequent flyer miles you can earn with Expedia, Orbitz, Travelocity, Hotwire, Cheaptickets,, Wotif, and SNCF.

View on GitHub Chrome Extension