Skip to main content

Compute Emission

Calculate the estimated carbon emissions for one or more flight segments. This endpoint helps users and systems understand the environmental impact of their travel choices.


Endpoint

  • URL: /api/v1/flight/compute-emission
  • Method: POST
  • Auth Required: Yes (Bearer Token/X-API-KEY)
  • Content-Type: application/json

Authentication

This endpoint requires a valid JWT Bearer token in the Authorization header:

Authorization: Bearer <access_token>

Obtain tokens via /api/v1/sign-in (POST) with your credentials.


Request Structure

FieldTypeRequiredDescription
flightsarrayYesList of flight segments to compute emissions for (see FlightEmissionRequest)

FlightEmissionInfo Object

FieldTypeRequiredDescription
startPointstringNoDeparture airport code (IATA)
endPointstringNoArrival airport code (IATA)
flightNumberstringNoFlight number
departDatestringNoDeparture date (date format)
operatingCarrierCodestringNoOperating carrier code

Example Request:

{
"flights": [
{
"startPoint": "SGN",
"endPoint": "HAN",
"flightNumber": "VN123",
"departDate": "2024-06-01",
"operatingCarrierCode": "VN"
}
]
}

Request Constraints & Business Rules

  • Only valid and supported flight segments can be used for emission calculation.
  • The flights array must contain at least one valid segment.
  • Emission values are estimates and may vary by airline, aircraft, and route.
  • All calculations are auditable via trackingId and trackingTime.

Response Structure

FieldTypeNullableDescription
systemstringYesSystem name (e.g., VN, VJ)
statusbooleanNotrue if successful, false if failed
errorobjectYesError code object
descriptionstringYesError message or status description
trackingIdstringYesRequest tracking ID
trackingTimestringYesRequest tracking timestamp
flightEmissionsarrayYesList of computed emissions (see FlightEmission)

FlightEmission Object

FieldTypeNullableDescription
flightInfoobjectYesFlight information (see EmissionFlight)
emissionsobjectYesEmissions by cabin class (see Emissions)

EmissionFlight Object

FieldTypeNullableDescription
startPointstringYesDeparture airport code
endPointstringYesArrival airport code
flightNumberstringYesFlight number
operatingCarrierCodestringYesOperating carrier code

Emissions Object

FieldTypeNullableDescription
firstintegerYesFirst class emissions
businessintegerYesBusiness class emissions
premiumEconomyintegerYesPremium economy emissions
economyintegerYesEconomy class emissions

Example Response:

{
"system": "VN",
"status": true,
"description": "Emission calculation successful",
"trackingId": "abc-123",
"trackingTime": "2024-06-01T12:00:00Z",
"flightEmissions": [
{
"flightInfo": {
"startPoint": "SGN",
"endPoint": "HAN",
"flightNumber": "VN123",
"operatingCarrierCode": "VN"
},
"emissions": {
"economy": 120,
"premiumEconomy": 180,
"business": 240,
"first": 300
}
}
]
}

Error Codes

See Error Codes for details on possible error responses.


Security & Validation

  • All input is validated for type and required fields.
  • Only authenticated users can access this endpoint.
  • All actions are logged and traceable.

Validation Questions

  • What are the supported formats and required fields for each flight segment?
  • How are emissions calculated for multi-leg journeys?
  • What happens if a segment is not supported or data is missing?

For integration support, see Contact Support.