Skip to content

Reference

OAuth2 Clients

REST API reference for OAuth2 Clients: manage the OAuth2 clients registered on an instance. 5 operations.

Reference2 min read

For the base URL, authentication and errors, see the REST API overview.

GET /v1/oauth_clients ​

  • Request: GET /v1/oauth_clients
  • Operation: ListOauthClients
  • Operation ID: OauthClient_List
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Example request

bash
curl 'https://YOUR_SERVER/v1/oauth_clients' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

Response example (200)

json
[
  {
    "created": 1792263090752,
    "description": "Mobile and web app of Example",
    "enabled": true,
    "modified": 1792263090752,
    "name": "Example App",
    "oauth_client": "example_app"
  }
]

POST /v1/oauth_clients ​

  • Request: POST /v1/oauth_clients
  • Operation: CreateOauthClient
  • Operation ID: OauthClient_Create
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
descriptionstringno
enabledbooleannoDisabled clients cannot authorize nor get tokens.
namestringyesApplication name shown on the consent screen.
oauth_clientstringyesPattern: ^[a-zA-Z0-9-_]{1,32}$Client id used by the application in the OAuth2 flows (authorization code, device flow).
picturestringnoLogo shown on the consent screen, as a data URL.
promptstringnoText of the consent screen.
redirect_uristringyesAllowed redirect URIs, one per line (newline separated). The redirect_uri of each request must match one of them exactly (case-insensitive).
scopeobjectnoPermissions requested for the application, as a permission tree ({"Device": {"*": ["ReadDevice"]}}). Informational: the token scope comes from the authorize request.
secretstringyesClient secret. Stored as is and returned to admins.

Example request: Web application

bash
curl -X POST 'https://YOUR_SERVER/v1/oauth_clients' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "description": "Mobile and web app of Example",
  "enabled": true,
  "name": "Example App",
  "oauth_client": "example_app",
  "prompt": "Example App wants to read your devices",
  "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback",
  "scope": {
    "Device": {
      "*": [
        "ListDevices",
        "ReadDevice"
      ]
    }
  },
  "secret": "change-this-long-random-secret"
}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/oauth_clients/{oauth_client} ​

  • Request: GET /v1/oauth_clients/
  • Operation: ReadOauthClientConfig
  • Operation ID: OauthClient_ReadConfig
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
oauth_clientpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

Response example (200, Web application)

json
{
  "created": 1792263090752,
  "description": "Mobile and web app of Example",
  "enabled": true,
  "modified": 1792263090752,
  "name": "Example App",
  "oauth_client": "example_app",
  "prompt": "Example App wants to read your devices",
  "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback",
  "scope": {
    "Device": {
      "*": [
        "ListDevices",
        "ReadDevice"
      ]
    }
  },
  "secret": "change-this-long-random-secret"
}

PUT /v1/oauth_clients/{oauth_client} ​

  • Request: PUT /v1/oauth_clients/
  • Operation: UpdateOauthClient
  • Operation ID: OauthClient_Update
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
oauth_clientpathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
descriptionstringno
enabledbooleanno
namestringno
picturestringno
promptstringno
redirect_uristringno
scopeobjectno
secretstringno

Example request: Full Update

bash
curl -X PUT 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "description": "Mobile and web app of Example",
  "enabled": true,
  "name": "Example App",
  "oauth_client": "example_app",
  "prompt": "Example App wants to read your devices",
  "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback",
  "scope": {
    "Device": {
      "*": [
        "ListDevices",
        "ReadDevice"
      ]
    }
  },
  "secret": "change-this-long-random-secret"
}'

Example body: Update 'description'

json
{
  "description": "Mobile and web app of Example"
}

Example body: Update 'enabled'

json
{
  "enabled": true
}

Example body: Update 'name'

json
{
  "name": "Example App"
}

Example body: Update 'prompt'

json
{
  "prompt": "Example App wants to read your devices"
}

Example body: Update 'redirect_uri'

json
{
  "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback"
}

Example body: Update 'scope'

json
{
  "scope": {
    "Device": {
      "*": [
        "ListDevices",
        "ReadDevice"
      ]
    }
  }
}

Example body: Update 'secret'

json
{
  "secret": "change-this-long-random-secret"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

DELETE /v1/oauth_clients/{oauth_client} ​

  • Request: DELETE /v1/oauth_clients/
  • Operation: DeleteOauthClient
  • Operation ID: OauthClient_Delete
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
oauth_clientpathstringyes

Example request

bash
curl -X DELETE 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden