Update User Profile API
API Documentation for updating the profile details of the currently logged-in user in CL2C.
Update Profile - PUT /v1/cl2c/user
This endpoint updates the profile information for the currently authenticated user. Access to this API requires tenant and API key headers.
Parameters
Name | Type | In | Description | Required |
---|---|---|---|---|
tenant | string | header | Tenant ID for accessing the API | Yes |
X-API-Key | string | header | API Key for authentication | Yes |
Request Body
Content-Type: application/json
Field | Type | Description |
---|---|---|
id | string | User ID |
firstName | string | First name of the user |
lastName | string | Last name of the user |
phoneNumber | string | User's phone number |
pushToken | string | Push token for notifications |
Example Request Body
{
"id": "string",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"pushToken": "push_token_example"
}
Responses
Success Response (200)
Returns the updated user profile details.
Content-Type: application/json
Field | Type | Description |
---|---|---|
id | string | Unique ID of the user |
userName | string | User's username |
firstName | string | First name |
lastName | string | Last name |
email | string | User's email |
emailConfirmed | boolean | Email confirmation status |
authenticated | boolean | Authentication status |
authValidUpto | string | Expiry date of auth token |
authLocation | string | Authentication location |
phoneNumber | string | User's phone number |
walletAddress | string | User's wallet address |
Example Success Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userName": "john_doe",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"emailConfirmed": true,
"authenticated": true,
"authValidUpto": "2024-11-05T19:42:26.587Z",
"authLocation": "USA",
"phoneNumber": "+1234567890",
"walletAddress": "0x123456789ABCDEF"
}
Error Response (400)
If validation fails, returns a detailed error response.
Content-Type: application/json
Field | Type | Description |
---|---|---|
type | string | Error type |
title | string | Short error message |
status | integer | HTTP status code |
detail | string | Detailed error description |
instance | string | Request instance identifier |
errors | object | Validation errors (optional) |
Example Error Response
{
"type": "https://example.com/error",
"title": "Invalid Request",
"status": 400,
"detail": "The request parameters are incorrect.",
"instance": "12345",
"errors": {
"firstName": ["First name is required"],
"phoneNumber": ["Invalid phone number format"]
}
}
Default Error Response
For other errors, this response structure provides general information.
Content-Type: application/json
Field | Type | Description |
---|---|---|
messages | array | List of error messages |
source | string | Error source |
exception | string | Exception details |
errorId | string | Unique error identifier |
supportMessage | string | Message for support team |
statusCode | integer | HTTP status code |
Example Default Error Response
{
"messages": ["An unexpected error occurred."],
"source": "API Gateway",
"exception": "System.Exception",
"errorId": "error-12345",
"supportMessage": "Please contact support with this error ID.",
"statusCode": 500
}
Usage Examples
JavaScript Example
fetch('/v1/cl2c/user', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'tenant': 'your-tenant-id',
'X-API-Key': 'your-api-key'
},
body: JSON.stringify({
id: 'user_id',
firstName: 'John',
lastName: 'Doe',
phoneNumber: '+1234567890',
pushToken: 'push_token_example'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));