Skip to main content
POST
/
wp-json
/
getmcp
/
v1
/
admin
/
run-retention
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/admin/run-retention \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json'
{
  "deleted": {
    "call_logs": 12453,
    "analytics_daily": 18,
    "sessions": 7
  },
  "thresholds": {
    "log_retention_days": 30,
    "analytics_retention_days": 90
  }
}
Forces the log-retention cleanup to run immediately instead of waiting for the daily cron. Deletes call logs, daily-aggregated analytics rows, and stale MCP sessions older than the thresholds defined in plugin settings.
Useful right after lowering log_retention_days or analytics_retention_days on a busy site — without this, the freed-up rows would only be reclaimed at the next cron tick. Be aware that on huge tables the delete pass can run for several seconds; the request blocks until the cleanup completes.
Permission is gated on the WordPress core capability manage_options (not the plugin’s getmcp_manage_settings). This is intentional — the operation can be slow on large tables, so it stays restricted to site administrators.

Body

No body. Send an empty POST.
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/admin/run-retention \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json'
{
  "deleted": {
    "call_logs": 12453,
    "analytics_daily": 18,
    "sessions": 7
  },
  "thresholds": {
    "log_retention_days": 30,
    "analytics_retention_days": 90
  }
}

Response Fields

deleted
object
Per-table count of rows removed by this run.
deleted.call_logs
integer
Call-log rows deleted (older than log_retention_days).
deleted.analytics_daily
integer
Aggregated daily-analytics rows deleted (older than analytics_retention_days).
deleted.sessions
integer
Stale MCP session rows reclaimed.
thresholds
object
The retention thresholds in effect at the time of the run, mirroring the matching keys on the Settings endpoint.