What are the headers and body styles in the st-schema

I made a stateCallback request with the st-oauth token I received from the callbackAccessHandler in st-scema, but the 401 error was exported even though it was a token I just received.
I requested the token again with the refresh token I received from callbackAccessHandler because it was expired

requestId: ‘8cec31a4-cf9e-4983-81a2-f5ab1be2803f’,
error: {
code: ‘InternalServiceError’,
message: Unexpected token 'g', "grant_type"... is not valid JSON
}
}

I keep getting these errors. How do I set the header and body?

Below is the body of the request.

  1. stateCallBack request Header, Body
    {
    headers: {
    ‘Authorization’: Bearer ${token},
    ‘Content-Type’: ‘application/json’,
    ‘Correlation-Id’: event-${Date.now()}
    }
    headers: {
    schema: ‘st-schema’,
    version: ‘1.0’,
    interactionType: ‘stateCallback’,
    requestId: event-${Date.now()}
    },
    deviceState: [
    {
    externalDeviceId: device_id,
    states: [
    { component: ‘main’, capability: ‘st.switch’, attribute: ‘switch’, value: state === ‘on’ ? ‘on’ : ‘off’ },
    { component: ‘detail’, capability: ‘st.humidifierMode’, attribute: ‘humidifierMode’, value: ‘high’ },
    { component: ‘detail’, capability: ‘st.relativeHumidityMeasurement’, attribute: ‘humidity’, value: 0 }
    ]
    }
    ]
    }

refreshToken request
{“headers” : {
“Content-Type”: “application/x-www-form-urlencoded”,
“schema”: “st-schema”,
“version”: “1.0”,
“interactionType”: “refresh_token”,
“grant_type”: “refresh_token”,
“refresh_token”: refreshToken,
“client_id” : clientId,
“client_secret”: clientSecret,
}

Hi @kea.damda

You can check the official documentation for details on cloud-connected devices and interaction types, including callback methods, at this link:

SmartThings Callback Documentation

This will guide you through the proper implementation of callbacks and related features.

Let me know if you have any further questions!