How to get Access token to Access APIs?

I want to get device details by calling SmartThings API from my Web Application. I have generated personal access token by logging into SmartThing Account.
Is there any API to create and refresh access token?
What is the expiry of token?

I want to call API in a web job to collect the device data and make a report.

Hi, @Swati_Goswami welcome to the Community!!

You might want to check the Devices API.


Personal Access Tokens don’t expire, so you can use them for as long as their granted scopes are up-to-date to the API specs.

Also, just for reference, you created the PAT at account.smartthings.com/tokens, right?

Yes.

Also wanted to verify if i am going in right direction by consuming API (http calls from my web application) to get the device list.
Do i need to create any Smart App? little confused between API and Smart App use cases…

1 Like

Very well, thanks for the confirmation.

SmartApp Tokens are bound to a location context, i.e., you can only access items and installations that exist on the location where the SmartApp was installed, and one advantage of them is that you can integrate context-based APIs and features, such as Subscriptions and Schedules.

On the other hand, a Personal Access Token provides you access to your whole SmartThings ecosystem, which in my opinion is mostly useful for maintenance of your integrations e.g. to update the OAuth parameters of an ST Schema Integration or to patch the OAuth Scopes of a SmartApp Automation/Connector.

So, you may need to interact with both at some point, but for implementation purposes, I recommend you using SmartApp Tokens.