Endpoint #
GET /wp-json/rtcl/v1/my/chat/check
Description #
Check whether a conversation already exists between the logged-in user and the listing owner for a specific listing.
Authentication & Permission #
This endpoint is protected and requires:
- REST API enabled (
allow_rest_api) - Valid API Key
- Valid JWT/Bearer authentication
Required Headers #
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_JWT_TOKEN |
| X-API-KEY | YOUR_API_KEY |
| Content-Type | application/json |
Query Parameters #
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| listing_id | integer | ✅ Yes | — | Listing ID |
| per_page | integer | ❌ No | 50 | Messages per page |
| page | integer | ❌ No | 1 | Current page |
Example Request (cURL) #
curl -X GET "https://example.com/wp-json/rtcl/v1/my/chat/check?listing_id=401&per_page=20&page=1" \
-H "Authorization: Bearer DEMO_JWT_TOKEN" \
-H "X-API-KEY: DEMO_API_KEY"
Success Response – Conversation Exists (200) #
{
"con_id": 101,
"listing": {
"id": 5001,
"title": "Modern Family House for Rent",
"url": "https://demo-site.com/listing/modern-family-house",
"images": [
{
"ID": 9001,
"title": "house-front-view",
"caption": "",
"url": "https://demo-site.com/uploads/house-front.jpg",
"alt": "House Front View",
"src": "https://demo-site.com/uploads/house-front-924x462.jpg",
"srcset": false,
"sizes": {
"full": {
"src": "https://demo-site.com/uploads/house-front.jpg",
"width": 1170,
"height": 640
},
"medium": {
"src": "https://demo-site.com/uploads/house-front-medium.jpg",
"width": 300,
"height": 164
},
"thumbnail": {
"src": "https://demo-site.com/uploads/house-front-thumb.jpg",
"width": 150,
"height": 82
}
},
"mime_type": "image/jpeg",
"src_w": 870,
"src_h": 435,
"srcset_sizes": "(max-width: 870px) 100vw, 870px"
}
],
"amount": "<div class=\"rtcl-price\"><span>$1,500</span></div>",
"raw_price": "1500",
"location": [],
"category": [
{
"term_id": 10,
"name": "Houses",
"slug": "houses",
"taxonomy": "rtcl_category"
}
]
},
"unread_count": 1,
"sender": {
"id": 200,
"name": "Demo User",
"email": "demo.user@example.com",
"phone": "+1234567890",
"whatsapp": "+1234567890",
"website": "https://demo-user.com",
"profile_picture": "https://demo-site.com/avatar/user.png"
},
"recipient": {
"id": 300,
"name": "Listing Owner",
"email": "owner@example.com",
"phone": "+0987654321",
"whatsapp": "+0987654321",
"website": "https://listing-owner.com",
"profile_picture": "https://demo-site.com/avatar/owner.png"
},
"listing_id": 5001,
"sender_id": 200,
"recipient_id": 300,
"sender_delete": false,
"recipient_delete": false,
"last_message_id": 8001,
"sender_review": false,
"recipient_review": false,
"invert_review": false,
"created_at": "2026-01-01 10:00:00",
"updated_at": "2026-01-01 10:05:00",
"last_message": "Is this house still available?",
"last_message_created_at": "2026-01-01 10:05:00",
"messages": [
{
"message_id": "8001",
"con_id": "101",
"source_id": "200",
"type": "text",
"message": "Is this house still available?",
"attachments": null,
"meta": null,
"is_read": "0",
"created_at": "2026-01-01 10:05:00"
}
],
"pagination": {
"total": 1,
"per_page": 50,
"current_page": 1,
"total_pages": 1
}
}
Success Response – No Conversation Found (200) #
false
This means no previous chat exists between the visitor and listing owner for this listing.
Error Responses #
Not Logged In (403) #
{
"code": "FORBIDDEN",
"message": "You are not logged in.",
"data": {
"status": 403,
"temp_id": ""
}
}
Invalid Listing or Self Chat Attempt (403) #
Returned when:
- Listing does not exist
- User is the listing author
- User is not allowed to chat on this listing
{
"code": "FORBIDDEN",
"message": "You are not permitted to access this conversation.",
"data": {
"status": 403,
"temp_id": ""
}
}
REST API Disabled (403) #
{
"code": "DENIED_REST_API",
"message": "Denied api call"
}
Missing / Invalid Authentication (401) #
{
"status": "error",
"error": "INVALID_API_KEY",
"code": "401",
"error_message": "Invalid API key or authorization token."
}
Missing Authorization Header #
{
"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 Token Type #
{
"status": "error",
"error": "INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE",
"code": "401",
"error_message": "Authorization header must be type of Bearer Token."
}
Invalid JWT Format (Segment Fault) #
{
"status": "error",
"error": "SEGMENT_FAULT",
"code": "401",
"error_message": "Incorrect JWT Format."
}
Invalid JWT Signature #
{
"status": "error",
"error": "INVALID_TOKEN",
"code": "401",
"error_message": "JWT signature verification failed."
}