If you want to keep the vehicle data for historical records, consider archiving instead:
Copy
def archive_vehicle(vehicle_id): """Archive a vehicle instead of deleting (if status field supports it)""" # Use PATCH to set status to archived response = requests.patch( f"https://api.dcycle.io/v1/vehicles/{vehicle_id}", headers=headers, json={"status": "archived"} ) return response.json()