DocsGetting StartedAPI ReferenceUpdate User

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

NameTypeInDescriptionRequired
tenantstringheaderTenant ID for accessing the APIYes
X-API-KeystringheaderAPI Key for authenticationYes

Request Body

Content-Type: application/json

FieldTypeDescription
idstringUser ID
firstNamestringFirst name of the user
lastNamestringLast name of the user
phoneNumberstringUser's phone number
pushTokenstringPush 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

FieldTypeDescription
idstringUnique ID of the user
userNamestringUser's username
firstNamestringFirst name
lastNamestringLast name
emailstringUser's email
emailConfirmedbooleanEmail confirmation status
authenticatedbooleanAuthentication status
authValidUptostringExpiry date of auth token
authLocationstringAuthentication location
phoneNumberstringUser's phone number
walletAddressstringUser'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

FieldTypeDescription
typestringError type
titlestringShort error message
statusintegerHTTP status code
detailstringDetailed error description
instancestringRequest instance identifier
errorsobjectValidation 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

FieldTypeDescription
messagesarrayList of error messages
sourcestringError source
exceptionstringException details
errorIdstringUnique error identifier
supportMessagestringMessage for support team
statusCodeintegerHTTP 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));