Skip to main content
POST
/
api
/
adm
/
companyProjectUsers
Assign User to Project
curl --request POST \
  --url https://localhost:44371/api/adm/companyProjectUsers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "success": true,
  "code": 200,
  "errorMessage": null,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Description

Creates an association linking a company user to a project, enabling them to access project-specific resources. The association includes role information that determines user permissions within the project.

Input

  • Body: model (CompanyProjectUserCreateCommandRequest, required) — Association details including:
    • companyUserId (guid, required) — Company user identifier.
    • companyProjectId (guid, required) — Project identifier.
    • role (string, optional) — User role (Admin, Member, Viewer).
    • permissions (array, optional) — Permission list (read, write, delete).

Output

Returns a CompanyProjectUserCreateCommandResponse containing the ID of the newly created association.

Example Request

POST /api/admin/companyProjectUsers
Content-Type: application/json
Authorization: Bearer {token}

{
  "companyUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "companyProjectId": "7bc94a21-8833-4d2f-a5e1-9f4b2d8c1e7a",
  "role": "Member",
  "permissions": ["read", "write"]
}

Example Response

{
  "success": true,
  "code": 200,
  "errorMessage": null,
  "id": "9d3e5f12-4a6b-4c8d-9e2f-1a3b5c7d9e0f"
}

Errors

  • 400 Bad Request — User already assigned to this project, or validation errors.
  • 404 Not Found — Company user or project does not exist.

Notes

  • Company user must exist before assignment (create via CompanyUserController).
  • Project and user must belong to the same company.
  • No duplicate associations allowed per user-project combination.
  • Role determines permissions within the project.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

The request containing the company user ID, project ID, and optional role/permission details.

Base structure for command requests that modify data. Represents the payload used to create a project membership for a company user.

companyProjectId
string<guid>

The identifier of the project to which the user is being assigned.

companyUserId
string<guid>

The identifier of the company user being assigned to the project.

roles
enum<string>

The project level roles granted to the user.

Available options:
None,
Admin,
User

Response

Returns the ID of the newly created project user association.

Standard response structure containing operation status and error information. Standard command response indicating the result of a data modification. Create response containing the identifier of the newly created entity. Represents the response returned after creating a company project user.

success
boolean

True if the operation completed successfully; false if an error occurred.

Example:

true

code
enum<string>

Result code indicating the outcome of the operation.

Available options:
Unknown,
Success,
BadRequest,
Unauthorized,
NotFound,
Error
Example:

200

errorMessage
string | null

Human-readable error message when an error occurs.

Example:

null

id
string<guid>

Unique identifier of the newly created entity.

Example:

"3fa85f64-5717-4562-b3fc-2c963f66afa6"