Endpoint #
POST /wp-json/rtcl/v1/account-delete
Description #
This endpoint allows an authenticated user to permanently delete their own account.
The request requires both API Key validation and JWT authentication.
Required Request Headers #
| Header | Required | Description |
|---|---|---|
Content-Type | ✅ Yes | application/json |
x-api-key | ✅ Yes | REST API access key |
Authorization | ✅ Yes | Bearer {JWT_TOKEN} |
Request Body #
No body parameters are required.
Example cURL Request #
curl -X POST https://your-site.com/wp-json/rtcl/v1/account-delete \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY_HERE" \
-H "Authorization: Bearer YOUR_JWT_TOKEN_HERE"
Success Response #
HTTP Status Code #
200 OK
Response Body #
{
"user_id": 123
}
✔️ Indicates the user account was successfully deleted.
Error Responses #
❌ API Access Disabled #
Status: 403 Forbidden
{
"code": "DENIED_REST_API",
"message": "Denied api call",
"data": {
"status": 403
}
}
❌ Missing Authorization Header #
Status: 401 Unauthorized
{
"status": "error",
"error": "MISSING_AUTHORIZATION_HEADER",
"code": "401",
"error_message": "Authorization header not received. Either authorization header was not sent or it was removed by your server due to security reasons."
}
❌ Invalid Authorization Header Type #
Status: 401 Unauthorized
{
"status": "error",
"error": "INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE",
"code": "401",
"error_message": "Authorization header must be type of Bearer Token."
}
❌ Invalid JWT Format #
Status: 401 Unauthorized
{
"status": "error",
"error": "SEGMENT_FAULT",
"code": "401",
"error_message": "Incorrect JWT Format."
}
❌ User Not Logged In #
Status: 403 Forbidden
{
"code": "rest_user_not_logged_in",
"message": "You are not logged in.",
"data": {
"status": 403
}
}
❌ Account Deletion Failed #
Status: 500 Internal Server Error
{
"code": "rtcl_rest_user_cannot_delete",
"message": "Could not delete user.",
"data": {
"status": 500
}
}