Endpoint #
GET /wp-json/rtcl/v1/listings
Description #
Returns a paginated list of published listings with support for advanced filtering including:
- Search keyword
- Categories & locations
- Price range
- Listing type
- Promotions
- Custom fields
- Radius (geo) search
- Sorting & pagination
Authentication #
This endpoint requires an authenticated user.
Authentication is validated via:
- API key
- Logged-in user check via authorization token
Unauthenticated requests will return 401 Unauthorized.
Query Parameters #
Basic Parameters #
| Parameter | Type | Default | Description |
|---|---|---|---|
search | string | – | Search keyword |
per_page | integer | 20 | Items per page (1–100) |
page | integer | 1 | Current page number |
order_by | string | – | Ordering method (handled internally) |
Taxonomy Filters #
| Parameter | Type | Description |
|---|---|---|
categories | array<int> | Category term IDs |
locations | array<int> | Location term IDs (only if location type is local) |
Example
categories[]=5&categories[]=9
locations[]=3
Price Filter #
| Parameter | Type | Description |
|---|---|---|
price_range | array | Min & Max price |
Example
price_range[]=100&price_range[]=500
Listing Type #
| Parameter | Type | Description |
|---|---|---|
listing_type | string | Listing type key (sell, buy, etc.) |
Promotion Filters #
| Parameter | Type | Description |
|---|---|---|
promotion_in | array<string> | Include promotions |
promotion_not_in | array<string> | Exclude promotions |
disable_top_listings | boolean | Disable top listings |
Example
promotion_in[]=featured
promotion_not_in[]=_top
Custom Fields Filter #
| Parameter | Type | Description |
|---|---|---|
custom_fields | object / JSON | Filter by custom fields |
Supports:
- Text
- Number (range)
- Checkbox / Select / Radio
- Date / Date range
Example (JSON)
{
"bedrooms": [2,4],
"furnished": "yes"
}
Radius (Geo) Search #
| Parameter | Type | Description |
|---|---|---|
radius_search | object / JSON | Search by distance |
Required keys
distancelatitudelongitude
Example
{
"distance": 20,
"latitude": 23.8103,
"longitude": 90.4125
}
Example Request #
CURL #
curl -X GET "https://example.com/wp-json/rtcl/v1/listings?per_page=10&page=1&categories[]=5&price_range[]=100&price_range[]=500" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response Structure #
{
"pagination": {
"total": 31,
"count": 20,
"per_page": 20,
"current_page": 1,
"total_pages": 2
},
"data": [
{
"listing_id": 123,
"author_id": 1,
"title": "Sample Listing",
"price": "250",
"categories": [
{
"term_id": 20,
"name": "Dogs",
"slug": "dogs",
"term_group": 0,
"term_taxonomy_id": 20,
"taxonomy": "rtcl_category",
"description": "",
"parent": 0,
"count": 4,
"filter": "raw"
}
],
"contact": {
"locations": [
{
"term_id": 16,
"name": "California",
"slug": "california",
"term_group": 0,
"term_taxonomy_id": 16,
"taxonomy": "rtcl_location",
"description": "lorem ipsum lorem ipsum lorem ipsum lorem ipsum",
"parent": 0,
"count": 8,
"filter": "raw"
},
{
"term_id": 80,
"name": "Bakersfield",
"slug": "bakersfield",
"term_group": 0,
"term_taxonomy_id": 80,
"taxonomy": "rtcl_location",
"description": "",
"parent": 16,
"count": 5,
"filter": "raw"
}
],
"latitude": "",
"longitude": "",
"hide_map": false,
"zipcode": "",
"address": "",
"phone": "36532327434",
"whatsapp_number": "",
"email": "techlabpro15@gmail.com",
"website": "",
"geo_address": ""
},
"promotions": [
"_top"
]
}
]
}
HTTP Status Codes #
| Code | Meaning |
|---|---|
200 | Success |
400 | Invalid parameters |
401 | Unauthorized |
403 | Permission denied |
500 | Server error |
Notes #
- All filters are optional
- Multiple filters can be combined
- Supports extensibility via WordPress filters:
rtcl_rest_response_listings_argsrtcl_cf_sub_meta_queriesrtcl_rest_listing_query_geo_query