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
id
path
string
true
The unique identifier of the workspace
body
body
object
true
User addition data
Path Parameters
id
string
true
none
The unique identifier of the workspace
Request Body Schema
» 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
» 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
Response Schema
Status Code 200
» success
boolean
true
none
Operation success status
Status Code 400
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Status Code 403
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Status Code 404
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Status Code 500
» 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?