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'
import requests
response = requests.post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
headers={
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
)
print(response.json())
const response = await fetch(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
{
method: "POST",
headers: {
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
$response = wp_remote_post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
[
"headers" => [
"Authorization" => "Bearer gmcp_your_api_key",
"Content-Type" => "application/json",
],
]
);
$data = json_decode( wp_remote_retrieve_body( $response ), true );
{
"deleted": {
"call_logs": 12453,
"analytics_daily": 18,
"sessions": 7
},
"thresholds": {
"log_retention_days": 30,
"analytics_retention_days": 90
}
}
{
"code": "rest_forbidden",
"message": "Permission denied.",
"data": { "status": 403 }
}
Settings
Run Log Retention Now
Manually trigger the daily log-retention cleanup.
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'
import requests
response = requests.post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
headers={
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
)
print(response.json())
const response = await fetch(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
{
method: "POST",
headers: {
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
$response = wp_remote_post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
[
"headers" => [
"Authorization" => "Bearer gmcp_your_api_key",
"Content-Type" => "application/json",
],
]
);
$data = json_decode( wp_remote_retrieve_body( $response ), true );
{
"deleted": {
"call_logs": 12453,
"analytics_daily": 18,
"sessions": 7
},
"thresholds": {
"log_retention_days": 30,
"analytics_retention_days": 90
}
}
{
"code": "rest_forbidden",
"message": "Permission denied.",
"data": { "status": 403 }
}
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 emptyPOST.
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'
import requests
response = requests.post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
headers={
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
)
print(response.json())
const response = await fetch(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
{
method: "POST",
headers: {
"Authorization": "Bearer gmcp_your_api_key",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
$response = wp_remote_post(
"https://yoursite.com/wp-json/getmcp/v1/admin/run-retention",
[
"headers" => [
"Authorization" => "Bearer gmcp_your_api_key",
"Content-Type" => "application/json",
],
]
);
$data = json_decode( wp_remote_retrieve_body( $response ), true );
{
"deleted": {
"call_logs": 12453,
"analytics_daily": 18,
"sessions": 7
},
"thresholds": {
"log_retention_days": 30,
"analytics_retention_days": 90
}
}
{
"code": "rest_forbidden",
"message": "Permission denied.",
"data": { "status": 403 }
}
Response Fields
object
Per-table count of rows removed by this run.
integer
Call-log rows deleted (older than
log_retention_days).integer
Aggregated daily-analytics rows deleted (older than
analytics_retention_days).integer
Stale MCP session rows reclaimed.

