Skip to content

Pair a phone

POST
/pair
curl --request POST \
--url http://127.0.0.1:7700/api/pair \
--header 'Content-Type: application/json' \
--data '{ "code": "7f3a9c21", "name": "My phone" }'

A phone trades a pairing code for its own device token. The code stops working once used. Keep the token; the box does not show it again. Open without a token.

Media typeapplication/json
object
code
required

The code from POST /pair/start.

string
name

A name for the phone, shown in the log when it answers. Default phone.

string
<= 40 characters

Example

{
"code": "7f3a9c21",
"name": "My phone"
}

The phone’s token.

Media typeapplication/json
object
token
required

The phone’s device token. Send it as Authorization: Bearer <token>.

string
device
required
object
id
string
name
string
box
required
object
id
string
name
string

Example generated

{
"token": "example",
"device": {
"id": "example",
"name": "example"
},
"box": {
"id": "example",
"name": "example"
}
}

The code is wrong, used or expired.

Media typeapplication/json
object
error
required

What went wrong

string

Example

{
"error": "bad or expired pairing code"
}

GurtOS is open source under the Apache License 2.0.Source code on GitHub.