Departure Times

Departure times represent scheduled departure times for vehicles. This API allows you to sync departure schedules from your Transportation Management System (TMS) into Flipturn, enabling features like:

  1. Late charging alerts — notify when a vehicle may not be fully charged by its scheduled departure

  2. Smart charging optimization — prioritize charging based on departure schedules

  3. Dashboard visibility — show scheduled departures alongside charging status

Sync workflow

The API is designed for a simple "sync" workflow where you POST all upcoming departures for a vehicle at once. This approach:

  • Atomically replaces all future departures for the vehicle — if a trip was rescheduled, the outdated record is removed automatically

  • Leaves past departures unchanged (for historical records)

A typical integration calls this endpoint periodically (e.g., every 5 minutes or hourly) to keep departure schedules up to date.

POST /api/departure-times/vehicle

Sync all departure times for a specific vehicle. This endpoint:

  1. Deletes all future departures for the specified vehicle

  2. Filters out any past departures from the request (marks them as skipped)

  3. Inserts the remaining future departures

  4. Returns all departures with per-item outcome (created or skipped)

Vehicle identification

You must provide either vehicleId or vehicleVin (not both).

  • By vehicleVin (recommended): If a vehicle with this VIN exists in Flipturn, the departures will be associated with it. If no matching vehicle exists, the departures are stored with the VIN for future matching — when the vehicle is later created in Flipturn with that VIN, the next sync call will automatically link the departures to the vehicle.

  • By vehicleId: Use this if you know the Flipturn vehicle ID. Returns 404 if the vehicle doesn't exist.

Request Body

Response

Each departure in the response includes an outcome field:

  • created — the departure was successfully inserted

  • skipped — the departure time is in the past and was not inserted

Example: sync by vehicle ID

Request:

Response:

Example: sync by VIN (vehicle exists)

Request:

Response (vehicle matched by VIN — vehicleId populated, vehicleVin null):

Example: sync by VIN (vehicle does not exist yet)

If the VIN doesn't match any existing vehicle, the departure is stored with the VIN for future matching. When the vehicle is later created in Flipturn with that VIN, the next sync call will automatically link the departures to the vehicle.

Request:

Response (vehicleId null, vehicleVin set):

Example: clearing all future departures

To remove all future departures for a vehicle, send an empty array:

Response:

Validation errors

Condition
Status

Neither vehicleId nor vehicleVin provided

400

Both vehicleId and vehicleVin provided

400

vehicleId does not exist in the org

404

targetSoc outside 0–100

400

Non-org-scoped API key

400


POST /api/departure-times/batch

Sync departure times for multiple vehicles in a single request. Each vehicle is processed independently — if one vehicle identifier is invalid, the others still succeed.

The request body is an array of vehicle sync items. Each item follows the same rules as the single-vehicle endpoint above.

Request Body

Response

Each item in the results array corresponds to one input vehicle (in order). On success the departure times are included with per-item outcome; on error an error message is included instead.

Example request and response

Response (second vehicle failed, others succeeded):

Last updated