# Promote or demote a teammate.

> Hosted dashboard only.
> https://koi.dog/docs/api/workspace-team/set-workspace-teammate-role/

`PUT /api/v1/workspace-team/members/{id}` · Key: `session only`

The workspace owner may assign Admin or Member in their current workspace. Use a Clerk session token at `https://app.koi.dog/api/v1` with `Origin: https://app.koi.dog`.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The workspace teammate's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Body.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | `enum` | yes | The role to assign to this teammate. Admins can send and revoke team invitations. One of `admin`, `member`. |

## Response.

200 OK · JSON object

- **422 validation_failed**: Each schema error appears in `details`.

## Request.

```sh
# Requires a Clerk dashboard session token.
curl -X PUT "https://app.koi.dog/api/v1/workspace-team/members/$ID" \
    -H "Authorization: Bearer $KOIDOG_CLERK_SESSION" \
    -H "Origin: https://app.koi.dog" \
    -H "Content-Type: application/json" \
    -d '{
      "role": "admin"
    }'
```

```js
// Requires a Clerk dashboard session token.
const res = await fetch(`https://app.koi.dog/api/v1/workspace-team/members/${process.env.ID}`, {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_CLERK_SESSION}`,
    Origin: "https://app.koi.dog",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    role: "admin",
  }),
});
console.log(await res.json());
```

```python
import os

import requests

# Requires a Clerk dashboard session token.
r = requests.put(
    f"https://app.koi.dog/api/v1/workspace-team/members/{os.environ['ID']}",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_CLERK_SESSION']}",
        "Origin": "https://app.koi.dog",
    },
    json={
        "role": "admin",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "ok": true
}
```
