← Back Home

API Documentation: User Profiles

This section details the API endpoints available for managing user profiles within the system. These endpoints allow for retrieval, creation, and modification of user data.

User Profile Endpoints

GET /api/v1/users/{userId}/profile
Retrieves the profile information for a specific user.

Parameters

Name Type Required Description
userId string Yes The unique identifier of the user whose profile is to be retrieved.

Response Body (Success: 200 OK)

Field Type Description
username string The user's chosen username.
displayName string The user's full display name.
bio string A short biography or description provided by the user.
avatarUrl string URL to the user's profile picture.
joinedDate string (ISO 8601) The date and time the user account was created.

Example Request

GET /api/v1/users/a1b2c3d4-e5f6-7890-1234-abcdef123456/profile

Example Response (200 OK)

{
  "username": "coder_gal",
  "displayName": "Alex Johnson",
  "bio": "Enthusiastic about clean code and open-source projects.",
  "avatarUrl": "https://example.com/avatars/alexj.png",
  "joinedDate": "2023-01-15T10:30:00Z"
}
POST /api/v1/users/profiles
Creates a new user profile. This endpoint is typically used during user registration.

Request Body

Field Type Required Description
username string Yes The desired username for the new profile. Must be unique.
email string Yes The user's email address.
password string Yes The user's chosen password.
displayName string No The user's full display name (optional).

Response Body (Success: 201 Created)

Field Type Description
userId string The unique identifier generated for the new user.
message string Confirmation message.

Example Request

POST /api/v1/users/profiles
Content-Type: application/json

{
  "username": "new_developer",
  "email": "new.dev@example.com",
  "password": "securePassword123!",
  "displayName": "Jane Doe"
}

Example Response (201 Created)

{
  "userId": "f9e8d7c6-b5a4-3210-fedc-ba9876543210",
  "message": "User profile created successfully."
}
PUT /api/v1/users/{userId}/profile
Updates an existing user profile. Only the fields provided in the request body will be updated.

Parameters

Name Type Required Description
userId string Yes The unique identifier of the user whose profile is to be updated.

Request Body

Field Type Required Description
bio string No New biography for the user.
avatarUrl string No New URL for the user's avatar.

Response Body (Success: 200 OK)

Field Type Description
message string Confirmation message.
updatedFields array of strings List of fields that were successfully updated.

Example Request

PUT /api/v1/users/a1b2c3d4-e5f6-7890-1234-abcdef123456/profile
Content-Type: application/json

{
  "bio": "Updated my bio to reflect my new role!",
  "avatarUrl": "https://example.com/avatars/alexj_new.png"
}

Example Response (200 OK)

{
  "message": "User profile updated successfully.",
  "updatedFields": ["bio", "avatarUrl"]
}
DELETE /api/v1/users/{userId}/profile
Deletes a user's profile. This action is irreversible.

Parameters

Name Type Required Description
userId string Yes The unique identifier of the user whose profile is to be deleted.

Response Body (Success: 204 No Content)

No content is returned upon successful deletion.

Example Request

DELETE /api/v1/users/a1b2c3d4-e5f6-7890-1234-abcdef123456/profile