# Share a space with a person

> POST /spaces/{spaceId}/members

Source: https://mockflow.com/developers/reference/spaces/add-space-member

**POST** `https://api.mockflow.com/v1/spaces/{spaceId}/members`  
Scopes: `members:write`

**curl**

```bash
curl https://api.mockflow.com/v1/spaces/spc_92kd/members \
  -X POST \
  -H "Authorization: Bearer $MOCKFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "jane@acme.com",
  "role": "admin"
}'
```

**JavaScript**

```javascript
const response = await fetch("https://api.mockflow.com/v1/spaces/spc_92kd/members", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOCKFLOW_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "email": "jane@acme.com",
  "role": "admin"
})
});

const data = await response.json();
```

**Python**

```python
import os, requests

response = requests.post(
    "https://api.mockflow.com/v1/spaces/spc_92kd/members",
    headers={"Authorization": f"Bearer {os.environ['MOCKFLOW_API_KEY']}"},
    json={
  "email": "jane@acme.com",
  "role": "admin"
},
)

response.raise_for_status()
data = response.json()
```

**200**

```json
{
  "id": "string",
  "email": "jane@acme.com",
  "name": "Q4 Launch Planning",
  "role": "owner",
  "hasAccount": false,
  "invited": false
}
```

**201**

```json
{
  "id": "string",
  "email": "jane@acme.com",
  "name": "Q4 Launch Planning",
  "role": "owner",
  "hasAccount": false,
  "invited": false
}
```

**402**

```json
{
  "error": {
    "code": "plan_limit",
    "message": "AI credits exhausted. 0 of 2000 remaining this month.",
    "upgradeUrl": "https://mockflow.com/pricing"
  },
  "requestId": "req_01ja"
}
```

**429**

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests.",
    "docsUrl": "https://mockflow.com/developers/concepts/errors#rate_limited"
  },
  "requestId": "req_45d49816999bac40"
}
```

Adds or updates the person's role. The first time someone is added an invitation email is sent, worded as the app sends it. Basic can share as reviewer only, up to five people per space. A shared admin or editor may share too, as in the app.

### Authorization

- `Authorization` (string, required): `Bearer <key>`. The key needs `members:write` scope. Create and manage keys in the [developer console](/developers/console/); what each scope unlocks is on the [scopes page](/developers/concepts/scopes).

### Path parameters

- `spaceId` (string, required)

### Body

- `email` (string, required)
- `role` (enum<string>, required): One of `admin`, `editor` or `reviewer`.

### Response

- `id` (string)
- `email` (string)
- `name` (string)
- `role` (enum<string>): The product's roles. Owner is the workspace that holds the board or space and cannot be granted or transferred. Admin can rename and share, editor can edit, reviewer can view, export and add comment items. There is no viewer role and no pending state. One of `owner`, `admin`, `editor` or `reviewer`.
- `hasAccount` (boolean): False for someone invited who has not signed up yet.
- `invited` (boolean): Set on the response to a first add when the invitation mail went out.

### Errors

- 402 `plan_limit`: The workspace plan does not allow this, or AI credits are exhausted.
- 429 `rate_limited`: Too many requests.
