Skip to main content

Refresh Token

Refresh an expiring JWT Bearer token to obtain a new one without re-authenticating with a username and password.

Endpoint​

POST /v2/auth/refresh

Request Body​

FieldTypeRequiredConstraintsDescription
tokenstringYesValid JWTThe current Bearer token to refresh
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Response​

Returns a new JWT Bearer token and its updated expiry time.

{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2026-05-07T20:00:00Z",
"userId": 4821
},
"errorCode": "",
"message": ""
}
FieldTypeDescription
tokenstringNew JWT Bearer token to use for subsequent requests
expiresAtdatetime (ISO 8601)UTC timestamp when the new token expires
userIdintegerInternal ECGrid user ID for the authenticated account
note

The original token is invalidated after a successful refresh. Update your stored token immediately with the value returned in data.token.

Code Examples​

curl -X POST "https://rest.ecgrid.io/v2/auth/refresh" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }'

See Also​

  • Login — obtain an initial Bearer token
  • Logout — invalidate the current session
  • Session — check the current token's session details