DELETE /api/sessions/{session_id} Bearer

Delete Session

Permanently delete a PocketPaw chat session and all its associated messages. This action is irreversible and removes the session from the index and storage.

Overview

Permanently deletes a session and all its associated messages from the file store. This action cannot be undone.

Parameters

Path Parameters

session_id required
string

The unique identifier of the session to delete.

Response

status string

"ok" on successful deletion.

Terminal window
curl -X DELETE "http://localhost:8000/api/sessions/session_abc123" \
-H "Authorization: Bearer <token>"
const sessionId = "session_abc123";
const response = await fetch(`http://localhost:8000/api/sessions/${sessionId}`, {
method: "DELETE",
headers: { "Authorization": "Bearer <token>" }
});
const data = await response.json();
console.log(data);
import requests
session_id = "session_abc123"
response = requests.delete(
f"http://localhost:8000/api/sessions/{session_id}",
headers={"Authorization": "Bearer <token>"},
)
print(response.json())
{ "status": "ok" }
{ "detail": "Session not found" }
Request
curl -X DELETE "http://localhost:8000/api/sessions/{session_id}" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/sessions/{session_id}", {
  method: "DELETE",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.delete(
    "http://localhost:8000/api/sessions/{session_id}",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("DELETE", "http://localhost:8000/api/sessions/{session_id}", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response