Getting Started

Get up and running with PreflightAPI in under 5 minutes. By the end of this guide you'll have made your first API call and seen real METAR data come back.

1. Create an Account

Sign up for a free account at preflightapi.com/sign-up. No credit card required. You'll start on the Student Pilot plan, which is free and includes 500 API calls per month — enough to explore every endpoint.

2. Get Your API Key

After signing in, navigate to the API Keys page in your dashboard. Your subscription includes a primary and secondary key — both work identically. Having two keys lets you rotate one without downtime. Copy either key to use in the next step.

Keep your API key secret. Never embed it in client-side code or commit it to a public repository. Use environment variables to store it in your application. See the authentication guide for best practices.

3. Make Your First Request

Include your API key in the Ocp-Apim-Subscription-Key header. Let's fetch the current METAR for JFK International Airport:

curl -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://preflightapi-apim-service-test.azure-api.net/api/v1/metars/KJFK"

A successful response returns the current METAR observation:

{
  "icaoId": "KJFK",
  "reportTime": "2026-01-15T14:56:00Z",
  "rawOb": "KJFK 151456Z 31012KT 10SM FEW250 M04/M18 A3042 RMK AO2 SLP308 T10441183",
  "temp": -4.4,
  "dewp": -18.3,
  "wdir": 310,
  "wspd": 12,
  "wgst": null,
  "visib": 10,
  "altim": 30.42,
  "slp": 1030.8,
  "fltcat": "VFR",
  "clouds": [
    { "cover": "FEW", "base": 25000 }
  ],
  "wxString": null
}

4. Understand the Response

Single-resource endpoints (like fetching a METAR by ICAO code) return the object directly. Collection endpoints that return multiple items use a paginated wrapper:

{
  "data": [
    { "icaoId": "KJFK", "fltcat": "VFR", ... },
    { "icaoId": "KLGA", "fltcat": "MVFR", ... }
  ],
  "pagination": {
    "nextCursor": "eyJpZCI6MTAwfQ==",
    "hasMore": true,
    "limit": 100
  }
}

To fetch the next page, pass the nextCursor value as the cursor query parameter. You can also control page size with the limit parameter (1–500, default 100).

curl -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://preflightapi-apim-service-test.azure-api.net/api/v1/airports/search?state=NY&cursor=eyJpZCI6MTAwfQ==&limit=50"

5. Explore the API

Now that you've made your first request, explore the full range of aviation data available. Here's a suggested learning path:

Weather

  • METARs & TAFs — Start here. Surface observations and terminal forecasts for any US airport.
  • PIREPs — Pilot reports of turbulence, icing, and sky conditions.
  • AIRMETs & SIGMETs — Weather advisories and significant weather hazards.
  • G-AIRMETs — Graphical AIRMET hazard areas with polygon boundaries.

Airports & Airspace

  • Airports — Search 19,600+ US airports, get details, runways, and frequencies.
  • Airspace — Query controlled (Class B/C/D/E) and special-use airspace boundaries.
  • NOTAMs — Notices to Air Missions by airport, radius, or route.
  • Obstacles — 625,000+ FAA-charted obstacles (towers, cranes, antennas).

Flight Planning

  • Crosswind Calculator — Compute crosswind and headwind components from live METAR or manual input.
  • Density Altitude — Calculate density altitude for performance planning.
  • Nav Log — Full flight navigation log with wind correction and fuel burn.
  • Bearing & Distance — Point-to-point calculations between any two coordinates.
  • Winds Aloft — Forecast winds at altitude for 6, 12, and 24 hour periods.

Need Help?

Check out the authentication guide, rate limits, and error handling reference, or contact us for support.