Install Device API giving 403 error

Hi everyone!

I am facing issue while using the Install Device API mentioned here: API | SmartThings Developers

This is the curl POST request:

curl --location ‘https://api.smartthings.com/v1/devices
–header ‘Content-Type: application/json’
–header ‘Authorization: Bearer 8dd20bef-809d-4a5d-aaba-7c69b1c0ad8c’
–data ‘{
“locationId”: “ef1556d0-1da2-4eb2-b785-f316d47fcd9f”,
“app”: {
“profileId”: “3d0e8456-d0e2-4939-9c2b-b9f3b97bb657”,
“installedAppId”: “978f54f4-f65f-42a7-ac99-5dc461f7cd6c”
},
“label”: “shubham_bulb”
}’

I am getting 403: Forbidden error when I hit this. PAT used here have all the necessary permissions. I can access all other APIs using the same token.

profile id refers to the Device Profile created on the developer portal

installed application id refers to the deployed application on the same portal.

Can anyone help what is the issue? I am facing issue only in this API.

I’ve never tried this myself and I may be wrong, but I thought that creating a SmartApp managed device required an app token from that SmartApp, and not a PAT.

any idea how to generate this token?

The idea is that when a user asks to create a device in the mobile app the configuration pages are requested from your app and when the user submits the configuration your SmartApp uses the access token in the installation request to create the device.

Get Started with Cloud Connected Devices | Developer Documentation | SmartThings describes the flow, though the diagram seems rather broken.