# Change several teammates

```http
PATCH https://trydimmi.com/api/v1/members
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `members:write`.

## Body

- `changes` (object, required)
  - `custom_role_id` (string): Id of the custom role to give the members, starting with rol_; null takes their custom role away. Send this or role, never both.
  - `role` (string): Built-in role to give the members: admin or member. Send this or custom_role_id, never both. One of: `admin`, `member`.
- `ids` (string[] | null, required): Member ids (mem_...), 1 to 100.

## Response 200 (OK)

- `data` (object[] | null, required): One result per member id sent, in the order sent: its status and, when it failed, the error.
  - `error` (object)
    - `code` (string, required): The machine-readable code of the error that stopped this member's change, such as not_found.
    - `message` (string, required): A sentence explaining why the change failed, in the caller's language when a translation exists.
  - `id` (string, required): The id of this record. Send it wherever an endpoint asks for this record; never use its name or title in its place.
  - `status` (string, required): What came of this member's change: updated, skipped (already had the values asked for) or failed (see error).
- `meta` (object, required)
  - `failed` (integer, required): How many members' changes failed.
  - `skipped` (integer, required): How many members were left alone because they already had the values asked for.
  - `updated` (integer, required): How many members were changed.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request PATCH \
  --url 'https://trydimmi.com/api/v1/members' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "changes": {
    "custom_role_id": "<string>",
    "role": "admin"
  },
  "ids": [
    "<string>"
  ]
}'
```

## Example response

```json
{
  "data": [
    {
      "error": {
        "code": "<string>",
        "message": "<string>"
      },
      "id": "<string>",
      "status": "<string>"
    }
  ],
  "meta": {
    "failed": 123,
    "skipped": 123,
    "updated": 123
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
