Skip to content

Register a live connection

POST
/pair/identity
curl --request POST \
--url http://127.0.0.1:7700/api/pair/identity \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" }'

Tells the box which SpacetimeDB identity this caller holds, so the box vouches for it. After that, the answer reducer accepts approvals from that connection and records them under the caller’s name: the device’s name for a paired phone, box screen for the box’s own screen. Accepted from the box’s own screen, or from a paired device with its token. A phone can also send identity when it redeems its pairing code.

Media typeapplication/json
object
identity
required

The 64 hex characters of the SpacetimeDB identity, from identity.toHexString().

string
/^[0-9a-fA-F]{64}$/

Example

{
"identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}

The identity the box now vouches for, and the name it records answers under.

Media typeapplication/json
object
identity
string
name
string

Example

{
"identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"name": "My phone"
}

The identity is not 64 hex characters.

Media typeapplication/json
object
error
required

What went wrong

string

Example generated

{
"error": "example"
}

Not the box’s own screen, and no paired device’s token.

Media typeapplication/json
object
error
required

What went wrong

string

Example generated

{
"error": "example"
}

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