# Update org member (role)


[API catalog](/reference/api/) · [Docker Hub overview](/reference/api/hub/latest/) · [Product manual](https://docs.docker.com/docker-hub/) · [OpenAPI specification](/reference/api/hub/latest.yaml)

API version: 2-beta



`PUT /v2/orgs/{org_name}/members/{username}`

Updates the role of a member in the organization.
***Only users in the "owners" group of the organization can use this endpoint.***

This operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.


## Connection and access

[API connection and authentication guidance](/reference/api/hub/latest/#authentication)


Server: `https://hub.docker.com`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
[
  {
    "bearerAuth": []
  }
]
```
## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request PUT \
  --header "Authorization: Bearer ${TOKEN}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "role": "owner"
}' \
  'https://hub.docker.com/v2/orgs/myorganization/members/jonsnow'
```

## Parameters

### org_name

Location: path. Required: yes.

Name of the organization (namespace).

```json
{
  "description": "Name of the organization (namespace).",
  "example": "myorganization",
  "in": "path",
  "name": "org_name",
  "pointer": "/paths/~1v2~1orgs~1{org_name}~1members~1{username}/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### username

Location: path. Required: yes.

Username, identifier for the user (namespace, DockerID).

```json
{
  "description": "Username, identifier for the user (namespace, DockerID).",
  "in": "path",
  "name": "username",
  "pointer": "/paths/~1v2~1orgs~1{org_name}~1members~1{username}/parameters/1",
  "required": true,
  "schema": {
    "example": "jonsnow",
    "type": "string"
  }
}
```

## Request and responses

### Request  application/json




Schema:

```json
{
  "examples": [
    {
      "role": "owner"
    }
  ],
  "properties": {
    "role": {
      "description": "Role of the member. Valid values are the core roles\n`owner`, `editor`, and `member`, or the name of an\nexisting [custom role](https://docs.docker.com/security/roles-and-permissions/custom-roles/manage/).\nUse the custom role's name identifier, not its label or UUID.\n",
      "example": "owner",
      "type": "string"
    }
  },
  "required": [
    "role"
  ]
}
```




Schema example:
```json
{
  "role": "owner"
}
```


### Response 200 application/json

Member role updated


Schema:

```json
{
  "$ref": "#/components/schemas/org_member"
}
```




Schema example:
```json
{
  "date_joined": "2021-01-05T21:06:53.506400Z",
  "email": "example@docker.com",
  "full_name": "Jon Snow",
  "groups": [
    "owners"
  ],
  "id": "0ab70deb065a43fcacd55d48caa945d8",
  "is_guest": false,
  "role": "Owner",
  "type": "User",
  "username": "dockeruser"
}
```


### Response 400 application/json

Bad Request


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "bad request"
}
```


### Response 401 application/json

Unauthorized


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "unauthorized"
}
```


### Response 403 application/json

Forbidden


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "permission denied"
}
```


### Response 404 application/json

Not Found


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "not found"
}
```


## Complete operation contract

```json
{
  "description": "Updates the role of a member in the organization.\n***Only users in the \"owners\" group of the organization can use this endpoint.***\n\nThis operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.\n",
  "operationId": "putV2OrgsByOrgNameMembersByUsername",
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "examples": [
            {
              "role": "owner"
            }
          ],
          "properties": {
            "role": {
              "description": "Role of the member. Valid values are the core roles\n`owner`, `editor`, and `member`, or the name of an\nexisting [custom role](https://docs.docker.com/security/roles-and-permissions/custom-roles/manage/).\nUse the custom role's name identifier, not its label or UUID.\n",
              "example": "owner",
              "type": "string"
            }
          },
          "required": [
            "role"
          ]
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/org_member"
          }
        }
      },
      "description": "Member role updated"
    },
    "400": {
      "$ref": "#/components/responses/bad_request"
    },
    "401": {
      "$ref": "#/components/responses/unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/forbidden"
    },
    "404": {
      "$ref": "#/components/responses/not_found"
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "summary": "Update org member (role)",
  "tags": [
    "orgs"
  ]
}
```

## Referenced schemas

- `#/components/responses/bad_request`

- `#/components/responses/forbidden`

- `#/components/responses/not_found`

- `#/components/responses/unauthorized`

- [#/components/schemas/org_member](/reference/api/hub/latest/schemas/org_member/)




