Retrieve all available fuel types in the system. Each fuel type includes emission factors and available units of measurement for accurate CO2e calculations.
Reference Data: This endpoint returns standardized fuel types used across the platform. Use the fuel IDs returned here when creating or updating vehicles.
Retrieve available fuels before creating a vehicle:
Copy
def get_all_fuels(): """Get all available fuel types""" response = requests.get( "https://api.dcycle.io/v1/vehicle-fuels", headers=headers ) return response.json()# Get all fuelsall_fuels = get_all_fuels()print(f"Available fuels: {len(all_fuels)}")# Find a specific fueldiesel = next(f for f in all_fuels if f['fuel'] == 'diesel')print(f"Diesel ID: {diesel['id']}")
def get_fuels_by_country(country_code): """Get fuel types for a specific country""" response = requests.get( "https://api.dcycle.io/v1/vehicle-fuels", headers=headers ) fuels = response.json() country_fuels = [f for f in fuels if f['country'] == country_code] return country_fuels# Get fuels for Spainspain_fuels = get_fuels_by_country("ES")for fuel in spain_fuels: print(f"{fuel['fuel']}: {[u['name'] for u in fuel['fuel_units']]}")