# Update an organization membership for the authenticated user

From **GitHub v3 REST API**.

`PATCH /user/memberships/orgs/{org}`

Update an organization membership for the authenticated user

## Parameters

### `org`

- Location: path
- Required: true
- Type: `string`

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "state": "active"
}
```

```json
{"properties":{"state":{"description":"The state that the membership should be in. Only `\"active\"` will be accepted.","enum":["active"],"type":"string"}},"required":["state"],"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Org Membership

```json
{
  "organization": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "description": "A great organization",
    "events_url": "https://api.github.com/orgs/github/events",
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "id": 1,
    "issues_url": "https://api.github.com/orgs/github/issues",
    "login": "github",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "repos_url": "https://api.github.com/orgs/github/repos",
    "url": "https://api.github.com/orgs/github"
  },
  "organization_url": "https://api.github.com/orgs/octocat",
  "role": "admin",
  "state": "active",
  "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
  "user": {
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/octocat",
    "id": 1,
    "login": "octocat",
    "node_id": "MDQ6VXNlcjE=",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/octocat"
  }
}
```

```json
{"description":"Org Membership","properties":{"organization":{"$ref":"#/components/schemas/organization-simple"},"organization_url":{"example":"https://api.github.com/orgs/octocat","format":"uri","type":"string"},"permissions":{"properties":{"can_create_repository":{"type":"boolean"}},"required":["can_create_repository"],"type":"object"},"role":{"description":"The user's membership type in the organization.","enum":["admin","member","billing_manager"],"example":"admin","type":"string"},"state":{"description":"The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.","enum":["active","pending"],"example":"active","type":"string"},"url":{"example":"https://api.github.com/orgs/octocat/memberships/defunkt","format":"uri","type":"string"},"user":{"$ref":"#/components/schemas/nullable-simple-user"}},"required":["state","role","organization_url","url","organization","user"],"title":"Org Membership","type":"object"}
```

### `403`

Forbidden

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request PATCH \
  --url {protocol}://{hostname}/api/v3/user/memberships/orgs/{org} \
  --header 'content-type: application/json' \
  --data '{
  "state": "active"
}'
```
