Skip to main contentOverview
The Workspaces API allows you to manage workspaces, their members, and roles within the Wacht platform. You can list, retrieve, create, update, and delete workspaces.
fetchWorkspaces(options?: ListWorkspacesOptions)
Lists all workspaces.
Parameters
options (optional): An object containing pagination and filtering options.
page (number): The page number to retrieve.
per_page (number): The number of items per page.
search (string): Search term for workspaces.
organization_id (string): Filter by organization ID.
Returns
Promise<WorkspaceListResponse>: A promise that resolves to a list of workspaces and pagination information.
fetchWorkspace(workspaceId: string)
Retrieves a specific workspace by its ID.
Parameters
workspaceId (string): The unique identifier of the workspace.
Returns
Promise<Workspace>: A promise that resolves to the workspace object.
updateWorkspace(workspaceId: string, request: UpdateWorkspaceRequest)
Updates an existing workspace.
Parameters
workspaceId (string): The unique identifier of the workspace to update.
request (UpdateWorkspaceRequest): The request body containing the updated details of the workspace.
Returns
Promise<Workspace>: A promise that resolves to the updated workspace object.
deleteWorkspace(workspaceId: string)
Deletes a workspace by its ID.
Parameters
workspaceId (string): The unique identifier of the workspace to delete.
Returns
Promise<void>: A promise that resolves when the workspace is successfully deleted.
createWorkspaceInOrganization(organizationId: string, request: CreateWorkspaceRequest)
Creates a new workspace within a specific organization.
Parameters
organizationId (string): The unique identifier of the organization.
request (CreateWorkspaceRequest): The request body containing the details of the new workspace.
Returns
Promise<Workspace>: A promise that resolves to the newly created workspace object.
fetchWorkspaceRoles()
Lists all available workspace roles.
Returns
Promise<WorkspaceRoleListResponse>: A promise that resolves to a list of workspace roles.
createWorkspaceRole(workspaceId: string, request: CreateRoleRequest)
Creates a new workspace role.
Parameters
workspaceId (string): The unique identifier of the workspace.
request (CreateRoleRequest): The request body containing the details of the new role.
Returns
Promise<WorkspaceRole>: A promise that resolves to the newly created workspace role object.
updateWorkspaceRole(workspaceId: string, roleId: string, request: UpdateRoleRequest)
Updates an existing workspace role.
Parameters
workspaceId (string): The unique identifier of the workspace.
roleId (string): The unique identifier of the role to update.
request (UpdateRoleRequest): The request body containing the updated details of the role.
Returns
Promise<WorkspaceRole>: A promise that resolves to the updated workspace role object.
deleteWorkspaceRole(workspaceId: string, roleId: string)
Deletes a workspace role.
Parameters
workspaceId (string): The unique identifier of the workspace.
roleId (string): The unique identifier of the role to delete.
Returns
Promise<void>: A promise that resolves when the role is successfully deleted.