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
| Field | Type | Required | Description |
|---|---|---|---|
| flights | array | Yes | List of flight segments to compute emissions for (see FlightEmissionRequest) |
FlightEmissionInfo Object
| Field | Type | Required | Description |
|---|---|---|---|
| startPoint | string | No | Departure airport code (IATA) |
| endPoint | string | No | Arrival airport code (IATA) |
| flightNumber | string | No | Flight number |
| departDate | string | No | Departure date (date format) |
| operatingCarrierCode | string | No | Operating 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
flightsarray must contain at least one valid segment. - Emission values are estimates and may vary by airline, aircraft, and route.
- All calculations are auditable via
trackingIdandtrackingTime.
Response Structure
| Field | Type | Nullable | Description |
|---|---|---|---|
| system | string | Yes | System name (e.g., VN, VJ) |
| status | boolean | No | true if successful, false if failed |
| error | object | Yes | Error code object |
| description | string | Yes | Error message or status description |
| trackingId | string | Yes | Request tracking ID |
| trackingTime | string | Yes | Request tracking timestamp |
| flightEmissions | array | Yes | List of computed emissions (see FlightEmission) |
FlightEmission Object
| Field | Type | Nullable | Description |
|---|---|---|---|
| flightInfo | object | Yes | Flight information (see EmissionFlight) |
| emissions | object | Yes | Emissions by cabin class (see Emissions) |
EmissionFlight Object
| Field | Type | Nullable | Description |
|---|---|---|---|
| startPoint | string | Yes | Departure airport code |
| endPoint | string | Yes | Arrival airport code |
| flightNumber | string | Yes | Flight number |
| operatingCarrierCode | string | Yes | Operating carrier code |
Emissions Object
| Field | Type | Nullable | Description |
|---|---|---|---|
| first | integer | Yes | First class emissions |
| business | integer | Yes | Business class emissions |
| premiumEconomy | integer | Yes | Premium economy emissions |
| economy | integer | Yes | Economy 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.