---
title: "File the PIREP"
method: POST
path: "/flights/complete"
tags: ["Flights"]
---

# File the PIREP

`POST /flights/complete`

Closes out the flight. The server:

1. Saves every entry from `flight_data` (or the legacy `flight_log`) as ACARS LOG rows.
2. Recomputes total `distance` by summing great-circle segments between the FLIGHT_PATH rows accumulated during `/flights/update`. If no FLIGHT_PATH rows exist, the dpt-to-arr great-circle distance is used.
3. Files the PIREP with the supplied `landing_rate`, `fuel_used`, `flight_time`, and any of the optional `zfw` / `block_fuel` / `block_time` / `level` / `route` fields.
4. Appends any `comments` as pilot comments on the PIREP.
5. Calls phpVMS's `submit()` which fires the `PirepFiled` event, handles diversions, and applies rank-based auto-approval.

`flight_time` is in **decimal hours** here (the server multiplies by 60 to store minutes). Either `uuid` or `tracking_id` may carry the PIREP ID.

## Request body

- CompleteFlightRequest
  - `uuid` string, uuid — PIREP ID. Either this or `tracking_id` is required.
  - `tracking_id` string, uuid
  - `flight_data` FlightLogEntry[] — Log entries saved as ACARS LOG rows.
    - `event` string — Log message body.
    - `timestamp` string, date-time — ISO 8601 timestamp. Defaults to receive-time if omitted.
  - `flight_log` FlightLogEntry[] — Legacy field name — used only when `flight_data` is empty.
    - `event` string — Log message body.
    - `timestamp` string, date-time — ISO 8601 timestamp. Defaults to receive-time if omitted.
  - `landing_rate` number, float — Touchdown rate (feet per minute, negative).
  - `fuel_used` number, float — Total fuel burn, pounds.
  - `flight_time` number, float — Total flight time in decimal hours. Server stores as minutes.
  - `zfw` number, float — Zero-fuel weight in lbs.
  - `block_fuel` number, float — Block fuel in lbs.
  - `block_time` number, float — Block time in decimal hours.
  - `level` number, float — Cruise flight level (e.g. 360).
  - `route` union — Route. If sent as an array, the server joins on spaces. Omit to preserve the route prefiled at `/flights/start`.
    - string
    - string[]
  - `comments` FlightComment[] — Pilot comments to attach to the filed PIREP.
    - union — Pilot comment to attach to the PIREP. The server picks the first non-empty value from `event`, `text`, `comment` (in that order) if an object is supplied.
      - string
      - object
        - `event` string
        - `text` string
        - `comment` string

## Response `200`

PIREP filed and submitted.

- CompleteFlightResponse
  - `pirep_id` string, uuid, required
  - `flight_number` string, required — Airline code + flight number (e.g. `QFA1`).
  - `route` string, required — `<dpt-icao> - <arr-icao>` summary.
  - `aircraft` string, required — Aircraft name (falls back to registration if unnamed).
  - `aircraft_icao` string, required
  - `registration` string, required
  - `airline` string, required
  - `airline_icao` string, required

## Other responses

- `400` — Required `uuid` / `tracking_id` was not supplied.
- `401` — Missing or invalid Bearer token.
- `404` — No PIREP exists for the supplied tracking ID.
- `500` — Unhandled server error. The `error` field carries the message; check server logs for the trace.

---

[API](https://skmtc.net/skyvexsoftware/apis/stratos-core-api.md) · [All operations](https://skmtc.net/skyvexsoftware/apis/stratos-core-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/skyvexsoftware/stratos-core-api/versions/0b7ba98ff0aa/schema)
