---
title: "Create a user and share advertisers or sites with them"
type: reference
method: POST
path: /rest-api/system-users/create-and-share.do
tag: "Users"
---

# Create a user and share advertisers or sites with them

`POST https://YOUR-NETWORK-DOMAIN/rest-api/system-users/create-and-share.do`

The console's 'Create user & share' in one call: creates an active account with the given 'login' (its username), e-mail and role, owned by the caller, and optionally shares advertisers and sites with it at 'shareType' (default CAN_VIEW). No password is sent or returned: the new user receives the console's invitation e-mail with a single-use link to choose one — the advertiser statistics-account invitation when advertisers are shared (naming the first), the site one when only sites are, otherwise the network's account-activated e-mail. 'role' is a role id or name and must be one the caller's role may create users in; an administrator role is never accepted. A role that cannot see advertisers (or sites) cannot receive them. Each shared advertiser needs campaign SHARE (SHARED or ALL) and edit rights on it, each site inventory SHARE and edit rights on it; with SHARE at SHARED level your own share on it must be higher than 'shareType' (IS_OWNER > CAN_EDIT > CAN_VIEW). Nothing is created unless every check passes. Login and e-mail must be unused. The field is 'login' rather than 'username' because 'username' is the authentication parameter of /rest-api.

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `email` | string | yes | `reports@northwind.example` | E-mail address, unused so far; the invitation goes here |
| `login` | string | yes | `northwind.reports` | Username the new account signs in with, unused so far, up to 64 characters |
| `role` | string | yes | `Statistics Account for Advertiser` | Role id or name (case-insensitive). Must be a role your role may create users in; never an administrator role. |
| `advertiserIds` | array<integer> | no | `1001` | Advertisers to share with the new user |
| `firstName` | string | no | `Mara` | Optional first name |
| `lastName` | string | no | `Whitfield` | Optional last name |
| `shareType` | string | no | `CAN_VIEW` | Access the shares give: CAN_VIEW (default), CAN_EDIT or IS_OWNER |
| `siteIds` | array<integer> | no | `2001` | Sites to share with the new user |

## Responses

- `200` — User created: {success, userId, username, email, roleId, role, active, shareType, advertiserIds, siteIds, invitationSentTo}
- `400` — Field errors under 'errors' (login, email, role), including a login or e-mail already in use, or an unknown role (the message lists the roles you may assign)
- `401` — Authentication error
- `403` — The role may not be assigned by the caller, or a share is not allowed
- `404` — An advertiser or site does not exist, is deleted or is not visible to the caller

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/system-users/create-and-share.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'email=reports@northwind.example' \
  --data-urlencode 'login=northwind.reports' \
  --data-urlencode 'role=Statistics Account for Advertiser' \
  --data-urlencode 'advertiserIds=1001' \
  --data-urlencode 'firstName=Mara' \
  --data-urlencode 'lastName=Whitfield'
```

Source: https://epom.com/ad-server/docs/api/users/post-system-users-create-and-share