---
title: "Invite a member"
---

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

# Invite a member

Path: CloudRaker Workspace API › Organization Settings

`POST /users/invitations`

Emails an invitation to join the caller's organization. Body: `{ email: string, roleSlug?: string }` — absent, the organization's default role applies. Authorization: organization administrators only. Returns 400 on a malformed body and 422 when the address cannot be invited — e.g. it is already a member.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `email` (`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-z0-9\-]*\.)+[A-Za-z]{2,}$`; example `"person@acme.com"`
- `roleSlug` (`inviteUser.roleSlug`; string, optional)
  - minLength 1; maxLength 64; example `"admin"`

## Example request

```json
{
  "email": "person@acme.com",
  "roleSlug": "admin"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/users/invitations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "person@acme.com",
  "roleSlug": "admin"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/users/invitations';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({email: 'person@acme.com', roleSlug: 'admin'})
};

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

### Python

```python
import requests

url = "https://api.cloudraker.com/users/invitations"

payload = {
    "email": "person@acme.com",
    "roleSlug": "admin"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

The invitation that was sent.

#### Example

```json
{
  "invitation": {
    "id": "string",
    "email": "user@example.com",
    "expiresAt": "string"
  }
}
```

- `invitation` (`inviteUser.response.201.invitation`; object, required)
  - `id` (`inviteUser.response.201.invitation.id`; string, required)
  - `email` (`inviteUser.response.201.invitation.email`; string, required)
    - format `email`; pattern `^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`
  - `expiresAt` (`inviteUser.response.201.invitation.expiresAt`; string, required)


Source: https://docs.cloudraker.com/workspace/api/organization-settings/invite-user/index.md
