post__workspace_{wksId}_users

POST /workspace/{id}/users

Add User to Workspace

Add a user to a workspace with a specified role. The authenticated user must have ADMIN access to the workspace to perform this operation.

TypeScript Client Library

public addUserToWorkspace = async (workspaceId: string, request: WorkspaceTypes.AddUserToWorkspaceRequest): Promise<WorkspaceTypes.AddUserToWorkspaceResponse> => {
  return this.makeRequest<WorkspaceTypes.AddUserToWorkspaceResponse>(`workspace/${workspaceId}/users`, 'POST', request);
};

Code Samples

# You can also use wget
curl -X POST https://backend.flashback.tech/workspace/123e4567-e89b-12d3-a456-426614174000/users \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}' \
  -d '{
    "userId": "user-456",
    "role": "WRITE"
  }'

Body parameter

{
  "userId": "user-456",
  "role": "WRITE"
}

Parameters

Name
In
Type
Required
Description

id

path

string

true

The unique identifier of the workspace

body

body

object

true

User addition data

Path Parameters

Name
Type
Required
Restrictions
Description

id

string

true

none

The unique identifier of the workspace

Request Body Schema

Name
Type
Required
Restrictions
Description

» userId

string

true

none

The unique identifier of the user to add

» role

string

true

none

The role to assign to the user (READ, WRITE, ADMIN)

Enumerated Values

Parameter
Value

» role

READ

» role

WRITE

» role

ADMIN

Example responses

200 Response

{
  "success": true
}

400 Response

{
  "success": false,
  "message": "User not found or account is not validated"
}

403 Response

{
  "success": false,
  "message": "Insufficient permissions to manage workspace users"
}

404 Response

{
  "success": false,
  "message": "Target user not found"
}

500 Response

{
  "success": false,
  "message": "Failed to add user to workspace"
}

Responses

Status
Meaning
Description
Schema

200

User added to workspace successfully

Inline

400

User not found or not validated

Inline

403

Insufficient permissions

Inline

404

Target user not found

Inline

500

Server error

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

Status Code 400

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

» message

string

true

none

Error message

Status Code 403

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

» message

string

true

none

Error message

Status Code 404

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

» message

string

true

none

Error message

Status Code 500

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

» message

string

true

none

Error message

Notes

  • Authentication Required: User must be authenticated with a valid Bearer token

  • Permissions: User must have ADMIN access to the workspace to add users

  • Account Validation: User account must be validated to perform this operation

  • User Organization: Target user must belong to the same organization as the workspace

  • Role Assignment: Users can be assigned READ, WRITE, or ADMIN roles

  • Duplicate Prevention: If the user already exists in the workspace, the role will be updated

  • Organization Scoped: Users can only be added to workspaces within their organization

Last updated

Was this helpful?