Endpoint #
POST POST /wp-json/rtcl/v1/login
Description #
This endpoint authenticates a user using username/email and password and returns a JWT Bearer token along with the authenticated user’s profile data.
Required Request Headers #
| Header | Required | Description |
|---|---|---|
Content-Type | ✅ Yes | application/json |
x-api-key | ✅ Yes | REST API access key |
Request Body Parameters #
Send as JSON.
Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
username | string | ✅ Yes | Username or email address |
password | string | ✅ Yes | User password |
Example Request #
JSON Body #
{
"username": "john@example.com",
"password": "your_password_here"
}
cURL Example #
curl -X POST https://your-site.com/wp-json/rtcl/v1/login \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY_HERE" \
-d '{
"username": "john@example.com",
"password": "your_password_here"
}'
Success Response #
HTTP Status Code #
200 OK
Response Body #
{
"token_type": "Bearer",
"iat": 1706000000,
"expires_in": 1706086400,
"jwt_token": "your jwt token here..",
"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
}
}
JWT Token Details #
| Field | Description |
|---|---|
token_type | Always Bearer |
iat | Issued at (Unix timestamp) |
expires_in | Expiration time (Unix timestamp) |
jwt_token | JWT used for authenticated requests |
Token validity: 24 hours
Error Responses #
❌ Missing Username or Password #
Status: 403 Forbidden
{
"status": "error",
"error": "FORBIDDEN",
"code": "403",
"error_message": "Username and password are required."
}
❌ Invalid Credentials #
Status: 400 Bad Request
{
"status": "error",
"error": "invalid_username",
"code": "400",
"message": "Invalid username or password."
}
❌ API Access Disabled #
Status: 403 Forbidden
{
"code": "DENIED_REST_API",
"message": "Denied api call",
"data": {
"status": 403
}
}