Endpoint #
PUT /wp-json/rtcl/v1/my/listing/renew
Description #
Renews an expired listing owned by the authenticated user and re-publishes it with a new expiry date.
Authentication #
π Required
This endpoint only works for authenticated users.
Request Headers #
| Header | Required | Description |
|---|---|---|
Authorization | β Yes | JWT token: Bearer <JWT_TOKEN> |
X-API-KEY | β Yes | API key from RTCL settings |
Content-Type | β Yes | application/json |
Request Body Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
listing_id | integer | β Yes | ID of the expired listing to renew |
Example Request Body #
{
"listing_id": 401
}
cURL Example #
curl -X PUT https://yourwebsite.com/wp-json/rtcl/v1/my/listing/renew \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key_here" \
-H "Authorization: Bearer your auth key" \
-d '{
"listing_id": 401
}'
Who Can Renew a Listing #
A listing can be renewed only if ALL conditions below are met:
- User is logged in (JWT authenticated)
- Listing exists
- Listing status is
rtcl-expired - Listing belongs to the logged-in user
- Renew feature is enabled in settings
- User is authorized by filters/hooks
What Happens on Renew #
When renewal succeeds:
- Listing status β
publish - New expiry date is calculated:
- Uses default expiry duration
- Or Never Expires if enabled
- Listing meta updated:
expiry_datenever_expires(if applicable)
Successful Response #
Status: 200 OK #
{
"expire_at": "25 February 2026 08:58",
"status": "publish"
}
Special Case β Never Expires #
{
"expire_at": "Never Expires",
"status": "publish"
}
Error Responses #
β User Not Logged In #
Status: 404
{
"code": "rtcl_rest_authentication_error",
"message": "You are not logged in.",
"data": {
"status": 404
}
}
β Listing Not Found #
Status: 404
{
"code": "rtcl_rest_authentication_error",
"message": "Listing not found.",
"data": {
"status": 404
}
}
β Renew Feature Disabled / Unauthorized #
Status: 403
{
"code": "rtcl_rest_authentication_error",
"message": "Unauthorized access.",
"data": {
"status": 403
}
}
β User Does Not Own Listing #
Status: 403
{
"code": "rtcl_rest_authentication_error",
"message": "You are not authorized to renew this listing.",
"data": {
"status": 403
}
}
β Listing Is Not Expired #
Status: 403
{
"code": "rtcl_rest_authentication_error",
"message": "Listing is not expired.",
"data": {
"status": 403
}
}
β Renewal Hook Error #
Triggered via:
do_action( 'rtcl_before_renew_listing', ... )
do_action( 'rtcl_after_renew_listing', ... )
Status: depends on hook error data
{
"code": "rtcl_rest_renew_error",
"message": "Custom renewal error message"
}