Endpoint #
POST /wp-json/rtcl/v1/logout
Description #
This endpoint logs out an authenticated user from the system and returns the user’s profile data.
Authentication is validated using API Key + JWT Bearer token
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 request body is required.
Example cURL Request #
curl -X POST https://your-site.com/wp-json/rtcl/v1/logout \
-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": {
"first_name": "John",
"last_name": "Doe",
"description": "",
"id": 1,
"isAdmin": true,
"email": "john@example.com",
"username": "john_doe",
"phone": "",
"whatsapp_number": "",
"website": "",
"locations": [],
"zipcode": "",
"address": "",
"latitude": "",
"longitude": "",
"pp_thumb_url": "https://example.com/uploads/avatar.jpg",
"membership": {
"is_expired": true,
"expired_at": "2025-09-03 06:58:12",
"remaining_ads": "63",
"posted_ads": "0",
"promotions": {
"featured": {
"ads": 19,
"validate": 20
},
"_top": {
"ads": 19,
"validate": 30
},
"_bump_up": {
"ads": 30,
"validate": 30
}
},
"free_ads": 0
},
"store": true
}
}
✔️ Indicates the logout process completed successfully.
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
}
}