Cloud connected devices access token will be revoked if all devices are deleted?

Interaction Types of Cloud Connected Devices didn’t offer deleting devices, so I use "DELETE https://api.smartthings.com/v1/devices/{deviceId} API to realize it.

I found that if I deleted all devices through this API, my account(service) linking will be deleted and the access token I got from Reciprocal Access Token will be revoked too.

Actually not only through device deleting API, if I deleted all devices in SmartThings APP or deleted all devices in SmartThings console, it has the same result that my service link and access token will be revoked.

Then If I send Discovery Callback I saw 401 error status code and the body is like this:

{
    "headers": {
        "schema": "st-schema",
        "version": "1.0",
        "interactionType": "stateCallback",
        "requestId": "2EA4125F2FB4D93086A"
    },
    "globalError": {
        "errorEnum": "INVALID-TOKEN",
        "detail": "access token provided is revoked"
    }
} 

Is that normal if I delete all devices then my service link and access token will be revoked? Seems currently SmartThings behavior is like what I found.

Is there any way to prevent the service link and access token from being revoked if the device are all deleted?

Yes, the Refresh Token to update the Reciprocal Token is valid until you delete the integration or there are no devices to handle. In this case, you need to log in again to your OAuth provider and request a new Token.

If the service stayed available without any linked device, we would be generating unnecessary network traffic which impacts the cloud fees considerably on both sides.

1 Like
Hi! Can you provide more details about what you’re trying to achieve?
I understand that you installed the device through ST Schema but then, deleted it for some reason, and later, you tried to discover the same device again.

After OAuth signing in our APP, our APP can do Discovery Callback to add devices in SmartThings APP so that both our APP and SmartThings APP devices are synchronized.
If our users delete devices in our APP, we will delete APP in SmartThings as well through SmartThings API.
But users didn’t know SmartThings has the mechanism that SmartThings will revoke the service link if the devices are all deleted in SmartThings APP. They may think it is as usual the new device will be added in SmartThings APP. You didn’t mention this mechanism in the document.

Thank you for the feedback, I’ll report this to the corresponding team.

If the users want to keep receiving updates from your cloud, they need to leave at least one device discovered by the related ST Schema.
If they delete the devices, their configuration and automation will be removed as well and they will have to reconfigure them.