# Workspace / Organizations

Shipped comes with support for Workspace / Organizations.

They are collections of users that you can use to let the users organize their teams.

For instance, if they are all part of the same company, i.e. "Acme Inc.", you can allow them to create an organization and invite other users to it, with specific roles (Owner, Admin, Member, Guest).

## Create a workspace / organization

Use the component `<CreateWorkspaceModal />`.

It is a modal with an input field.

The route POST `/api/workspace` handles the workspace creation.

<figure><img src="https://3985976695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT3t4pDs63s3Soj1JetJw%2Fuploads%2FoIfi6r7Kdj3GHV1ouRhM%2F303846624-bf0e06bb-83d5-403a-96fe-94600554a60c%20(1).png?alt=media&#x26;token=c9e6458b-97dc-445a-a396-322736ebf2e6" alt=""><figcaption><p>Create workspace modal</p></figcaption></figure>

## Add a workspace / organization member

Use the component `<AddWorkspaceMember />`.

It is a modal with email and role.

<figure><img src="https://3985976695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT3t4pDs63s3Soj1JetJw%2Fuploads%2FQOXdMJCbskVXFJowXikp%2F303846775-b28ba73f-8735-4672-b2e5-07659ef8f30d.png?alt=media&#x26;token=463dfb2f-72a4-40aa-8540-1af5bb71f0f6" alt=""><figcaption><p>Add member to workspace / organization</p></figcaption></figure>

The route POST `/api/workspace/invite` handles the workspace invitation.

It sends an email to the target email.

If the user doesn't have an account (never signed up) it is added to the table WorkspacePendingInvitation, otherwise to the table WorkspaceUsers.\
\
If a user is pending an invitation, when he or she signs up, the user is automatically moved from the WorkspacePendingInvitation table to the WorkspaceUsers one.

## Additional routes

`GET /api/workspace/[id]/invitations` — Get invitations to a workspace\
`DELETE /api/workspace/[id]/invitations` — Delete invitation to a workspace\
`GET /api/workspace/[id]/members` — Get members of a workspace\
`DELETE /api/workspace/[id]/members` — Delete member of a workspace\
`PUT /api/user/role` — Update the role of a member

<br>
