Endpoint #
POST /wp-json/rtcl/v1/my/profile-image
Description #
Allows a logged-in user to upload or update their profile image.
- The image will replace the current profile picture if it exists.
- Returns the new thumbnail ID and image URL.
Authentication #
Requires JWT + API Key authentication.
Request Headers #
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer <JWT_TOKEN> | ✅ Yes |
| X-API-KEY | <YOUR_API_KEY> | ✅ Yes |
| Content-Type | multipart/form-data | ✅ Yes |
Request Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | ✅ Yes | The image file to upload (JPEG, PNG, GIF supported) |
Validation:
- Must include an image file in the
imagefield.- Returns error if missing or invalid.
Example cURL Request #
curl -X POST "https://yourdomain.com/wp-json/rtcl/v1/my/profile-image" \
-H "Authorization: Bearer <JWT_TOKEN>" \
-H "X-API-KEY: <YOUR_API_KEY>" \
-F "image=@/path/to/demo-profile.jpg"
Success Response #
Status Code: 200 OK
{
"thumbnail_id": 123,
"src": "https://yourdomain.com/wp-content/uploads/2026/01/demo-profile.jpg",
"user_id": 1
}
Fields Description #
| Field | Type | Description |
|---|---|---|
thumbnail_id | integer | The WordPress attachment ID of the uploaded profile image |
src | string | URL of the uploaded image (thumbnail size 80×80) |
user_id | integer | ID of the user whose profile image was updated |
Error Responses #
1. Not Logged In #
Status Code: 403 Forbidden
{
"status": "error",
"error": "FORBIDDEN",
"code": "403",
"error_message": "You are not logged in."
}
2. Image File Missing #
Status Code: 400 Bad Request
{
"status": "error",
"error": "BADREQUEST",
"code": "400",
"error_message": "Image file field is required."
}
3. Invalid API Key #
Status Code: 401 Unauthorized
{
"status": "error",
"error": "INVALID_API_KEY",
"code": "401",
"error_message": "Sorry, you are using invalid API Key."
}
4. Missing API Key Header #
Status Code: 401 Unauthorized
{
"status": "error",
"error": "MISSING_X_API_KEY_HEADER",
"code": "401",
"error_message": "X_API_KEY header not received. Either authorization header was not sent or it was removed by your server due to security reasons."
}
5. Upload Error #
Status Code: 400 Bad Request
{
"status": "error",
"error": "BADREQUEST",
"code": "400",
"error_message": "The uploaded file type is not allowed."
}
Notes #
- The uploaded image replaces the existing profile picture if one exists.
- Supports JPEG, PNG, GIF file types.
- Returns thumbnail URL and attachment ID for use in the app or frontend.
- Ensure the request uses
multipart/form-datafor file upload.