Retrieve the list of Audit logs

Retrieving Audit Logs

The Audit Logs API allows authenticated clients to retrieve logs for calculation requests when audit logging is enabled. This feature provides transparency by storing details of each calculation, including inputs, results, and methodology references.

Endpoint

GET /v2/audits

Retrieves a list of audit logs for the authenticated client.

Authentication

  • Requires Bearer Token authentication.

  • Audit logging must be enabled for the account (contact SQUAKE support for activation).

Response Structure

Successful Response (200 OK)

Returns an array of audit log entries with the following structure:

[
  {
    "id": "0194d6b4-8711-7873-899d-c8133cd742f8",
    "request": {
      "type": "flight",
      "origin": "SAF",
      "destination": "ATL",
      "methodology": "ICAO"
    },
    "response": {
      "carbon_unit": "kilogram",
      "carbon_quantity": 302.75
    },
    "methodology": {
      "name": "ICAO",
      "source": "https://applications.icao.int/icec/Methodology%20ICAO%20Carbon%20Emissions%20Calculator_v13_Final.pdf",
      "version": "1.0"
    },
    "calculation": {
      "distance": {
        "original": {
          "distance": 3437.83,
          "distance_unit": "kilometer"
        },
        "corrected": {
          "distance": 3438,
          "distance_unit": "kilometer"
        }
      },
      "emission_factors": {
        "flight_type": "long_haul",
        "co2_per_passenger": 0.5
      }
    },
    "calculated_at": "2025-02-18T16:39:10Z"
  }
]

Key Attributes

General Information

  • id (UUID): Unique identifier for the audit log.

  • calculated_at (ISO 8601): Timestamp of when the calculation was performed.

Request Details

  • request: Contains the original parameters used in the calculation request (e.g., type, origin, destination, methodology).

Response Details

  • response: Stores the carbon emissions results, including:

    • carbon_quantity: Total emissions calculated.

    • carbon_unit: The unit of measurement (e.g., kilogram).

Calculation Details

  • calculation: Additional breakdown of calculation parameters, including:

    • distance: The original and corrected distances used.

    • emission_factors: Methodology-specific emission factors.

Methodology Information

  • methodology: Metadata about the calculation methodology, including:

    • name: Methodology used (e.g., ICAO, DEFRA).

    • version: Version of the methodology applied.

    • source: URL linking to the official methodology documentation.

How to Use the API

Example Request (cURL)

curl \ 
 --request GET https://api.squake.earth/v2/audits \ 
 --header "Authorization: Bearer $ACCESS_TOKEN"

Enabling Audit Logging

Audit logs are available only if this feature is enabled for your account. Contact SQUAKE support to activate audit logging.

For more details, refer to the official SQUAKE API documentation.

Last updated

Was this helpful?