Skip to content
中文

Claim a pairing and register the phone

Code Mode: praxis.sandbox.byod.pairings.claim.create

HTTP: POST /sandbox/v1/byod/pairings/{code}/claim

The phone’s own final step after the owner taps Allow: it registers the device and answers the device id, a one-time credential and the control socket url the app dials. This path carries no Praxis credential — the one-time code is what it is addressed by — so do not send an API key and never call it from server code. The claim is single use: the first successful call spends the code and a second call answers 404, as does an unknown or expired code, so the app must store the credential the moment it arrives because it is never shown again. Connect to socket_url with Authorization: Bearer <credential>; the socket speaks the phone channel (hello, ping/pong, act, result/error) and the device’s one connection is replaced if the app reconnects. Example: POST /sandbox/v1/byod/pairings/K7M4PQRS/claim with {platform:‘android’,name:‘Shelf phone’,model:‘23127PN0CC’,os_version:‘16’} returns {device_id:‘byd_0123456789abcdefghijklmno’,credential:’…‘,socket_url:‘wss://49982-byd0123456789abcdefghijklmno.sandbox.praxisusercontent.com/’}.

Signature

praxis.sandbox.byod.pairings.claim.create(args:{path:{code:string};body:{/** The device's platform. */ platform:"android"|"macos"|"linux";/** Display name to register the device with, 1 to 64 characters; omitted or empty becomes the placeholder My device, which the caller can change later. */ name?:string;/** The device model the app reports, at most 128 characters; it is display only and can be omitted. */ model?:string;/** The operating-system version the app reports, at most 64 characters; it is display only and can be omitted. */ os_version?:string;/** A stable key the app reads from the phone itself (Android: ANDROID_ID), 8 to 128 characters of letters, digits, underscore and hyphen; any other value answers I pattern: ^[A-Za-z0-9_-]+$ */ device_key?:string}}):Promise<{/** Device id, `byd_` followed by 26 lowercase hex characters; the caller uses it from now on wherever a sandbox id is used. */ device_id:string;/** The device credential, 32 random bytes as base64url, shown exactly once; store it in the phone's keystore and send it as Authorization: Bearer when dialing sock */ credential:string;/** The control socket to dial, wss://49982-byd<hex>.sandbox[-<env>].praxisusercontent.com/; connect with the credential in an Authorization: Bearer header. */ socket_url:string}>;

Parameters

NameInTypeRequiredDescription
codepathstringyesThe 8-character pairing code returned by createByodPairing. An unknown, spent or expired code answers 404.

Request body

RequiredContent typesDescription
yesapplication/json

Responses

StatusContent typesDescription
201application/jsonThe device is registered and this is the only time its credential is returned.
400INVALID_PARAMS: the body is missing, platform is not android, macos or linux. Fix the body and resend; the code is not spent by a refused claim.
404NOT_FOUND: no such pairing. The code is unknown, was already claimed, or has expired; the three are indistinguishable, so start a new pairing in the organization.