A TrueToForm Pro plan account with API access. Contact [email protected] in order to get your unique Share Code, API key, and Access Token.
**Make sure to keep your Access Token secret and secure! Anyone with this token will be able to access your account data.
Use of the Headless Session API requires design approval of TrueToForm branding where the session links are being shared with your users.
If you do not want to use the provided widget UI (see widget integration guide), you can use this Headless Session API in order to create new scan sessions and fetch data associated with each session. Each scan session generates a unique link that your users can use in order to create a new scan or share an existing scan with you.
In order to create a new scan session, use the following REST API. Fill in your Access Token as a header in your request and provide the expiration duration for the session. After a session expires, the user can no longer use the session link and the session data will not update.
curl -X POST <https://api.truetoform.fit/v1/sessions> -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" -H "Content-Type: application/json" -d '{"expirationDuration": 7200}'
Field | Type | Required | Description |
---|---|---|---|
expirationDuration | number | No | Session duration in seconds. Must be between 2 hours (7200s) and 90 days (7776000s). Defaults to 2 hours. |
{
"sessionId": "ses-widget-xxx",
"deep_link": "<https://widget.truetoform.fit/>...",
"actions": [
{
"name": "getStatus",
"route": "/v1/sessions/{sessionId}/status",
"method": "GET",
"usable_now": true
}
]
}
Use this REST API endpoint to monitor a session's progress and scan status.
curl <https://api.truetoform.fit/v1/sessions/{sessionId}/status> -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"