E6B Flight Computer
GET/api/v1/e6b/density-altitude/{icaoCodeOrIdent}Commercial Pilot

Get Density Altitude For Airport

Calculates density altitude for an airport using live METAR data with optional overrides.

Code Examples

curl \
  -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://api.preflightapi.io/api/v1/e6b/density-altitude/KJFK?TemperatureCelsiusOverride=10.0&AltimeterInHgOverride=10.0"

Description

Fetches the airport's latest METAR to obtain temperature and altimeter setting, then computes density altitude using the ISA model. You can optionally override either value via query parameters for "what if" scenarios (e.g., "what would density altitude be if the temperature reached 40°C?").

Response Fields

  • DensityAltitudeFt — the effective altitude the aircraft "feels" based on air density
  • PressureAltitudeFt — field elevation corrected for non-standard pressure
  • IsaTemperatureCelsius — the standard (ISA) temperature expected at this pressure altitude
  • TemperatureDeviationCelsius — how far the actual temperature deviates from ISA (positive = hotter than standard)

*Formula:*DA = PA + 120 * (OAT - ISA_temp). This does not account for humidity, local pressure patterns, or non-standard lapse rates.

Parameters

NameInTypeDescription
icaoCodeOrIdent*pathstringICAO code (e.g., KDFW) or FAA identifier (e.g., DFW)
TemperatureCelsiusOverridequerynumber?Override temperature in Celsius (uses METAR if not provided)
AltimeterInHgOverridequerynumber?Override altimeter setting in inHg (uses METAR if not provided)

Response Schema

200Returns density altitude data for the airportDensityAltitudeResponseDto
airportIdentifierstringnullable

Airport identifier (for airport-based calculations)

fieldElevationFtnumber

Field elevation in feet MSL

pressureAltitudeFtnumber

Pressure altitude in feet

densityAltitudeFtnumber

Density altitude in feet

isaTemperatureCelsiusnumber

Standard (ISA) temperature at this pressure altitude in Celsius

actualTemperatureCelsiusnumber

Actual temperature in Celsius

temperatureDeviationCelsiusnumber

Temperature deviation from ISA in Celsius

altimeterInHgnumber

Altimeter setting used in calculation (inHg)

rawMetarstringnullable

Raw METAR text for reference (for airport-based calculations)

observationTimestringnullable

METAR observation time (for airport-based calculations)

400The METAR is missing temperature or altimeter data and no override was providedApiErrorResponse
codestring

Machine-readable error code (e.g., "AIRCRAFT_NOT_FOUND").

messagestring

Human-readable error message suitable for display.

detailsstringnullable

Additional error details (only included in development environment).

servicestringnullable

Name of the external service that failed (only included for 503 errors).

validationErrorsRecord<string, string[]>nullable

Field-level validation errors (only for validation failures).

timestampstring

UTC timestamp when the error occurred.

traceIdstringnullable

Correlation ID for tracing the request.

pathstringnullable

Request path that generated the error.

404The airport was not found, or no current METAR is availableApiErrorResponse
codestring

Machine-readable error code (e.g., "AIRCRAFT_NOT_FOUND").

messagestring

Human-readable error message suitable for display.

detailsstringnullable

Additional error details (only included in development environment).

servicestringnullable

Name of the external service that failed (only included for 503 errors).

validationErrorsRecord<string, string[]>nullable

Field-level validation errors (only for validation failures).

timestampstring

UTC timestamp when the error occurred.

traceIdstringnullable

Correlation ID for tracing the request.

pathstringnullable

Request path that generated the error.

codestring

Machine-readable error code (e.g., "AIRCRAFT_NOT_FOUND").

messagestring

Human-readable error message suitable for display.

detailsstringnullable

Additional error details (only included in development environment).

servicestringnullable

Name of the external service that failed (only included for 503 errors).

validationErrorsRecord<string, string[]>nullable

Field-level validation errors (only for validation failures).

timestampstring

UTC timestamp when the error occurred.

traceIdstringnullable

Correlation ID for tracing the request.

pathstringnullable

Request path that generated the error.

Search Documentation

Search docs, endpoints, and schemas