Skip to content

Assign User to Project

Method

REST method is adopted.

HTTP Method

PUT: Create or update one project user assignment

Naming Convention

snake_case is used for URI parameters. JSON fields use camelCase.

Request and Response

Headers

Request Headers

  • Authorization: Bearer <access_token>
  • Content-Type: application/json

URI

/api/v1/projects/{project_id}/users/{user_id}
Name Type Required Description
project_id integer Required Project ID
user_id integer Required User record ID

Request Body

{
  "projectAccess": "2"
}
Field Type Required Description
projectAccess string Required "1" = read, "2" = read/write

Response (200 OK)

Returns the created or updated active assignment.

Authentication

A valid admin Cognito Bearer token with read/write access to users and projects is required.

Exception Handling

Description Status Code Status Name
Invalid access value or organization mismatch 400 Bad Request
Missing or invalid token 401 Unauthorized
Insufficient user or project permission 403 Forbidden
User or project not found 404 Not Found

Process Flow

  1. Validate the admin session, request, and write permissions.
  2. Verify that the active user and project belong to the same organization.
  3. Upsert and return the assignment.

Source: apps/admin/src/routes/v1/user-project.ts