End trip (deprecated)
const url = 'https://api.example.yas/v1/trips/end';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"partnerId":"partner","endTime":"2026-10-15T10:45:00.000Z","sessionId":"0199e0a0-0000-7000-8000-000000000001"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.example.yas/v1/trips/end \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "partnerId": "partner", "endTime": "2026-10-15T10:45:00.000Z", "sessionId": "0199e0a0-0000-7000-8000-000000000001" }'Deprecated. Use POST /v1/vehicles/trips/end. The body and errors are the same. This call is beta.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Send exactly one of sessionId or tripId. Both, or neither, is a 400. endTime is UTC with a Z suffix.
object
Partner id from setup. It must match the server key.
UTC with a Z suffix, such as 2026-10-15T10:45:00.000Z. An offset such as +08:00 is 400.
Open session to close. Send this or tripId, not both.
Partner trip id to close. Send this or sessionId, not both.
Example
{ "partnerId": "partner", "endTime": "2026-10-15T10:45:00.000Z", "sessionId": "0199e0a0-0000-7000-8000-000000000001"}Responses
Section titled “Responses”Trip ended. An unknown sessionId is stored as already closed.
object
The time that was stored. A later call does not change it.
Who closed the trip: partner for the backend, phone for the SDK, or silence when the phone stopped reporting. A later call keeps the stored value.
Example
{ "endTime": "2026-10-15T10:45:00.000Z", "endedBy": "partner", "sessionId": "0199e0a0-0000-7000-8000-000000000001", "tripId": "booking_1001"}400`endTime` must be UTC with a `Z` suffix, such as `2026-10-15T10:45:00.000Z`. An offset, a missing or unreal time, a `sessionId` that is not a UUID, an empty `tripId`, both ids, or neither id is 400.
object
Stable error code. No stack trace.
Example
{ "error": "invalid_body"}401The server key is missing or wrong.
object
Stable error code. No stack trace.
Example
{ "error": "invalid_credentials"}403A server key may be limited to vehicles, robots, or both. A call outside that limit is 403 `forbidden` and stores nothing. `identity_mismatch` means `partnerId` does not match the server key.
object
Stable error code. No stack trace.
Example
{ "error": "forbidden"}404Unknown `tripId`.
object
Stable error code. No stack trace.
Example
{ "error": "not_found"}409More than one open session for that `tripId`.
object
Stable error code. No stack trace.
Example
{ "error": "ambiguous_trip"}