# Give a person a role

**PUT** `/api/embed/v1/accounts/{accountId}/members/{userId}`

Gives a person a role in one of an account’s workspaces.

Needs a partner key: `Authorization: Bearer gre_…`, from [Platform › Partner keys](https://docs.gorunner.io/embed/platform-screens#partner-keys). Call it from your server only.

Embed · Self-hosted with an Embed license

## Parameters

### Path

- `accountId` · Required · string: Your ID for the customer’s account: 1 to 255 bytes of UTF-8, case-sensitive. URL-encode it: it may contain `/`.
- `userId` · Required · string: Your ID for the person.

### Body

- `role` · Required · string: `viewer`, `operator` or `editor`.
- `workspaceId` · Optional · string: Your workspace ID. Left out: the default workspace.
- `user` · Optional · object: The person’s `name` and `email`, to create someone new.

## When the role changes

The person’s older sessions in that workspace end (`role_changed`) and come back at the new role.

## Responses

- 200 OK

  Updated.

- 201 Created

  The membership is new.

- 400 `VALIDATION_ERROR`

  A field isn’t valid. `details.field` names it.

- 404 `NOT_FOUND`

  No such account, workspace or person. Send `user.name` to create the person.

- 409 `ACCOUNT_DELETED`

  The account is deleted. Restore it first, within 30 days.

- 500 `INTERNAL_ERROR`

  Something failed on the installation’s side. Try again.

Any call can also answer: [`401 UNAUTHORIZED`](https://docs.gorunner.io/errors#UNAUTHORIZED) · [`403 EMBED_NOT_LICENSED`](https://docs.gorunner.io/errors#EMBED_NOT_LICENSED) · [`403 IP_NOT_ALLOWED`](https://docs.gorunner.io/errors#IP_NOT_ALLOWED) · [`413 PAYLOAD_TOO_LARGE`](https://docs.gorunner.io/errors#PAYLOAD_TOO_LARGE) · [`415 INVALID_CONTENT_TYPE`](https://docs.gorunner.io/errors#INVALID_CONTENT_TYPE) · [`429 RATE_LIMITED`](https://docs.gorunner.io/errors#RATE_LIMITED) · [`503 BUSY`](https://docs.gorunner.io/errors#BUSY). See [Errors](https://docs.gorunner.io/embed/api#errors).

Request

**curl**

```bash
GORUNNER="https://automations.example.com"
GORUNNER_EMBED_KEY="YOUR_PARTNER_KEY"  # gre_…
ACCOUNT_ID="acct-bakery"
USER_ID="ada-123"

URL="$GORUNNER/api/embed/v1/accounts/$ACCOUNT_ID/"
URL="${URL}members/$USER_ID"
curl -X PUT "$URL" \
  -H "Authorization: Bearer $GORUNNER_EMBED_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "operator",
    "workspaceId": "ws-orders"
  }'
```

**JavaScript**

```js
const GORUNNER = "https://automations.example.com";
const KEY = process.env.GORUNNER_EMBED_KEY; // gre_…
const ACCOUNT_ID = encodeURIComponent("acct-bakery");
const USER_ID = encodeURIComponent("ada-123");

const res = await fetch(
  `${GORUNNER}/api/embed/v1/accounts/` +
    `${ACCOUNT_ID}/members/${USER_ID}`,
  {
    method: "PUT",
    headers: {
        Authorization: `Bearer ${KEY}`,
        "Content-Type": "application/json",
      },
    body: JSON.stringify({
        role: "operator",
        workspaceId: "ws-orders",
      }),
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests
from urllib.parse import quote

GORUNNER = "https://automations.example.com"
KEY = os.environ["GORUNNER_EMBED_KEY"]  # gre_…
ACCOUNT_ID = quote("acct-bakery", safe="")
USER_ID = quote("ada-123", safe="")

res = requests.put(
    f"{GORUNNER}/api/embed/v1/accounts/"
    f"{ACCOUNT_ID}/members/{USER_ID}",
    headers={"Authorization": f"Bearer {KEY}"},
    json={
      "role": "operator",
      "workspaceId": "ws-orders",
    },
)
data = res.json()["data"]
```

Response · 200 OK

```json
{
  "data": {
    "user": {
      "id": "ada-123",
      "name": "Ada Lovelace",
      "email": "ada@bakery.example"
    },
    "workspace": {
      "id": "ws-orders",
      "default": false
    },
    "role": "operator",
    "createdAt": "2026-10-22T10:00:00Z"
  }
}
```

**Every field**

### Body

- `role` · Required · string: One of `viewer`, `operator`, `editor`.
- `workspaceId` · Optional · string: Omitted = the account’s default workspace (`default` names it too); the empty value is refused.
- `user` · Optional · object
  - `name` · Optional · string: Required to create. Left out or null: left as it is.
  - `email` · Optional · string or null: Contact data only. Left out: left as it is. Null or empty clears it. Must look like an email address.

### Response · 200 OK, 201 Created

- `data` · object
  - `user` · object
    - `id` · string
    - `name` · string
    - `email` · string or null
  - `workspace` · object
    - `id` · string or null: The partner’s workspace id; null for the default workspace.
    - `default` · boolean
  - `role` · string: One of `viewer`, `operator`, `editor`.
  - `createdAt` · time

Related: [Remove a member](https://docs.gorunner.io/embed/api/people/remove-member) · [Accounts and people](https://docs.gorunner.io/embed/accounts-and-people)

Source: https://docs.gorunner.io/embed/api/people/put-member
