{
    "openapi": "3.1.0",
    "info": {
        "title": "Missing Plane API",
        "version": "1.0",
        "description": "Free, read-only, no key. EU261/UK261 compensation estimates and open data on disrupted flights (CC BY 4.0, credit \"Missing Plane (missingplane.com)\").",
        "license": {
            "name": "CC BY 4.0",
            "url": "https://creativecommons.org/licenses/by/4.0/"
        },
        "contact": {
            "email": "hello@missingplane.com"
        }
    },
    "servers": [
        {
            "url": "https://missingplane.com"
        }
    ],
    "paths": {
        "/api/compensation": {
            "get": {
                "summary": "Estimate EU261/UK261 compensation for a flight",
                "operationId": "compensation",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{3}$",
                            "description": "IATA airport code, e.g. CDG"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{3}$",
                            "description": "IATA airport code, e.g. CDG"
                        }
                    },
                    {
                        "name": "event",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "delay",
                                "cancel",
                                "denied"
                            ],
                            "default": "delay"
                        }
                    },
                    {
                        "name": "delay",
                        "in": "query",
                        "description": "Hours late at the final destination",
                        "schema": {
                            "type": "number",
                            "default": 5
                        }
                    },
                    {
                        "name": "notice",
                        "in": "query",
                        "description": "Days of notice before a cancellation",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    },
                    {
                        "name": "carrier",
                        "in": "query",
                        "description": "Where the airline is licensed: EU, UK or X (elsewhere)",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "EU",
                                "UK",
                                "X"
                            ],
                            "default": "EU"
                        }
                    },
                    {
                        "name": "cause",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "airline",
                                "weather",
                                "atc",
                                "unknown"
                            ],
                            "default": "unknown"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "fr",
                                "es"
                            ],
                            "default": "en"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Estimate: regime, distance (km), amount, currency, status (yes|maybe|no), reasons, you_receive per option"
                    },
                    "400": {
                        "description": "Unknown airport"
                    }
                }
            }
        },
        "/api/disruptions.json": {
            "get": {
                "summary": "Flights cancelled or 3+ hours late at the watched airports",
                "operationId": "disruptions",
                "parameters": [
                    {
                        "name": "days",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 14,
                            "default": 2
                        }
                    },
                    {
                        "name": "airport",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{3}$",
                            "description": "IATA airport code, e.g. CDG"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of flights with the compensation they may be owed"
                    }
                }
            }
        },
        "/api/disruptions.csv": {
            "get": {
                "summary": "One month of disrupted flights as CSV",
                "operationId": "disruptionsCsv",
                "parameters": [
                    {
                        "name": "month",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "CSV file",
                        "content": {
                            "text/csv": {}
                        }
                    }
                }
            }
        },
        "/api/strikes.json": {
            "get": {
                "summary": "Announced air travel strikes in Europe and whether compensation is likely",
                "operationId": "strikes",
                "parameters": [
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "fr",
                                "es"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of strikes"
                    }
                }
            }
        }
    }
}