Skip to main content

Logout

Logging users out

Contents

Overview

  • Call name: logout
  • Endpoint URL: https://{API hostname}/auth/logout
  • Request methods: DELETE
  • Response Content-Type: application/json
  • Auth required: yes

This endpoint allows a user to log out of the Spaaza system by destroying their current session. When called with a valid session key in the headers, it invalidates that session, effectively logging the user out of the system.

Version-specific information

The following version-specific changes apply to this endpoint. See the versioning page for more details.

VersionChange details
N/AN/A

Permissions and Authentication

This API call requires:

  • A valid session key in the HTTP headers
  • No specific user permissions are required beyond having a valid session

Headers

The following headers must be passed to the API call:

ParameterDescription
X-Spaaza-Session-Key(mandatory) A valid session key for the user logging out. Must be a properly formatted session key string.
X-Spaaza-Session-User-Id(mandatory) The user ID associated with the session. Must be a valid integer between 1 and 9999999999.

HTTP Parameters

No specific parameters are required for this endpoint.

Sample request

DELETE /auth/logout

Headers:
X-Spaaza-Session-Key: a1b2c3d4e5f6g7h8i9j0...
X-Spaaza-Session-User-Id: 12345

No request body is required for this DELETE request.

Sample response

Returns an OK code and information about the logged out user:

{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"result_type": "logout",
"username": "user@example.com"
}
}

Possible error responses

The following represents a list of possible error responses for the logout endpoint:

CodeName and DescriptionHTTP Status Code
4http_request_method_not_allowed
This HTTP method is not allowed for this API call
405
6no_valid_session
The user needs to be logged in and a valid session key needs to be sent
401
228auth_method_invalid
The given auth_method parameter has an invalid value
401
330server_error
Unexpected server error
500