/api/rke/session/delete

GET

Deletes an active RKE session, immediately invalidating the session ID and securely wiping the encryption key from memory.

Description

Immediately terminates an RKE session and securely erases the encryption key from memory. This is useful for:

  • Cleaning up sessions when communication with a Content Server is complete
  • Implementing logout functionality
  • Freeing session slots when approaching the maximum limit (16 sessions)
  • Security-conscious applications that want to minimize key exposure time
Automatic Cleanup

Sessions automatically expire after 1 hour (3600 seconds) and are periodically cleaned up. Manual deletion is only necessary if you want immediate cleanup or need to free session slots.

Parameters

session_id
string (query)
Required

The 32-character hexadecimal session ID to delete.

Format: 32 hexadecimal characters (a-f, 0-9)

Example: a1b2c3d4e5f67890a1b2c3d4e5f67890

Note: This is the session_id returned when you created the session with /api/rke/session.

Response

Response Properties (Success)

command string
Always "rke_session_delete".
success boolean
True if session was deleted successfully.
session_id string
The session ID that was deleted.

Example Response (Success)

{
  "command": "rke_session_delete",
  "success": true,
  "session_id": "a1b2c3d4e5f67890a1b2c3d4e5f67890"
}

Example Response (Error - Session Not Found)

{
  "error": true,
  "message": "Session not found",
  "code": 404,
  "session_id": "nonexistent00000000000000000000"
}

Examples

JavaScript (fetch)

const API_HOST = 'http://localhost:8080';

async function deleteRkeSession(sessionId) {
    const url = `${API_HOST}/api/rke/session/delete?session_id=${sessionId}`;
    const response = await fetch(url);
    const result = await response.json();

    if (result.success) {
        // Clear stored session data
        sessionStorage.removeItem('rke_session_id');
        sessionStorage.removeItem('rke_expires_at');
        console.log('Session deleted:', sessionId);
    } else {
        console.error('Failed to delete session:', result.message);
    }

    return result;
}

// Delete a session when done
const sessionId = sessionStorage.getItem('rke_session_id');
if (sessionId) {
    deleteRkeSession(sessionId);
}

cURL

# Delete a session
curl "http://localhost:8080/api/rke/session/delete?session_id=a1b2c3d4e5f67890a1b2c3d4e5f67890"

# Delete and verify
SESSION_ID="a1b2c3d4e5f67890a1b2c3d4e5f67890"
curl "http://localhost:8080/api/rke/session/delete?session_id=$SESSION_ID" | jq

Go

package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

const ApiHost = "http://localhost:8080"

type DeleteResponse struct {
    Command   string `json:"command"`
    Success   bool   `json:"success"`
    SessionID string `json:"session_id"`
}

func DeleteRkeSession(sessionId string) (*DeleteResponse, error) {
    url := fmt.Sprintf("%s/api/rke/session/delete?session_id=%s", ApiHost, sessionId)
    resp, err := http.Get(url)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    var result DeleteResponse
    json.Unmarshal(body, &result)
    return &result, nil
}

func main() {
    result, _ := DeleteRkeSession("a1b2c3d4e5f67890a1b2c3d4e5f67890")
    if result.Success {
        fmt.Println("Session deleted successfully")
    }
}

Related Endpoints

/api/rke/sessions

List all active sessions.

/api/rke/session

Create a new session.