Quickstart

This guide follows the recommended path to a first managed TRANSFER: configure the SDK, initialize the session, prepare journey and baggage data, then launch the operation. Steps 3–4 apply to transfer only — other managed operations skip journey preparation; see Managed BLE Operations. For onboarding credentials and UAT, see Partner Integration.

Step 1: Configure

Call configure once before SDK operations. On Android, use the Context overload so BLE and secure storage receive the application context.

  • Kotlin

  • Swift

BagIdSdk.configure(
    context = applicationContext,
    config = BagIdConfig(
        apiBaseUrl = "https://api.bagid.com",
        sourceAppKey = "your-issued-client-key",
        tokenProvider = { authService.getFederatedToken() },
        theme = BagIdTheme(primaryColor = "#003366"),
    ),
)
import BagIdSDK

BagIdSdk.shared.configureWithFederatedToken(
    apiBaseUrl: "https://api.bagid.com",
    sourceAppKey: "your-issued-client-key",
    federatedToken: federatedToken,
    theme: BagIdTheme(primaryColor: "#003366")
)

The token must come from the partner app’s identity system and match the BagID federation setup for the target environment.

Step 2: Initialize

initialize authenticates the SDK session and obtains the client certificate used by managed EBT operations.

  • Kotlin

  • Swift

when (val result = BagIdSdk.initialize()) {
    InitResult.Authenticated -> {
        // Ready for journey and managed EBT operations.
    }
    is InitResult.Unavailable -> {
        showError("BagID SDK is unavailable: ${result.reason}")
    }
}
let result = await BagIdSdk.shared.initialize()

switch onEnum(of: result) {
case .authenticated:
    break
case .unavailable(let unavailable):
    showError("BagID SDK is unavailable: \(unavailable.reason)")
}

Call initialize before journey preparation or managed operations. The SDK reuses stored session data when possible and calls the token provider again when re-authentication is needed.

Step 3: Load journey (TRANSFER only)

Load the journey before creating baggage or building a TRANSFER payload. Skip this step for CLEAR, readouts, nametag, and display-toggle operations.

  • Kotlin

  • Swift

val journey = BagIdSdk.loadJourney(
    LoadJourneyRequest.Bcbp(
        scanData = "M1DOE/JOHN  E...",
        airline = "WF",
    ),
).getOrThrow()
let journey = try await BagIdSdk.shared.loadJourneyBcbpOrThrow(
    scanData: "M1DOE/JOHN  E...",
    airline: "WF"
)

For airline-supplied journey payloads and planned non-DCS paths, see Journey Preparation.

Step 4: Create baggage (TRANSFER only)

Create or submit baggage through the supported DCS path. The returned Journey includes the baggageId needed by managed TRANSFER. Skip this step for other managed operations.

  • Kotlin

  • Swift

val updatedJourney = BagIdSdk.createBaggageTag(
    CreateBaggageTagRequest(
        journeyId = journey.journeyId,
        passengerList = selectedPassengers,
        slotNumber = selectedSlotIndex,
    ),
).getOrThrow()
let updatedJourney = try await BagIdSdk.shared.createBaggageTagOrThrow(
    request: CreateBaggageTagRequest(
        journeyId: journey.journeyId,
        passengerList: selectedPassengers,
        lpn: nil,
        slotNumber: selectedSlotIndex
    )
)

Use updatedJourney.baggage or updatedJourney.baggageSlots to select the baggage row for transfer.

Step 5: Launch TRANSFER

Launch a managed TRANSFER. The SDK handles BLE permissions, discovery, custody proof, authorization, connect/reconnect, and backend updates.

  • Kotlin

  • Swift

BagIdAndroidHost.startManagedBleFlowForResult(
    activity = activity,
    apiBaseUrl = "https://api.bagid.com",
    sourceAppKey = "your-issued-client-key",
    federatedToken = federatedToken,
    operation = "TRANSFER",
    payloadJson = transferPayloadJson,
)
import BagIdSDKUI

BagIdIosHost.presentManagedBleFlow(
    from: viewController,
    apiBaseUrl: "https://api.bagid.com",
    sourceAppKey: "your-issued-client-key",
    federatedToken: federatedToken,
    operation: "TRANSFER",
    payloadJson: transferPayloadJson
) { resultJson in
    handleManagedResult(resultJson)
}

TRANSFER payloads need baggageId, journeyId, and either a journey object or a displayTicket.

Other managed operations

For CLEAR, READ_BATTERY, READ_FIRMWARE, SEND_NAMETAG, HIDE_TICKET, and RESTORE_TICKET, use the same configure and initialize steps, then launch with the operation-specific payload. Journey load and baggage creation are not required.

Next steps