Mojo UpDocs
API reference

Devices

Ask to enrol a device

POST/relay/v1/device/code

A workbench or node asks to join an organisation (RFC 8628 device authorisation). Show the person user_code and verification_uri; someone approves it in the console (a node waits for a person allowed to approve nodes). Then poll /relay/v1/device/token. Send dpop_jkt to have the tokens bound to a key (DPoP, RFC 9449).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/relay/v1/device/code" \  -H "Content-Type: application/json" \  -d '{    "workspaceId": "string",    "name": "string"  }'
{  "device_code": "string",  "user_code": "string",  "verification_uri": "http://example.com",  "verification_uri_complete": "http://example.com",  "interval": 1,  "expires_in": 1}
POST/relay/v1/device/token

Poll at the interval the code came with. Polling faster gets slow_down. With a DPoP-bound request, send a DPoP proof header.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/relay/v1/device/token" \  -H "Content-Type: application/json" \  -d '{    "device_code": "string"  }'
{  "access_token": "string",  "refresh_token": "string",  "expires_in": 1,  "token_type": "Bearer",  "device_id": "string",  "scope": "string"}
POST/relay/v1/device/join

A node joins with a key an administrator created, instead of waiting for someone to approve a code. The administrator who created the key is recorded as its approver.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/relay/v1/device/join" \  -H "Content-Type: application/json" \  -d '{    "key": "stringstri",    "manifest": {      "schemaVersion": 1,      "nodeId": "string",      "name": "string",      "kind": "node",      "owner": {        "type": "user"      }    },    "name": "string"  }'
{  "access_token": "string",  "refresh_token": "string",  "expires_in": 1,  "token_type": "Bearer",  "device_id": "string",  "scope": "string"}
POST/relay/v1/token

Exchange a device refresh token for a new access token. DPoP-bound tokens need a DPoP proof header.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/relay/v1/token" \  -H "Content-Type: application/json" \  -d '{    "refresh_token": "string"  }'
{  "access_token": "string",  "refresh_token": "string",  "expires_in": 1,  "token_type": "Bearer",  "device_id": "string",  "scope": "string"}