# Set who holds a role on a record

Replaces the WHOLE set of people in one `role` on one record and answers the diff — who was added and who was removed — so the caller need not work that out. `accountIds` order is meaningful: the first is the role's primary and lands in the record's person cell; an empty list clears the role. Roles are agent, closer, originating_agent and processing_agent on deals, owner on leads, submissions and merchants. Who a caller may put on or take off a record is checked for every id on both sides of the change.

Access class: `def:read`.

## Endpoint

`PUT /v1/definitions/{key}/rows/{rowId}/assignments`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| key | path | string | Yes |
| rowId | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "accountIds": [
      "string"
    ],
    "role": "string"
  },
  "params": {
    ":key": "string",
    ":rowId": ""
  },
  "query": {}
}
```

## Responses

### 200

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "added": [
      "string"
    ],
    "assignees": [
      "string"
    ],
    "removed": [
      "string"
    ],
    "role": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
