# Get team membership for a user

From **GitHub v3 REST API**.

`GET /orgs/{org}/teams/{team_slug}/memberships/{username}`

Team members will include the members of child teams.

To get a user's membership with a team, the team must be visible to the authenticated user.

**Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/memberships/{username}`.

**Note:**
The response contains the `state` of the membership and the member's `role`.

The `role` for organization owners is set to `maintainer`. For more information about `maintainer` roles, see see [Create a team](https://docs.github.com/enterprise-server@3.0/rest/reference/teams#create-a-team).

## Parameters

### `org`

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

### `team_slug`

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

team_slug parameter

### `username`

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

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Team Membership

```json
{
  "role": "maintainer",
  "state": "active",
  "url": "https://api.github.com/teams/1/memberships/octocat"
}
```

```json
{"description":"Team Membership","properties":{"role":{"default":"member","description":"The role of the user in the team.","enum":["member","maintainer"],"example":"member","type":"string"},"state":{"description":"The state of the user's membership in the team.","enum":["active","pending"],"type":"string"},"url":{"format":"uri","type":"string"}},"required":["role","state","url"],"title":"Team Membership","type":"object"}
```

### `404`

if user has no team membership

## Request examples

### cURL

```shell
curl --request GET \
  --url {protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/memberships/{username}
```
