@fleetkeep/cli
v0.7.0
Published
Operate every published Fleetkeep API workflow with guarded writes and machine-readable output
Readme
Fleetkeep CLI
The Fleetkeep CLI lets an operator or software agent use every operation in Fleetkeep's published
API. Friendly commands cover common vehicle and spreadsheet work. The allowlisted api call
command covers equipment, maintenance, defects, walkarounds, files, reminders, contacts, bookings,
tolls, tracking, guidance and exports without opening arbitrary or unpublished paths.
Start here
Run npx @fleetkeep/cli setup after installation. It signs you in through your
browser, checks your existing account and shows the next step. Return to the
terminal after each website step and refresh to see the current status.
Choose your intended fleet size on the website. Eligible new accounts can start a 30-day trial without a card; the price is shown before confirmation. Existing customers keep their account and subscription. App-store subscribers should contact Fleetkeep about Fleet access before purchasing a separate web plan.
Once Fleet access is active, use fleetkeep import preview "fleet.xlsx" to
review a spreadsheet before saving. The preview supplies the exact confirmation
command. Review missing dates, reminder timing and recipients on the dashboard.
Add a card only through the website after checking the first payment date.
fleetkeep setup --json returns the current setup state for automation without
opening a browser or starting an interactive login. --no-browser prints links
for you to open yourself. Setup never starts a subscription, imports records or
enables reminders on its own. It requires the matching setup API deployment.
Shared jobs and running costs
Friendly commands return JSON, including missing-data and stale-tracking fields:
fleetkeep costs list --from 2026-09-01 --to 2026-09-30
fleetkeep costs record --data-file expense.json
fleetkeep drivers activity --search JOB-42
fleetkeep tracking list
fleetkeep tracking route <vehicle-id> --period 7dDriver activity returns up to 100 journeys and 100 inspections from the company's central record. Search filters journeys by job reference, driver or registration; inspections remain the latest 100. The activity endpoint must be deployed before using this command. Route history requires a supported connected tracker. Expense files use the fields below; keep the same UUID and body when retrying.
fleetkeep jobs list --search JOB-42 finds company jobs. Use
fleetkeep jobs save JOB-42 --title "Depot installation" to create or update a reference,
and fleetkeep jobs close <job-id> or reopen <job-id> to change its availability.
Closing a job preserves its journey history. These owner operations need an active Fleet plan.
fleetkeep api call getRunningCosts --query from=2026-09-01 --query to=2026-09-30
returns recorded GBP costs and missing-data flags. recordFleetExpense accepts a JSON body
with id (UUID), vehicleId, incurredOn, category, amount (GBP decimal string) and
description. Reuse the UUID and identical body on retries. Dates span up to one year.
Supported categories are fuel, insurance, repair, parking and other. Negative amounts record
refunds or corrections. Service costs and recorded GBP tolls are included separately, so do
not enter them again. Account JSON exports include jobs, journeys and additional costs.
Xero authorisation and bill review take place in the web portal. Saved SHVL grants and credentials are not transferred between products or customer workspaces.
Service intervals and equipment
Record completed servicing by registration without looking up an internal vehicle ID first:
fleetkeep service record "BD15 KFG" --date 2026-09-27 --mileage 48212 \
--work "Scheduled service"Fleetkeep matches the exact normalised registration and shows the proposed record. Nothing is saved until the operator repeats the same command with the short-lived confirmation token. The CLI derives a stable idempotency key from the matched vehicle and record, so an identical retry returns the original result rather than creating a duplicate.
Set one service interval in days, weeks or months. The vehicle command clears the alternative unit when switching, and converts weeks to days:
fleetkeep vehicles update <vehicle-id> --service-interval-weeks 6
fleetkeep vehicles update <vehicle-id> --service-interval-months 12
fleetkeep vehicles update <vehicle-id> --clear serviceIntervalDays,serviceIntervalMonths
fleetkeep api call getWalkaroundSummary
fleetkeep api call listVehicleEquipment --path id=<vehicle-id>
fleetkeep api call updateVehicleEquipment --path id=<vehicle-id> --data-file equipment.jsonThe walkaround summary returns vehicles checked today in London time, not a
roadworthiness certificate. Equipment payloads support presetKey, provider,
reference, cover dates, reminders and up to eight details label/value pairs.
Use an Arrangement detail for the confirmed ownership type, such as Hired.
Omitting details preserves existing values; an empty array explicitly clears them.
Use previewEquipmentTemplate before applyEquipmentTemplate for fleet-wide setup.
With the matching API update deployed, createMaintenance also accepts
forecastConsent: true and a forecast object containing baselineDate,
baselineMileage, intervalMiles, annualMileage and reminderDays (0 means on
the estimated date). Supply the actual last check, not an assumed MOT check date.
Duplicate setup does not create another reminder; refresh the maintenance list.
completeMaintenance accepts completedDate and completedMileage for
an existing forecast. Supply the identical body for preview and confirmation;
the next cycle retains the saved mileage interval and reminder timing. Ordinary
maintenance updates cannot edit calculated forecast dates. There are no automatic
fuel-card feeds in the CLI. Wex credentials and Xero authorisation are entered in
the website, never through CLI command arguments.
Safety model
api operationsis generated as a fixed allowlist of the published OpenAPI operation IDs.- Consequential actions use short-lived server-issued confirmation tokens. An unconfirmed request
returns the token without making the change; review it before repeating with
--confirmation. - Retry-safe creates and sends require
--idempotency-keywhen the API contract requires it. - Vehicle and toll imports remain preview-first and require the exact preview digest before apply.
- Multipart uploads accept only explicit
--fieldand--filevalues. Each file is capped at 10 MB. - Downloads require an explicit output path. Existing files are not replaced unless
--overwriteis present. - Updates distinguish omitted fields from fields explicitly cleared with
--clear. - Interactive login uses an OAuth 2.1 public client with S256 PKCE and a loopback callback.
- Stored access and refresh tokens use an owner-only local file and are never accepted as command arguments.
FLEETKEEP_ACCESS_TOKENremains available as an explicit environment override for automation.- OAuth asks only for the published operational scopes. Account deletion, billing, OAuth-client administration and telematics credential operations are not available.
Use
Node.js 20 or newer is required. Sign in through Fleetkeep in your browser, then use the CLI:
fleetkeep auth login
fleetkeep vehicles list
fleetkeep vehicles get <vehicle-id> --json
fleetkeep vehicles add "AB12 CDE" --label "Service van" --operational-status active --json
fleetkeep vehicles update <vehicle-id> --operational-status off_road --status-notes "Unsafe tyre"
fleetkeep vehicles update <vehicle-id> --clear assignedDriverName,assignedDriverContact
fleetkeep vehicles bulk-add "AB12 CDE" "XY34 ZZZ" --json
fleetkeep vehicles delete <vehicle-id> --json
fleetkeep vehicles delete <vehicle-id> --confirmation <server-token> --json
fleetkeep drivers list
fleetkeep drivers invite [email protected] --name "Pat Driver"
fleetkeep drivers resend <driver-id>
fleetkeep drivers revoke <driver-id>
fleetkeep import preview vehicles.xlsx
fleetkeep import apply vehicles.xlsx --confirm <digest-from-preview>
fleetkeep api operations --json
fleetkeep api call listTrackingSnapshots
fleetkeep api call getWexRouteHistory --path vehicleId=<vehicle-id> --query period=7d
fleetkeep api call createServiceRecord --path id=<vehicle-id> \
--idempotency-key <unique-value> --data-file service-record.json
fleetkeep api call createServiceRecord --path id=<vehicle-id> \
--idempotency-key <same-unique-value> --confirmation <server-token> \
--data-file service-record.json
fleetkeep api call uploadVehiclePhoto --path id=<vehicle-id> --file photo=van.jpg
fleetkeep api call downloadFleetSpreadsheet --output fleetkeep-export.xlsxRun fleetkeep --help for API call options and every supported vehicle field. api call returns
JSON for JSON endpoints and a JSON receipt for saved downloads. Use --path name=value for each path
placeholder, --query name=value for query values, and --data or --data-file for JSON bodies.
Use repeated --field and --file options for published multipart operations.
Set FLEETKEEP_API_URL to an alternate origin for local or staging verification. For unattended
automation, set FLEETKEEP_ACCESS_TOKEN in the process environment. OAuth access and refresh tokens
are never accepted in command arguments. Short-lived action confirmations are supplied separately
with --confirmation.
Service-record creation is a two-step operator-confirmed action. The first call returns a 409
challenge. Retry the identical body and idempotency key with its --confirmation token. A safe
retry with the same key returns the original record instead of creating a duplicate.
