Skip to main content

sessionRegisterDevice Mutation

Description

Registers a device for point-of-sale (POS) access. Requires a valid session token from an existing authenticated session. The token should include both the JWT and config reference, separated by a pipe character. Deletes any existing registrations for the same device ID. Returns a device registration session that can be used for POS authentication.

mutation sessionRegisterDevice(
$token: String!
$deviceName: String!
$deviceId: String!
) {
sessionRegisterDevice(
token: $token
deviceName: $deviceName
deviceId: $deviceId
) {
_id
configRef
type
user {
_id
firstName
lastName
name
email
addedAt
type
hasIntercom
hasPasscode
passwordToken
lastLogin
}
jwt
expires
createdAt
origin
adminDomains {
_id
siteName
active
domainName
}
shopName
admins {
_id
email
name
avatar
hasPasscode
}
deviceName
deviceId
mfa
ip
}
}

Variables

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
"deviceName": "deviceName",
"deviceId": "deviceId"
}

Response

{
"sessionRegisterDevice": {
"_id": "a3d970fa28aa9fdb39efe083",
"configRef": "69de64ede67db27a326e9475",
"type": "example",
"user": {
"_id": "53235072a8b4ff9d6bb1ae53",
"firstName": "example",
"lastName": "example",
"name": "example",
"email": "email@example.com",
"addedAt": 1750987002786,
"type": "example",
"hasIntercom": true,
"hasPasscode": true,
"passwordToken": "example",
"lastLogin": 1741042391939
},
"jwt": "example",
"expires": 1716234231267,
"createdAt": 1741501591925,
"origin": "example",
"adminDomains": [
{
"_id": "1bf29557924e6cae4024d844",
"siteName": "example",
"active": true,
"domainName": "example"
}
],
"shopName": "example",
"admins": [
{
"_id": "7a5fa0dad7599061124d676e",
"email": "email@example.com",
"name": "example",
"avatar": "example",
"hasPasscode": true
}
],
"deviceName": "example",
"deviceId": "example",
"mfa": true,
"ip": "example"
}
}

Arguments

NameTypeDescription
tokenString!Registration token containing the JWT and config reference, separated by a pipe character (format: "jwt
deviceNameString!Display name for the device (e.g., "POS Terminal 1", "iPad Store").
deviceIdString!Unique identifier for the device. Used to ensure only one registration exists per device.

Returns

Session