Exchange an existing authentication token for a new one

Exchange Authentication Token

The POST /api/auth/x-token endpoint exchanges a valid existing Bearer token for a newly issued one. This allows integrations to maintain continuous, secure session access without forcing the user or service to re-enter credentials. If the provided token is invalid or expired, the request will fail with an appropriate error response.

Endpoint

POST /api/auth/x-token

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 your integration needs to proactively rotate an active token before it expires, extending the session without interruption. This is particularly useful in long-running workflows or background services where prompting for credentials is not feasible. It is distinct from the standard refresh flow (/api/auth/refresh) in that it performs a full token exchange rather than a lightweight renewal.

Query Parameters

ParameterTypeRequiredDescription
clientIdstringNoOptional client identifier used to associate the token exchange with a specific client context.

Response

200 OK

The response body is a plain string containing the newly issued Bearer token.

FieldTypeDescription
(body)stringThe new Bearer token to use for subsequent authenticated requests.
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwicGFydG5lcklkIjoicDAwMSIsImV4cCI6MTcwMDAwMDYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

Error Codes

CodeWhen it happens
400Missing required fields or validation error
401Token missing, expired, or invalid — the existing token could not be validated
403Insufficient permissions
404Resource not found
500Internal server error

Common Mistakes

  • Sending an already-expired token — this endpoint requires a currently valid token to perform the exchange; use /api/auth/v2 to obtain a fresh token if the current one has expired.
  • Omitting the Authorization: Bearer header entirely — the existing token must be passed in the header, not the request body.
  • Confusing this endpoint with /api/auth/refresh — use /api/auth/x-token when a full token exchange is needed; use /api/auth/refresh for a standard lightweight token renewal.

Related Endpoints

  • POST /api/auth/v2 — Obtain an initial Bearer token using username, password, and partnerId
  • POST /api/auth/refresh — Refresh an existing token using the standard renewal flow

Example

curl -X POST https://api.banking.netevia.dev/api/auth/x-token \
  -H "Authorization: Bearer YOUR_EXISTING_TOKEN" \
  -H "Content-Type: application/json"

With optional clientId query parameter:

curl -X POST "https://api.banking.netevia.dev/api/auth/x-token?clientId=your-client-id" \
  -H "Authorization: Bearer YOUR_EXISTING_TOKEN" \
  -H "Content-Type: application/json"
Query Params
string
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Response

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/plain
application/json
text/json