Skip to content

End trip (beta)

Beta
POST
/v1/vehicles/trips/end
curl --request POST \
--url https://api.example.yas/v1/vehicles/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" }'

Beta. The partner backend closes an open trip with the server key. Send partnerId, endTime, and exactly one of sessionId or tripId. Sending both, or neither, is a 400. endTime is UTC with a Z suffix. An offset is 400. The first endTime is kept. A later call does not replace it. An unknown sessionId is stored as already closed. An unknown tripId is 404. More than one open session for a tripId is 409. POST /v1/trips/end is deprecated. Use this path.

Media typeapplication/json

Send exactly one of sessionId or tripId. Both, or neither, is a 400. endTime is UTC with a Z suffix.

object
partnerId
required

Partner id from setup. It must match the server key.

string
/^[a-z0-9-]{1,64}$/
endTime
required

UTC with a Z suffix, such as 2026-10-15T10:45:00.000Z. An offset such as +08:00 is 400.

string format: date-time
/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/
sessionId

Open session to close. Send this or tripId, not both.

string format: uuid
tripId

Partner trip id to close. Send this or sessionId, not both.

string
>= 1 characters

Example

{
"partnerId": "partner",
"endTime": "2026-10-15T10:45:00.000Z",
"sessionId": "0199e0a0-0000-7000-8000-000000000001"
}

Trip ended. An unknown sessionId is stored as already closed.

Media typeapplication/json
object
endTime
required

The time that was stored. A later call does not change it.

string format: date-time
endedBy
required

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.

string
Allowed values: partner phone silence
sessionId
required
string format: uuid
tripId
string

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.
Media typeapplication/json
object
error
required

Stable error code. No stack trace.

string

Example

{
"error": "invalid_body"
}
401The server key is missing or wrong.
Media typeapplication/json
object
error
required

Stable error code. No stack trace.

string

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.
Media typeapplication/json
object
error
required

Stable error code. No stack trace.

string

Example

{
"error": "forbidden"
}
404Unknown `tripId`.
Media typeapplication/json
object
error
required

Stable error code. No stack trace.

string

Example

{
"error": "not_found"
}
409More than one open session for that `tripId`.
Media typeapplication/json
object
error
required

Stable error code. No stack trace.

string

Example

{
"error": "ambiguous_trip"
}