---
title: "Invite user to project"
description: "Send an invitation to a user to join a project"
---

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

Path: Test And Accept API › ProjectUsers

`POST /projects/{projectId}/invitations`

Send an invitation to a user to join a project

## Authentication

- `bearerAuth`, http, header `Authorization`, format `tnda_ token`

## Path parameters

- `projectId` (`projectUsers-inviteUser.path.projectId`; string, required)
  - format `uuid`; pattern `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$`

## Request body

_Required._

- `email` (`projectUsers-inviteUser.email`; string, required)
  - format `email`; pattern `^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`
- `accessLevel` (`projectUsers-inviteUser.accessLevel`; string, required)
  - one of `"owner"`, `"editor"`, `"approver"`, `"viewer"`, `"follower"`
- `expiresAt` (`projectUsers-inviteUser.expiresAt`; string, optional)
  - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `message` (`projectUsers-inviteUser.message`; string, optional)

## Example request

```json
{
  "email": "user@example.com",
  "accessLevel": "owner",
  "expiresAt": "2019-08-24T14:15:22Z",
  "message": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.testandaccept.com/api/rest/projects/<projectId>/invitations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "user@example.com",
  "accessLevel": "owner",
  "expiresAt": "2019-08-24T14:15:22Z",
  "message": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.testandaccept.com/api/rest/projects/<projectId>/invitations';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    email: 'user@example.com',
    accessLevel: 'owner',
    expiresAt: '2019-08-24T14:15:22Z',
    message: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.testandaccept.com/api/rest/projects/<projectId>/invitations"

payload = {
    "email": "user@example.com",
    "accessLevel": "owner",
    "expiresAt": "2019-08-24T14:15:22Z",
    "message": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Successful response

#### Example

```json
{
  "success": true,
  "userAdded": true,
  "message": "string"
}
```

- `success` (`projectUsers-inviteUser.response.200.success`; boolean, required)
- `userAdded` (`projectUsers-inviteUser.response.200.userAdded`; boolean, required)
- `message` (`projectUsers-inviteUser.response.200.message`; string, required)

### 400

Invalid input data

#### Example

```json
{
  "code": "BAD_REQUEST",
  "message": "Invalid input data",
  "issues": []
}
```

- `message` (`projectUsers-inviteUser.response.400.message`; string, required) — The error message
  - example `"Invalid input data"`
- `code` (`projectUsers-inviteUser.response.400.code`; string, required) — The error code
  - example `"BAD_REQUEST"`
- `issues` (`projectUsers-inviteUser.response.400.issues`; array<object>, optional) — An array of issues that were responsible for the error
  - example `[]`
  - `message` (`projectUsers-inviteUser.response.400.issues.message`; string, required)

### 401

Authorization not provided

#### Example

```json
{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}
```

- `message` (`projectUsers-inviteUser.response.401.message`; string, required) — The error message
  - example `"Authorization not provided"`
- `code` (`projectUsers-inviteUser.response.401.code`; string, required) — The error code
  - example `"UNAUTHORIZED"`
- `issues` (`projectUsers-inviteUser.response.401.issues`; array<object>, optional) — An array of issues that were responsible for the error
  - example `[]`
  - `message` (`projectUsers-inviteUser.response.401.issues.message`; string, required)

### 403

Insufficient access

#### Example

```json
{
  "code": "FORBIDDEN",
  "message": "Insufficient access",
  "issues": []
}
```

- `message` (`projectUsers-inviteUser.response.403.message`; string, required) — The error message
  - example `"Insufficient access"`
- `code` (`projectUsers-inviteUser.response.403.code`; string, required) — The error code
  - example `"FORBIDDEN"`
- `issues` (`projectUsers-inviteUser.response.403.issues`; array<object>, optional) — An array of issues that were responsible for the error
  - example `[]`
  - `message` (`projectUsers-inviteUser.response.403.issues.message`; string, required)

### 500

Internal server error

#### Example

```json
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}
```

- `message` (`projectUsers-inviteUser.response.500.message`; string, required) — The error message
  - example `"Internal server error"`
- `code` (`projectUsers-inviteUser.response.500.code`; string, required) — The error code
  - example `"INTERNAL_SERVER_ERROR"`
- `issues` (`projectUsers-inviteUser.response.500.issues`; array<object>, optional) — An array of issues that were responsible for the error
  - example `[]`
  - `message` (`projectUsers-inviteUser.response.500.issues.message`; string, required)


Source: https://docs.testandaccept.com/reference/project-users/invite-user/index.md
