ChatCommunicator REST API docs (in dev)

Download OpenAPI specification:Download

Chat

Get Chats

This endpoint returns all chat conversations associated with the currently authenticated user. A valid JWT token must be included in the Authorization header. The user's ID is extracted from the token claims and used to fetch the relevant chat data.

If the user ID is missing or not a valid GUID, a 401 Unauthorized response is returned. Appropriate error responses are returned in case of validation failures or internal errors.

Authorizations:
Bearer

Responses

Response samples

Content type
No sample

Get Paged Messages

This endpoint returns a paginated list of messages from a conversation.
If fromMessageId is provided, it returns messages after that ID;
if fromMessageId is null, it returns an empty list (with 200 OK).
A valid JWT token must be included in the Authorization header.
If conversationId is missing, empty, or invalid, an error response is returned.

Authorizations:
Bearer
query Parameters
conversationId
string <uuid>

The ID of the conversation (GUID). Required.

fromMessageId
string <uuid>

The ID of the message after which to start fetching (GUID). Optional.

Responses

Response samples

Content type
No sample

Friends

Send Invite

This endpoint allows an authenticated user to send a friend invitation by providing the sender's and recipient's GUIDs. Returns appropriate HTTP responses based on validation, conflicts, or if the recipient is not found.

Authorizations:
Bearer
Request Body schema:

Invitation data including sender and recipient GUIDs.

senderId
required
string <uuid>
recipientId
required
string <uuid>

Responses

Request samples

Content type
{
  • "senderId": "6b2f63ba-164c-48c9-87b1-690cee2b3da3",
  • "recipientId": "afdd332c-8290-47b9-aca2-368bf5f25a9d"
}

Response samples

Content type
No sample

Get Invitations

Returns all pending friend invitations for the specified user GUID. If the user does not exist or input is invalid, returns appropriate error responses.

Authorizations:
Bearer
path Parameters
userId
required
string <uuid>

GUID of the user whose invitations to retrieve.

Responses

Response samples

Content type
No sample

Get Users to Invite by Text

Authenticated users can search for other users by username or display name. The search excludes users who are already friends or already invited. Requires a valid JWT token with user GUID.

Authorizations:
Bearer
path Parameters
text
required
string

Text to search users by.

Responses

Response samples

Content type
No sample

Deceline Invite

Allows an authenticated user to decline a friend invitation by providing sender and recipient GUIDs. Returns appropriate errors if the invitation is invalid, already handled, or missing.

Authorizations:
Bearer
Request Body schema:

Invitation data with sender and recipient GUIDs.

senderId
required
string <uuid>
recipientId
required
string <uuid>

Responses

Request samples

Content type
{
  • "senderId": "6b2f63ba-164c-48c9-87b1-690cee2b3da3",
  • "recipientId": "afdd332c-8290-47b9-aca2-368bf5f25a9d"
}

Response samples

Content type
No sample

Accept Invite

Allows an authenticated user to accept a friend invitation by sender and recipient GUIDs. On success, users are added to each other's friend lists. Returns errors for invalid input, not found invitations, or conflicts.

Authorizations:
Bearer
Request Body schema:

Invitation data with sender and recipient GUIDs.

senderId
required
string <uuid>
recipientId
required
string <uuid>

Responses

Request samples

Content type
{
  • "senderId": "6b2f63ba-164c-48c9-87b1-690cee2b3da3",
  • "recipientId": "afdd332c-8290-47b9-aca2-368bf5f25a9d"
}

Response samples

Content type
No sample

Get Friends

Fetches all users marked as friends of the specified user GUID. Returns errors for invalid input or unexpected issues.

Authorizations:
Bearer
path Parameters
userId
required
string <uuid>

GUID of the user whose friends to retrieve.

Responses

Response samples

Content type
No sample

User

Register

This endpoint creates a new user using a username and password. If the username already exists, a conflict response is returned. On success, basic user data is returned.

Authorizations:
Bearer
Request Body schema:

The registration data including username and password.

userName
required
string [ 3 .. 25 ] characters
password
required
string [ 6 .. 50 ] characters

Responses

Request samples

Content type
{
  • "userName": "string",
  • "password": "string"
}

Response samples

Content type
No sample

Login

This endpoint validates the provided login credentials. On success, it returns a JWT access token and a refresh token. If authentication fails, a detailed error is returned.

Authorizations:
Bearer
Request Body schema:

The login credentials, including username and password.

userName
required
string [ 3 .. 25 ] characters
password
required
string [ 6 .. 50 ] characters

Responses

Request samples

Content type
{
  • "userName": "string",
  • "password": "string"
}

Response samples

Content type
No sample

Refresh Access Token

This endpoint checks the provided refresh token and issues a new access token if it's valid.

Authorizations:
Bearer
Request Body schema:

The refresh token container.

refreshToken
required
string <uuid>

Responses

Request samples

Content type
{
  • "refreshToken": "786e91a0-1be4-4328-96f7-3539bbbfa9f9"
}

Response samples

Content type
No sample

Change Username

Authenticated users can change their username. The new username must be unique.

Authorizations:
Bearer
query Parameters
newUsername
string

The new username to assign.

Responses

Response samples

Content type
No sample

Upload Avatar

Authenticated users can upload a new avatar image. The uploaded file must meet specific requirements:

  • Maximum file size: 5 MB.

  • Maximum dimensions: 500x500 pixels.

  • Supported formats: JPEG, PNG, etc.

Authorizations:
Bearer
Request Body schema: multipart/form-data
file
required
string <binary>

Responses

Response samples

Content type
No sample

Users

Get User By Id

Requires authorization. This endpoint returns a simplified user DTO corresponding to the given GUID.

Authorizations:
Bearer
path Parameters
id
required
string <uuid>

The unique GUID identifier of the user.

Responses

Response samples

Content type
No sample

Get Users By Text

Optionally excludes the currently authenticated user from the results.

Authorizations:
Bearer
path Parameters
text
required
string

The substring to search for in usernames.

query Parameters
excludeCurrentUser
boolean
Default: false

Indicates whether to exclude the current user from the results.

Responses

Response samples

Content type
No sample