Setup
setup stores the identity for this phone. It does not start recording.
Examples use partner and https://api.example.yas.
| Field | Required | Send |
|---|---|---|
partnerId |
yes | The id YAS issued for this partner |
apiBaseUrl |
yes | An absolute https URL with a host. Any other value rejects setup. |
driverId |
yes | Driver on this phone |
vehicleId |
yes | Vehicle for this shift |
consentVersion |
no | Version of the privacy notice the driver accepted. The app presents that notice. |
tokenProvider is a separate argument. It returns accessToken and expiresAt, or it fails. The SDK calls it off the main thread. Return without showing UI, because it also runs in the background. Request a token for the partnerId, driverId, and vehicleId from this setup. See Authentication.
Call setup on every cold start once the driver is known, including a relaunch by the system. Calling setup again with the same driver and vehicle replaces tokenProvider. Calling it with a different driver or vehicle while openTripId is set is rejected. Call endTrip for that trip first.
setup before registerAtLaunch is rejected. An empty partnerId, driverId, or vehicleId is rejected. Metadata is required and must not be empty. A value that is not JSON is rejected the same way. A rejected setup leaves state, openTripId, and the earlier setup unchanged. No call throws.
partnerMetadata is the set of fields agreed for this partner. Those names are not listed here.
import YasCapture
func driverAndVehicleKnown( driverId: String, vehicleId: String, partnerMetadata: [String: Any]) { YasCapture.shared.setup( YasConfig( partnerId: "partner", apiBaseUrl: "https://api.example.yas", driverId: driverId, vehicleId: vehicleId, consentVersion: "2026-09-01" ), metadata: partnerMetadata, tokenProvider: { completion in // completion(accessToken, expiresAt) // completion(nil, nil) on failure. } )}fun driverAndVehicleKnown( driverId: String, vehicleId: String, partnerMetadata: Map<String, Any>,) { YasCapture.setup( YasConfig( partnerId = "partner", apiBaseUrl = "https://api.example.yas", driverId = driverId, vehicleId = vehicleId, consentVersion = "2026-09-01", ), metadata = partnerMetadata, tokenProvider = { completion -> // completion(accessToken, expiresAt) // completion(null, null) on failure. }, )}Setup metadata
Section titled “Setup metadata”Metadata is required. Each partner agrees those field names with YAS. This reference stores the fields as sent and does not list them.
Values must be JSON: string, boolean, number, null, or a nested object or list. A Swift Date or Kotlin Instant is accepted and stored as an ISO-8601 UTC string. A non-JSON value or empty metadata rejects the call.
In a fare object, amount and currency may be omitted. If amount is present, it must be an integer. A float amount rejects the call. Android requires a supplied currency to be a lowercase ISO 4217 code, even without amount. iOS checks the currency only when amount is present.
tripId is your id for this job. Keep that id until endTrip. beginTrip returns sessionId. Store it with the booking.
Next: Trips.
