Complete Integration Guide for SAPI and flight.json
This documentation covers two key integration methods for SayIntentions.AI:
The SayIntentions.AI SAPI provides comprehensive programmatic access to the AI-powered air traffic control simulation system. This API enables flight simulator enthusiasts, developers, and automation tools to integrate with the world's most advanced AI ATC system.
SAPI uses API key authentication. Most endpoints require a valid API key, while some public endpoints do not.
There are two ways to obtain your API key:
api_key
field from the JSON structureEndpoints are categorized by their authentication requirements:
All API endpoints are accessed via HTTP GET requests to the base URL followed by the endpoint name.
Make any entity in the AI living world say a phrase, or simulate pilot communications to entities.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
channel |
string | Required | Communication channel: COM1, COM2, INTERCOM1, INTERCOM2, INTERCOM3, COM1_IN, COM2_IN, INTERCOM1_IN, INTERCOM2_IN, INTERCOM3_IN, ACARS_IN |
message |
string | Required | Message to be spoken (max 255 characters, 128 for ACARS_IN). Must be URL encoded. |
rephrase |
integer | Optional | 1 = AI rephrases message naturally, 0 = use exact message (default: 0). Only supported for "_IN" channels. |
from |
string | Optional | ACARS station ID (for ACARS_IN channel only) |
response_code |
string | Optional | ACARS response code like 'WU', 'NE' (for ACARS_IN channel only) |
message_type |
string | Optional | Message type: 'cpdlc' or 'telex' (for ACARS_IN channel only, defaults to 'cpdlc') |
# Make Co-Pilot say "Good morning Captain" (with AI variation) curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=INTERCOM1_IN" --data-urlencode "message=Good morning Captain" --data-urlencode "rephrase=1" # Make ATC ask for altitude verification curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=COM1_IN" --data-urlencode "message=Verify altitude" --data-urlencode "rephrase=1" # Pilot tells ATC ready for departure curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=COM1" --data-urlencode "message=Holding Short Runway 20 Ready For Departure" # Send ACARS message curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=ACARS_IN" --data-urlencode "message=HAPPY BIRTHDAY" --data-urlencode "from=XXYY" --data-urlencode "response_code=NE"
Retrieve the complete communication history for the current flight, including both pilot and ATC transmissions.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Get current weather information including ATIS, METAR, and TAF data for specified airports.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
icao |
string | Required | Airport ICAO code(s). Multiple airports separated by commas (e.g., "KJFK,KLGA") |
with_comms |
integer | Optional | Include communication frequencies (1 = yes, 0 = no) |
curl "https://apipri.sayintentions.ai/sapi/getWX" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "icao=KJFK" --data-urlencode "with_comms=1"
Get current Temporary Flight Restrictions (TFR) data in GeoJSON format.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Get current VATSIM network data in GeoJSON format, showing active controllers and pilots.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Request assignment to a specific gate at an airport.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
gate |
string | Required | Requested gate identifier (max 30 characters, alphanumeric only) |
airport |
string | Required | Airport ICAO code (3-4 characters, alphanumeric) |
curl "https://apipri.sayintentions.ai/sapi/assignGate" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "gate=A21" --data-urlencode "airport=KATL"
Get current parking assignment information for the active flight.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Get comprehensive airport information including weather and communication frequencies.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Set radio frequency for COM1 or COM2, either active or standby.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
freq |
float | Required | Frequency in MHz (e.g., 121.900) |
com |
integer | Optional | Radio number: 1 or 2 (default: 1) |
mode |
string | Optional | Frequency mode: 'active' or 'standby' (default: 'active') |
curl "https://apipri.sayintentions.ai/sapi/setFreq" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "freq=121.900" --data-urlencode "com=1" --data-urlencode "mode=active"
Get the current frequency configuration for the active flight.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
Set flight simulator variables or system parameters.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
var |
string | Required | Variable name to set |
value |
string | Required | Value to assign to the variable |
category |
string | Optional | Variable category (default: "L") |
Pause or unpause the ATC simulation.
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your API key |
value |
integer | Required | Pause state: 1 = pause, 0 = unpause |
# Pause the simulation curl "https://apipri.sayintentions.ai/sapi/setPause" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "value=1" # Resume the simulation curl "https://apipri.sayintentions.ai/sapi/setPause" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "value=0"
All endpoints return JSON responses. Error responses include an error
field with a descriptive message.
# 1. Get weather for departure airport curl "https://apipri.sayintentions.ai/sapi/getWX" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "icao=KJFK" --data-urlencode "with_comms=1" # 2. Make co-pilot announce ready for pushback curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=INTERCOM1_IN" --data-urlencode "message=Captain, ready for pushback" --data-urlencode "rephrase=1" # 3. Set COM1 to ground frequency curl "https://apipri.sayintentions.ai/sapi/setFreq" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "freq=121.900" --data-urlencode "com=1" --data-urlencode "mode=active" # 4. Simulate pilot call to ground curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=COM1" --data-urlencode "message=JFK Ground, N12345 at gate A1, ready to taxi"
# 1. Request specific gate assignment curl "https://apipri.sayintentions.ai/sapi/assignGate" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "gate=A21" --data-urlencode "airport=KATL" # 2. Get current parking information curl "https://apipri.sayintentions.ai/sapi/getParking" -G --data-urlencode "api_key=YOUR_API_KEY" # 3. Announce arrival at gate curl "https://apipri.sayintentions.ai/sapi/sayAs" -G --data-urlencode "api_key=YOUR_API_KEY" --data-urlencode "channel=INTERCOM1" --data-urlencode "message=Ladies and gentlemen, we have arrived at gate A21"
// GPT: SAPI JavaScript wrapper class class SayIntentionsAPI { constructor(apiKey) { this.apiKey = apiKey; this.baseUrl = 'https://apipri.sayintentions.ai/sapi/'; } async makeRequest(endpoint, params = {}) { const url = new URL(this.baseUrl + endpoint); url.searchParams.append('api_key', this.apiKey); Object.keys(params).forEach(key => { url.searchParams.append(key, params[key]); }); const response = await fetch(url); return await response.json(); } async sayAs(channel, message, options = {}) { return await this.makeRequest('sayAs', { channel, message, ...options }); } async getWeather(icao, withComms = false) { return await this.makeRequest('getWX', { icao, with_comms: withComms ? 1 : 0 }); } async assignGate(gate, airport) { return await this.makeRequest('assignGate', { gate, airport }); } async setFrequency(freq, com = 1, mode = 'active') { return await this.makeRequest('setFreq', { freq, com, mode }); } async pauseSimulation(pause = true) { return await this.makeRequest('setPause', { value: pause ? 1 : 0 }); } async getCommsHistory() { return await this.makeRequest('getCommsHistory'); } async getTFRs() { return await this.makeRequest('getTFRs'); } async getVATSIM() { return await this.makeRequest('getVATSIM'); } } // Usage examples const sapi = new SayIntentionsAPI('YOUR_API_KEY'); // Make co-pilot announce takeoff sapi.sayAs('INTERCOM1_IN', 'Ladies and gentlemen, prepare for takeoff', { rephrase: 1 }) .then(response => { console.log('Co-pilot announcement sent:', response); }) .catch(error => { console.error('Error:', error); }); // Get weather for multiple airports sapi.getWeather('KJFK,KLGA,KEWR', true) .then(weather => { console.log('Weather data:', weather); }) .catch(error => { console.error('Error:', error); }); // Request gate assignment sapi.assignGate('A21', 'KATL') .then(result => { console.log('Gate assigned:', result.assigned_gate_name); }) .catch(error => { console.error('Gate assignment failed:', error); }); // Set radio frequency sapi.setFrequency(121.900, 1, 'active') .then(response => { console.log('Frequency set:', response); }) .catch(error => { console.error('Frequency error:', error); });
Currently, there are no strict rate limits implemented, but customers who abuse the system by sending excessive messages may have their access restricted. As a general guideline:
The flight.json
file is a real-time data file automatically generated and updated by SayIntentions.AI during active flights. This file contains comprehensive flight information, configuration settings, and API credentials that can be used for monitoring and integration purposes.
The flight.json file is automatically created in your local AppData directory when SayIntentions.AI is running an active flight.
%LOCALAPPDATA%\SayIntentionsAI\flight.json
C:\Users\YourUsername\AppData\Local\SayIntentionsAI\flight.json
%LOCALAPPDATA%\SayIntentionsAI\
in the address barcd %LOCALAPPDATA%\SayIntentionsAI
cd $env:LOCALAPPDATA\SayIntentionsAI
The flight.json file contains a top-level flight_details
object with all flight-related information.
{ "flight_details": { "Email": "pilot@example.com", "userid": "12345", "flight_id": 67890, "api_key": "your-api-key-here", "hostname": "https://apipri.sayintentions.ai", "callsign": "N12345", "callsign_icao": "N12345", "current_flight": { "flight_origin": "KJFK", "flight_destination": "KLAX", "assigned_gate": "A21", "taxi_path": [...], "flight_plan_route": "KJFK..KLAX" }, "traffic_enabled": "1", "traffic_density": "medium", "atis_airports": "KJFK,KLGA,KEWR", "current_airport": "KJFK" } }
Field | Type | Description | Example Value |
---|---|---|---|
Email |
string | User's email address | "pilot@example.com" |
userid |
string | Unique user identifier | "12345" |
flight_id |
integer | Unique identifier for current flight | 67890 |
api_key |
string | API key for SAPI authentication | "abc123def456" |
Field | Type | Description | Example Value |
---|---|---|---|
hostname |
string | API server hostname | "https://apipri.sayintentions.ai" |
log_level |
integer | Current logging level | 2 |
sidecar_log_level |
integer | Sidecar application logging level | 1 |
skynet_endpoint |
string | Multiplayer network endpoint | "skynet.sayintentions.ai:9000" |
enable_skynet |
integer | Multiplayer network enabled (1=yes, 0=no) | 0 |
skynet_group_code |
string | Multiplayer group identifier | "GROUP123" |
Field | Type | Description | Example Value |
---|---|---|---|
callsign |
string | Aircraft callsign | "N12345" |
callsign_icao |
string | ICAO format callsign | "N12345" |
Field | Type | Description | Example Value |
---|---|---|---|
current_flight.flight_origin |
string | Origin airport ICAO code | "KJFK" |
current_flight.flight_destination |
string | Destination airport ICAO code | "KLAX" |
current_flight.flight_destination_lat |
string | Destination airport latitude | "33.9425" |
current_flight.flight_destination_lon |
string | Destination airport longitude | "-118.4081" |
current_flight.flight_plan_origin_lat |
string | Origin airport latitude | "40.6413" |
current_flight.flight_plan_origin_lon |
string | Origin airport longitude | "-73.7781" |
current_flight.flight_plan_route |
string | Filed flight plan route | "KJFK DCT HAPIE DCT KLAX" |
current_flight.flight_plan_sid |
string | Standard Instrument Departure | "CANDR4" |
current_flight.flight_plan_star |
string | Standard Terminal Arrival Route | "BAYST2" |
current_flight.flight_plan_departing_runway |
string | Assigned departure runway | "04L" |
current_flight.flight_plan_arriving_runway |
string | Assigned arrival runway | "25R" |
current_flight.destination_arriving_runways |
string | Available arrival runways (comma-separated) | "25L,25R,24L,24R" |
Field | Type | Description | Example Value |
---|---|---|---|
current_flight.assigned_gate |
string | Assigned gate identifier | "A21" |
current_flight.assigned_gate_lat |
string | Gate latitude coordinate | "40.6413" |
current_flight.assigned_gate_lon |
string | Gate longitude coordinate | "-73.7781" |
current_flight.taxi_path |
array | Taxi route waypoints | [{lat: 40.641, lon: -73.778}, ...] |
current_flight.taxi_object |
string | Taxi guidance object identifier | "taxi_arrow_123" |
Field | Type | Description | Example Value |
---|---|---|---|
cleared_for_landing |
string | Runway cleared for landing | "25R" |
cleared_for_takeoff |
string | Runway cleared for takeoff | "04L" |
distance_to_runway |
string | Distance to assigned runway (nautical miles) | "2.5" |
Field | Type | Description | Example Value |
---|---|---|---|
traffic_enabled |
string | AI traffic enabled (1=yes, 0=no) | "1" |
traffic_density |
string | Traffic density setting | "medium" |
traffic_radius |
string | Traffic generation radius (nautical miles) | "50" |
max_aircraft |
string | Maximum AI aircraft | "25" |
max_static_aircraft |
string | Maximum static aircraft at airports | "15" |
ga_traffic |
string | General aviation traffic enabled (1=yes, 0=no) | "1" |
dispatcher_log_level |
string | Traffic dispatcher logging level | "2" |
Field | Type | Description | Example Value |
---|---|---|---|
atis_airports |
string | Airports for ATIS updates (comma-separated) | "KJFK,KLGA,KEWR" |
current_airport |
string | Current airport ICAO code | "KJFK" |
pattern_direction |
string | Traffic pattern direction (left/right) | "left" |
runway |
string | Currently assigned runway | "04L" |
Here's a simple example of reading the flight.json file to extract the API key:
// GPT: Example of reading flight.json to get API key const fs = require('fs'); const path = require('path'); const os = require('os'); function getFlightData() { try { // Construct path to flight.json const flightJsonPath = path.join( os.homedir(), 'AppData', 'Local', 'SayIntentionsAI', 'flight.json' ); // Read and parse the file const flightData = JSON.parse(fs.readFileSync(flightJsonPath, 'utf8')); return { apiKey: flightData.flight_details.api_key, flightId: flightData.flight_details.flight_id, callsign: flightData.flight_details.callsign, origin: flightData.flight_details.current_flight.flight_origin, destination: flightData.flight_details.current_flight.flight_destination, currentAirport: flightData.flight_details.current_airport }; } catch (error) { console.error('Error reading flight.json:', error.message); return null; } } // Usage const flightInfo = getFlightData(); if (flightInfo) { console.log('API Key:', flightInfo.apiKey); console.log('Current Flight:', flightInfo.callsign, 'from', flightInfo.origin, 'to', flightInfo.destination); }
SayIntentions.AI uses our custom "SimAPI" implementation as the mechanism for integrating SayIntentions.AI into ANY flight simulation software. Or put another way, SimAPI is used as a custom-built abstraction layer between SayIntentions.AI and any given flight simulator.
SimAPI uses a two-way file-based communication system:
For feeding simulator data into SayIntentions.AI:
For SayIntentions.AI to change simulator variables:
Language Agnostic: We support any programming language, as long as the adapter can read and write JSON files from the local file system.
The adapter needs to be able to read and write to the file-system of whatever computer the SayIntentions.AI application is running on. However, these read and write operations could be done over a network connection.
Update Frequency: Every 0.75 to 1 second is more than enough.
Read Frequency: Every 0.75 to 1 second is sufficient. After reading, delete the file or clear its contents.
In addition to the simvars listed in the specification, the input JSON requires five additional fields:
Field | Type | Purpose | Example |
---|---|---|---|
name |
String | Plain-text name of your simulator | "SuperFunSim", "MobiSimNow" |
version |
String | Version of the simulator itself | "2.1.4", "1.0.3" |
adapter_version |
String | Version of your adapter | "1.0.0", "2.3.1" |
simapi_version |
String | SimAPI version your code targets | "1.0", "2.0" |
exe |
String | Windows executable name of simulator | "mysim.exe", "flightsim.exe" |
The output file uses JSONL format (one JSON object per line). Each line represents a variable change request:
{"setvar": "COM_STBY_RADIO_SET_HZ", "value": "127950000"}
In this example, you should set the COM1 standby radio to 127.95 MHz.
Input simvar names are taken from MSFS 2020/2024. Complete list with purpose and data types:
View Input VariablesOutput simvar names are taken from MSFS 2020/2024 K-Vars. Complete list with purpose and data types:
View Output VariablesExample of simAPI_input.json structure:
Download Sample InputExample of simAPI_output.jsonl structure:
Download Sample OutputThe following features are NOT available to simulators that integrate with SayIntentions.AI using the SimAPI adapter:
Rescue & Fire Missions: These missions will function but without visual elements:
All Other Mission Types: These work completely with SimAPI:
If you need assistance with the SAPI: