Skip to main content

Logout

Invalidate the current Bearer token or API session, ending the authenticated session immediately.

Endpoint

POST /v2/auth/logout

Request Body

No request body is required. The session is identified from the Authorization or X-API-Key header on the request.

Response

Returns a success confirmation. After a successful logout, the token or session used to make this call is no longer valid.

{
"success": true,
"data": null,
"errorCode": "",
"message": "Session terminated."
}
caution

After calling logout, any subsequent requests using the same token will receive a 401 Unauthorized response. If you are using API Key authentication, logout terminates the current session but does not revoke the key itself.

Code Examples

curl -X POST "https://rest.ecgrid.io/v2/auth/logout" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "success": true, "data": null, "errorCode": "", "message": "Session terminated." }'

See Also

  • Login — start a new session
  • Refresh Token — extend an active session before logout
  • Session — inspect the current session before logging out