Authorization
SDK Open uses a connection-bound session model. The client submits an API key on Command WS. After validation, the runtime binds a session to the current WebSocket connection, and later business requests do not need to resend the token.
International API Key Policy
- Online API Keys: each app is limited to 5 devices. The limit is per app, not per API Key.
- Offline API Keys: contact service@czur.com to request a key. Obtaining a key does not itself mean PC activation is required; see PC Machine Activation.
Authorization Steps
- Open Command WS.
- Call
auth.create_session. - Receive
session_token,expires_in, andauth_context. - Call business methods on the same bound connection.
Create a Session
The CZUR provider requires an API key issued by the Open Platform. Put that API key in params.token. The sk-sq-v1-****42F8 value below is a partially masked API key used only to show the format.
The local mock provider is for local integration testing only. It accepts demo-token-42F8 and mock-token; these mock tokens cannot be used with the real CZUR provider.
{
"request_id": "req-auth-001",
"method": "auth.create_session",
"params": {
"token": "sk-sq-v1-****42F8"
},
"client": {
"source": "your-app",
"protocol_version": "2.0.0",
"trace_id": "trc-auth-001"
}
}A successful response includes the auth context. license_mode and entitlement_state vary by API key type and current PC machine activation state:
{
"request_id": "req-auth-001",
"code": 0,
"message": "ok",
"data": {
"session_token": "session-token-...",
"expires_in": 7200,
"auth_context": {
"is_valid": true,
"account_type": "svip_plus",
"license_mode": "offline_api_key",
"entitlement_state": "offline_unlocked",
"device_scope": [
{ "vid": 4660, "pid": 22136 }
],
"capabilities": [
"device.list",
"device.get",
"device.open",
"device.close",
"video.start",
"video.stop"
]
}
},
"ts": 1710000000
}Read the Auth Context
{
"request_id": "req-auth-ctx-001",
"method": "auth.get_context",
"params": {}
}auth_context.capabilities determines callable methods. device_scope determines which devices are accessible.
Refresh and Destroy Sessions
auth.refresh_session: refreshes the session bound to the current connection.auth.destroy_session: destroys the bound session and releases streams and opened devices owned by the connection.
Destroy a session:
{
"request_id": "req-auth-destroy-001",
"method": "auth.destroy_session",
"params": {}
}PC Machine Activation
PC machine activation is required only when you want to use Open SDK without a CZUR device. It activates the PC running the SDK, not a scanner. When using a CZUR device, no additional PC activation is required; a valid API Key, device authorization scope, and SDK entitlement checks still apply.
Obtaining an API Key and activating a PC are separate steps. When PC activation is needed, use either path below to activate the current PC and session. The API method name remains auth.activate_offline.
Option 1: Generate a PC activation code in the Open Platform console from the current PC's machine code, then activate the session bound to the current connection through auth.activate_offline:
{
"request_id": "req-offline-001",
"method": "auth.activate_offline",
"params": {
"auth_code": "CZUR-xxxx"
}
}Option 2: Open the local Admin site's Authorization page, find the session that requires activation, and scan the QR code shown on the page. Contact CZUR business staff to obtain the authorization mini program login account and activation quota.
The default Open Platform PC activation policy is for trial/testing: each Open Platform account can activate at most 2 different PCs, and activation codes are valid for 30 days by default. This is a PC activation limit, not a scanner count limit or the 5-device-per-app limit for Online API Keys. For more PCs, commercial rollout, or adjusted activation quota and validity, contact service@czur.com.
After success, the returned auth_context.entitlement_state reflects the current entitlement state.