Legacy widget (generateWidgetSession)
Deprecation notice. This endpoint is deprecated. Planned deprecation date: 3 November 2026.
For existing integrations, POST /auth/generateWidgetSession keeps working today, and we will give notice well before any breaking change. Plan to migrate before the deprecation date: it takes a few minutes, and the migration notes on Implementation (Terra widget) cover the differences.
Terra accounts created after 3 September 2026 cannot use this endpoint. Calls return a 410 error pointing to the replacement, POST https://access.tryterra.co/api/widget/session.
1. Make an API Request
Make an API Request to the /auth/generateWidgetSession endpoint from your backend.
curl --request POST --url https://api.tryterra.co/v2/auth/generateWidgetSession \
--header 'dev-id: <YOUR-DEV-ID>' \
--header 'x-api-key: <YOUR-API-KEY> \
--header 'Content-Type: application/json' \
--data '{
"language": "en",
"reference_id": "my_first_connection",
"auth_success_redirect_url": "text",
"auth_failure_redirect_url": "text",
}'2. Parse the Widget URL from the JSON Response
The endpoint will generate a widget url in the response. Retrieve it by parsing "url" .
3. Open The Widget URL
Pass the retrieved "url" to your client side, and open it either in:
an in-app browser, if using a mobile app,
or a new tab, if using a web app
This will take your end user to the provider selection screen, the Terra authentication widget.



You can find a list of all your authenticated users in:
Or by using the /subscriptions endpoints
❌ Common Mistakes
Common Mistakes and Best Practices
Do not expose your API credentials. Instead, always call the
/authendpoints from your backend.Do not call the API from your frontend, as this will lead to a CORS error.
Do not use WebView or iFrame for the authentication flow. Using them poses security risks due to the invisible URL bar, meaning that the user cannot know the domain onto which they are entering their username & password. Providers may completely block authentication leading to an error during the flow. Instead, use a new tab or an in-app browser to open the URL returned by the
/authendpoints.
Last updated
Was this helpful?