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 “Send Measurements” button 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. |
origin | string | No | Origin URL where the new session is created. This is used as the redirectUrl for the new widget session. Defaults to the first whitelisted domain URL for your account. |
{
"sessionId": "ses-widget-xxx",
"deep_link": "<https://web.truetoform.fit/>...",
"widgetUrl": "<https://widget.truetoform.fit/>...",
"actions": [
{
"name": "getStatus",
"route": "/v1/sessions/{sessionId}/status",
"method": "GET",
"usable_now": true
}
]
}
Field | Type | Description |
---|---|---|
sessionId | string | Unique session identifier. A new sessionId is created for each session. |
deep_link | string | Deep link URL to launch the TrueToForm web scanning app. Any scans that are selected or created via this deep link URL will be associated with this sessionId. You can get the scan data using the REST API or webhook notifications (see documentation below). |
widgetUrl | string | URL to redirect users to the TrueToForm made-to-measure widget. The widget interface guides users to log in or scan the deep_link URL in order to select/create a new scan. This is the same widget interface that is launched by the “Send Measurements” button if you integrate the widget using the widget integration guide. |
actions | array | List of available REST API endpoints that can be used for this session (see documentation below). |
Use this REST API endpoint to monitor a session's progress and scan status.