DFLight API

DFlight Developer Resources

When in doubt, check the spec

DFlight API comprises a set of REST API endpoints, organized by the type of information being requested and the chosen method of defining your geographic area of interest. All endpoints accept POST requests only.

URIs are of the form

https://{domain}/{coverage area}/{version}/{infotype}/{query type}

where

  • domain = dflight-api.ljaero.com
  • coverage area = us
  • version = v1
  • infotype is one of: airspace, wx-forecast, restrictions, ssa, venues, obstacles, aerodromes, uoa
  • query type is one of: distance-query, route-query, polygon-query

When you sign up for a DFlight API subscription you will receive an API Key which uniquely identifies you and gives you access to all of the API endpoints. The API Key must be passed in all requests using the x-api-key HTTP header. Also, the  Content-Type must be application/json.

In all cases, the request body must be valid json conforming to the specification for that endpoint. The following json properties are common to all endpoints with given query-type:

distance-query

  • latitude: WGS84 latitude coordinate of your selected point, in decimal degrees
  • longitude: WGS84 longitude coordinate of your selected point, in decimal degrees
  • distance: distance in meters (max allowed value is 25000)
{
  "longitude": -105.416,
  "latitude": 35.753,
  "distance": 5000
}

route-query

{
  "route": {
    "type": "LineString",
    "coordinates": [[-80.14, 25.78], [-80.13, 25.79], [-80.12, 25.81]]
  }
}

polygon-query

{
  "poly": {
    "type": "Polygon",
    "coordinates": [[[-120.87, 35.23], [-120.82, 35.23], [-120.84, 35.21], [-120.87, 35.23]]]
  }
}

For the majority of endpoints, above is all that is needed in your request body. The two types which require additional information are airspace (to specify airspace types) and wx-forecast (to specify forecast elements and hours). See the specification for details and examples.

Successful Requests

The HTTP response code for all successful requests will be 200 (OK), and the response body a json object containing a single element named found. The contents of found will contain a GeoJSON FeatureCollection with one Feature per item found in your requested area of interest. The one exception to this is for airspace requests. In the case of airspace, the found object will contain a list of GeoJSON FeatureCollections, one for each Airspace type requested. See the specification for details and examples for every endpoint.

Request Body Errors

In the event that your request was malformed or contained invalid values, the HTTP response code will be 422 (Unprocessable Entity), and the response body will contain information you need to fix the problem. Here are some examples:

Bad latitude or longitude value:

{
  "detail": 
    [
      {
       "loc": ["body", "longitude"],
       "msg": "-377.39 is not a valid WGS84 longitude value.",
       "type": "value_error"
      }
    ]
}

Distance greater than max allowed:

{
  "detail": 
    [
      {
       "loc": ["body", "distance"],
       "msg": "300000.0 is not a valid distance value. Value must be greater than 0 and less than 25000m.",
       "type": "value_error"
      }
    ]
}

Bad polygon:

{
  "detail": 
    [
      {
       "loc": ["body", "poly"],
       "msg": "The poly value is not a valid GeoJSON Polygon. Each linear ring must contain at least 4 positions",
       "type": "value_error"
      }
    ]
}

Authorization Issues

If you don’t include the x-api-key header, or if the key is invalid, the HTTP response code will be 401 (Unauthorized):

{
    "detail": "Valid x-api-key not provided"
}

Subscription Issues

The following situations will result in an HTTP 402 (Payment Required) response:

  • Exceeding the number of API calls provided in your subscription plan
    {
        "detail": "Subscription request limit exceeded"
    }
  • Subscription automatic monthly renewal failure (card declined or you disputed the charge)
    {
        "detail": "Subscription canceled"
    }

See the FAQ section for more information on subscription management.

Coming Soon

Coming Soon