Skip to main content
A vehicle is one physical vehicle of your company, identified by its license plate. A vehicle can be linked to one or more fleets and to documents. Read Connect API conventions first. It explains the base URL, authentication, Idempotency-Key, If-Match, pending operations and the error format. This page uses $CONNECT_API_BASE_URL for the base URL. Ask GRiDD support (support@grdd.net) for the Connect API base URL for your environment.

What is available

The Connect API README describes Fleets and Vehicles as complete production implementations in code. The route handlers validate requests and responses with the contracts in packages/api-contracts. This page describes those contracts. It does not say that a given environment serves them. All vehicle routes are owner routes. There is no route to read the vehicles of another company, and there is no published or public vehicle route.

Endpoints

Authentication and access

  • Send Authorization: Bearer YOUR_ACCESS_TOKEN. See Authentication.
  • The vehicle routes do not check a role in the token.
  • Subscription. Creating a vehicle checks your subscription. In the subscription contract in source, no plan has a numeric limit for vehicles. The check refuses a cancelled subscription with 403 entitlement_denied. An active trial passes. If the plan cannot be determined, the API returns 503 temporarily_unavailable. Updates and deletes do not count against a limit.

Vehicle fields

Read record

Write body

All write bodies are strict. Unknown keys, such as id, griddid or version, return 400 invalid_request. Create (POST /api/vehicles): Fields in vehicle: Update (PATCH /api/vehicles/{vehicleId}): the same shape. vehicle can hold any subset of the fields, and none is required. Send If-Match and Idempotency-Key.
  • If you omit a field, the API does not change it.
  • fleets: [] removes all fleet links. documents: [] or null removes all document links.
Delete (DELETE /api/vehicles/{vehicleId}): send If-Match. Optional query locale. The API also removes the links from fleets to the vehicle.

Image rules

In addition to the general image URL rules, a vehicle image URL must belong to your company. The first path segment must be shared, global or your company ID. Or the first segment is vehicle, vehicles or profile and the second is your company ID. Unlike fleet images, the host asset.grdd.dev alone is not enough. Another URL returns 403 forbidden.

Create a vehicle

201 Created with the header ETag: "v1":
The save response has data, invalidated and status (completed or pending). It can also have operationId and effects. A pending result returns 202. If a vehicle with the same slug or license_plate exists, the response is 409 conflict.

Read vehicles

Response 200. This is the fixture vehicle-list.json:
The list has no pagination parameters. Query parameters are locale, force, license_plate and vin_number. The plate and VIN filters match exactly.

Update a vehicle

The response is 200 (or 202 if pending) with the same shape as the create response and a new ETag. A stale If-Match returns 412 version_conflict. Use this route to change the fleet links of one vehicle without a full update. The body is the fixture vehicle-links-request.json:
POST adds the links. DELETE removes only the fleets that you list. Both return the updated vehicle in the save response (200, or 202 if pending). The API checks that the vehicle and every fleet belong to your company. A relationship that is not valid returns 422 domain_rejected.

Create or update a vehicle from reservation data

POST /api/vehicles/from-reservation takes the vehicle data of a reservation. The body is the fixture vehicle-reservation-request.json:
vehicleData is strict. Only plateNo is required. Send Idempotency-Key.
  • If no vehicle with that plate exists, the API creates one with status active.
  • If one exists and isDataDifferent is true, the API updates it.
  • If one exists and isDataDifferent is not true, the response is 422 domain_rejected.
The response is the save response (200, or 202 if pending).

Delete a vehicle

204 No Content when the delete is complete. If follow-up work is not finished, the response is 202. This is the fixture vehicle-delete-pending.json:
Resume it with POST /api/vehicles/operations/vehicle-11111111-1111-4111-8111-111111111111. The response has operationId, status and effects.

Errors

Error bodies use the problem format. These codes come from the vehicle routes.