Get Original User's Token
After a user accesses or interacts with a linked account (such as a business sub-account or authorized user account), this endpoint restores the original session by returning the initial authentication token. It allows seamless switching back to the primary account without requiring the user to re-authenticate from scratch. This is particularly useful in multi-account management scenarios where session continuity and security must be preserved.
Endpoint
GET /api/auth/linked/return
Authentication
Bearer token required. Obtain via:
POST https://api.banking.netevia.dev/api/auth/v2
Include in header: Authorization: Bearer {token}
Token lifetime: 10 minutes. Refresh via POST /api/auth/refresh.
When to use
Use this endpoint when a user has switched into a linked account — for example, a business owner who accessed an authorized user's (subProfile) context — and now needs to return to their original session. It ensures the original authentication token is retrieved and up-to-date, reflecting the current authentication state without requiring a full re-authentication flow. This endpoint is essential in any partner integration that supports multi-account switching.
Response
200 OK
| Field | Type | Description |
|---|---|---|
token | string (nullable) | The original user's restored Bearer authentication token |
expiration | string (date-time) | ISO 8601 timestamp indicating when the returned token expires |
userId | integer (int32) | Unique identifier of the original user whose token was retrieved |
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiration": "2026-06-08T14:35:00Z",
"userId": 100234
}Error Codes
| Code | When it happens |
|---|---|
| 401 | Token missing, expired, or invalid — the current session cannot be validated |
| 403 | Insufficient permissions to perform a linked account return |
| 404 | No original session or linked session context found for the current token |
| 500 | Internal server error |
Common Mistakes
- Calling this endpoint without first having switched into a linked account — there must be an active linked session context associated with the current token.
- Not refreshing the returned token before it expires; the restored token has its own 10-minute lifetime and should be stored and refreshed as needed.
- Using the old token after a successful return — always replace the active token with the one returned in the response.
Related Endpoints
POST /api/auth/v2— Obtain an initial Bearer token using username, password, and partnerIdPOST /api/auth/refresh— Refresh an existing Bearer token before it expiresGET /api/auth/linked— Switch into a linked account to obtain a linked session token
Example
curl -X GET https://api.banking.netevia.dev/api/auth/linked/return \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"