Skip to main content

Device Initialization (OSCU)

The Device Initialization endpoint is used to authenticate and initialize an OSCU device with KRA eTIMS.

This is a mandatory first step after authentication and before submitting sales, purchases, stock, or items.

Endpoint


POST /selectInitOsdcInfo


Purpose

This API:

  • Authenticates the OSCU device
  • Verifies the taxpayer and branch
  • Returns the cmcKey (Communication Key)
  • Synchronizes taxpayer, branch, and device metadata

🔑 The returned cmcKey must be stored securely and reused in all subsequent OSCU requests.


Request Object: DeviceVerificationReq

Request Fields

FieldDescriptionTypeRequiredLength
tinTaxpayer PINCHAR✅ Yes11
bhfIdBranch IDCHAR✅ Yes2
dvcSrlNoDevice Serial NumberCHAR✅ Yes≤ 100

JSON Request Example

{
"tin": "A123456789Z",
"bhfId": "00",
"dvcSrlNo": "dvcv1130"
}

Response Object: DeviceVerificationRes

Top-Level Fields

FieldDescriptionType
resultCdResult code (000 = success)CHAR(3)
resultMsgResult messageCHAR
resultDtResponse timestampCHAR(14)

Taxpayer Information (InitTaxpayer)

FieldDescriptionType
tinTaxpayer PINCHAR
taxprNmTaxpayer NameCHAR
bsnsActvBusiness ActivityCHAR

Branch Information (InitBranch)

FieldDescriptionType
bhfIdBranch IDCHAR
bhfNmBranch NameCHAR
bhfOpenDtBranch Registration DateCHAR(8)
prvncNmCounty NameCHAR
dstrtNmSub-County NameCHAR
sctrNmTax LocalityCHAR
locDescLocation DescriptionCHAR
hqYnHead Office Flag (Y/N)CHAR(1)
mgrNmManager NameCHAR
mgrTelNoManager PhoneCHAR
mgrEmailManager EmailCHAR

Device Information (InitDevice)

FieldDescriptionType
dvcIdDevice IDCHAR
sdicIdSales Device Control Unit IDCHAR
mrcNoMRC NumberCHAR
cmcKeyCommunication KeyCHAR(255)

JSON Response Example

{
"resultCd": "000",
"resultMsg": "It is succeeded",
"resultDt": "20200226143124",
"data": {
"info": {
"tin": "A123456789Z",
"taxprNm": "Taxpayer1130",
"bsnsActv": "business",
"bhfId": "00",
"bhfNm": "Headquater",
"bhfOpenDt": "20200226",
"prvncNm": "NAIROBI CITY",
"dstrtNm": "WESTLANDS",
"sctrNm": "WON",
"locDesc": "Westlands Towers",
"hqYn": "Y",
"mgrNm": "manage1130_00",
"mgrTelNo": "0789001130",
"mgrEmail": "manage113000@test.com",
"dvcId": "9999911300000001",
"sdcId": "KRACU013000001",
"mrcNo": "WIS01000150",
"cmcKey": "f0b9831bd2334874b7ec815e40347bc4"
}
}
}

SDK Usage Examples

$init = $etims->selectInitOsdcInfo([
'tin' => getenv('KRA_TIN'),
'bhfId' => getenv('KRA_BHF_ID') ?: '01',
'dvcSrlNo' => getenv('DEVICE_SERIAL'),
]);

$cmcKey = $init['data']['info']['cmcKey'] ?? null;

if (!$cmcKey) {
throw new Exception('Initialization failed');
}

echo "CMC Key: $cmcKey\n";

Important Notes

  • This endpoint must be called at least once per device

  • Store cmcKey securely (environment variable or secrets manager)

  • Do not regenerate unless:

    • Device changes
    • Branch changes
    • KRA instructs re-initialization

Next Steps