> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# shareProjectWithUser

***

# Function: shareProjectWithUser()

```ts theme={null}
function shareProjectWithUser(
  projectId: string,
  userId: string,
  role: "owner" | "editor" | "annotator" | "viewer",
): Promise<{
  createdAt: string;
  email: string;
  firstName: null | string;
  id: string;
  lastName: null | string;
  permissions?: object[];
  role: "owner" | "editor" | "annotator" | "viewer";
  userId: string;
}>;
```

Defined in: [src/utils/projects.ts](https://github.com/rungalileo/galileo-js/blob/main/src/utils/projects.ts)

Shares a project with a single user.

## Parameters

### projectId

`string`

ID of the project to share.

### userId

`string`

ID of the user receiving access.

### role

(Optional) Role to assign to the user (defaults to viewer).

`"owner"` | `"editor"` | `"annotator"` | `"viewer"`

## Returns

`Promise`\<\{
`createdAt`: `string`;
`email`: `string`;
`firstName`: `null` | `string`;
`id`: `string`;
`lastName`: `null` | `string`;
`permissions?`: `object`\[];
`role`: `"owner"` | `"editor"` | `"annotator"` | `"viewer"`;
`userId`: `string`;
}>

A promise that resolves to the created collaborator record.
