# List account members

GET https://app.launchdarkly.com/api/v2/members

Return a list of account members.

By default, this returns the first 20 members. Page through this list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links are not present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page.

### Filtering members

LaunchDarkly supports the following fields for filters:

- `query` is a string that matches against the members' emails and names. It is not case sensitive.
- `role` is a `|` separated list of roles and custom roles. It filters the list to members who have any of the roles in the list. For the purposes of this filtering, `Owner` counts as `Admin`.
- `id` is a `|` separated list of member IDs. It filters the list to members who match any of the IDs in the list.
- `email` is a `|` separated list of member emails. It filters the list to members who match any of the emails in the list.
- `team` is a string that matches against the key of the teams the members belong to. It is not case sensitive.
- `noteam` is a boolean that filters the list of members who are not on a team if true and members on a team if false.
- `lastSeen` is a JSON object in one of the following formats:
  - `{"never": true}` - Members that have never been active, such as those who have not accepted their invitation to LaunchDarkly, or have not logged in after being provisioned via SCIM.
  - `{"noData": true}` - Members that have not been active since LaunchDarkly began recording last seen timestamps.
  - `{"before": 1608672063611}` - Members that have not been active since the provided value, which should be a timestamp in Unix epoch milliseconds.
- `accessCheck` is a string that represents a specific action on a specific resource and is in the format `<ActionSpecifier>:<ResourceSpecifier>`. It filters the list to members who have the ability to perform that action on that resource. Note: `accessCheck` is only supported in API version `20220603` and earlier. To learn more, read [Versioning](https://launchdarkly.com/docs/api#versioning).
  - For example, the filter `accessCheck:createApprovalRequest:proj/default:env/test:flag/alternate-page` matches members with the ability to create an approval request for the `alternate-page` flag in the `test` environment of the `default` project.
  - Wildcard and tag filters are not supported when filtering for access.

For example, the filter `query:abc,role:admin|customrole` matches members with the string `abc` in their email or name, ignoring case, who also are either an `Owner` or `Admin` or have the custom role `customrole`.

### Sorting members

LaunchDarkly supports two fields for sorting: `displayName` and `lastSeen`:

- `displayName` sorts by first + last name, using the member's email if no name is set.
- `lastSeen` sorts by the `_lastSeen` property. LaunchDarkly considers members that have never been seen or have no data the oldest.

### Expanding the members response
LaunchDarkly supports two fields for expanding the "List members" response. By default, these fields are **not** included in the response.

To expand the response, append the `expand` query parameter and add a comma-separated list with any of the following fields:

* `customRoles` includes a list of the roles that you have assigned to the member.
* `roleAttributes` includes a list of the role attributes that you have assigned to the member.

For example, `expand=roleAttributes` includes `roleAttributes` field in the response.


Reference: https://launchdarkly.com/docs/api/account-members/get-members

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/members:
    get:
      operationId: get-members
      summary: List account members
      description: >
        Return a list of account members.


        By default, this returns the first 20 members. Page through this list
        with the `limit` parameter and by following the `first`, `prev`, `next`,
        and `last` links in the returned `_links` field. These links are not
        present if the pages they refer to don't exist. For example, the `first`
        and `prev` links will be missing from the response on the first page.


        ### Filtering members


        LaunchDarkly supports the following fields for filters:


        - `query` is a string that matches against the members' emails and
        names. It is not case sensitive.

        - `role` is a `|` separated list of roles and custom roles. It filters
        the list to members who have any of the roles in the list. For the
        purposes of this filtering, `Owner` counts as `Admin`.

        - `id` is a `|` separated list of member IDs. It filters the list to
        members who match any of the IDs in the list.

        - `email` is a `|` separated list of member emails. It filters the list
        to members who match any of the emails in the list.

        - `team` is a string that matches against the key of the teams the
        members belong to. It is not case sensitive.

        - `noteam` is a boolean that filters the list of members who are not on
        a team if true and members on a team if false.

        - `lastSeen` is a JSON object in one of the following formats:
          - `{"never": true}` - Members that have never been active, such as those who have not accepted their invitation to LaunchDarkly, or have not logged in after being provisioned via SCIM.
          - `{"noData": true}` - Members that have not been active since LaunchDarkly began recording last seen timestamps.
          - `{"before": 1608672063611}` - Members that have not been active since the provided value, which should be a timestamp in Unix epoch milliseconds.
        - `accessCheck` is a string that represents a specific action on a
        specific resource and is in the format
        `<ActionSpecifier>:<ResourceSpecifier>`. It filters the list to members
        who have the ability to perform that action on that resource. Note:
        `accessCheck` is only supported in API version `20220603` and earlier.
        To learn more, read
        [Versioning](https://launchdarkly.com/docs/api#versioning).
          - For example, the filter `accessCheck:createApprovalRequest:proj/default:env/test:flag/alternate-page` matches members with the ability to create an approval request for the `alternate-page` flag in the `test` environment of the `default` project.
          - Wildcard and tag filters are not supported when filtering for access.

        For example, the filter `query:abc,role:admin|customrole` matches
        members with the string `abc` in their email or name, ignoring case, who
        also are either an `Owner` or `Admin` or have the custom role
        `customrole`.


        ### Sorting members


        LaunchDarkly supports two fields for sorting: `displayName` and
        `lastSeen`:


        - `displayName` sorts by first + last name, using the member's email if
        no name is set.

        - `lastSeen` sorts by the `_lastSeen` property. LaunchDarkly considers
        members that have never been seen or have no data the oldest.


        ### Expanding the members response

        LaunchDarkly supports two fields for expanding the "List members"
        response. By default, these fields are **not** included in the response.


        To expand the response, append the `expand` query parameter and add a
        comma-separated list with any of the following fields:


        * `customRoles` includes a list of the roles that you have assigned to
        the member.

        * `roleAttributes` includes a list of the role attributes that you have
        assigned to the member.


        For example, `expand=roleAttributes` includes `roleAttributes` field in
        the response.
      tags:
        - subpackage_accountMembers
      parameters:
        - name: limit
          in: query
          description: The number of members to return in the response. Defaults to 20.
          required: false
          schema:
            type: integer
            format: int64
        - name: offset
          in: query
          description: >-
            Where to start in the list. This is for use with pagination. For
            example, an offset of 10 skips the first ten items and then returns
            the next items in the list, up to the query `limit`.
          required: false
          schema:
            type: integer
            format: int64
        - name: filter
          in: query
          description: >-
            A comma-separated list of filters. Each filter is of the form
            `field:value`. Supported fields are explained above.
          required: false
          schema:
            type: string
            format: string
        - name: expand
          in: query
          description: >-
            A comma-separated list of properties that can reveal additional
            information in the response.
          required: false
          schema:
            type: string
            format: string
        - name: sort
          in: query
          description: >-
            A comma-separated list of fields to sort by. Fields prefixed by a
            dash ( - ) sort in descending order.
          required: false
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Members collection response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Members'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorRep'
        '404':
          description: Invalid resource identifier
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    Link:
      type: object
      properties:
        href:
          type: string
          description: The URL of the link
        type:
          type: string
          description: The type of the link
      title: Link
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    LastSeenMetadata:
      type: object
      properties:
        tokenId:
          type: string
          description: The ID of the token used in the member's last session
      title: LastSeenMetadata
    IntegrationStatus:
      type: object
      properties:
        display:
          type: string
        value:
          type: string
      required:
        - display
        - value
      title: IntegrationStatus
    IntegrationMetadata:
      type: object
      properties:
        externalId:
          type: string
        externalStatus:
          $ref: '#/components/schemas/IntegrationStatus'
        externalUrl:
          type: string
        lastChecked:
          $ref: '#/components/schemas/UnixMillis'
      required:
        - externalId
        - externalStatus
        - externalUrl
        - lastChecked
      title: IntegrationMetadata
    MemberTeamSummaryRep:
      type: object
      properties:
        customRoleKeys:
          type: array
          items:
            type: string
          description: A list of keys of the custom roles this team has access to
        key:
          type: string
          description: The team key
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
        name:
          type: string
          description: The team name
      required:
        - customRoleKeys
        - key
        - name
      title: MemberTeamSummaryRep
    MemberPermissionGrantSummaryRep:
      type: object
      properties:
        actionSet:
          type: string
          description: >-
            The name of the group of related actions to allow. A permission
            grant may have either an <code>actionSet</code> or a list of
            <code>actions</code> but not both at the same time.
        actions:
          type: array
          items:
            type: string
          description: >-
            A list of actions to allow. A permission grant may have either an
            <code>actionSet</code> or a list of <code>actions</code> but not
            both at the same time.
        resource:
          type: string
          description: The resource for which the actions are allowed
      required:
        - resource
      title: MemberPermissionGrantSummaryRep
    OAuthProviderKind:
      type: string
      title: OAuthProviderKind
    RoleAttributeValues:
      type: array
      items:
        type: string
      title: RoleAttributeValues
    RoleAttributeMap:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/RoleAttributeValues'
      title: RoleAttributeMap
    Member:
      type: object
      properties:
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        _id:
          type: string
          description: The member's ID
        firstName:
          type: string
          description: The member's first name
        lastName:
          type: string
          description: The member's last name
        role:
          type: string
          description: >-
            The member's base role. If the member has no additional roles, this
            role will be in effect.
        email:
          type: string
          description: The member's email address
        _pendingInvite:
          type: boolean
          description: Whether the member has a pending invitation
        _verified:
          type: boolean
          description: Whether the member's email address has been verified
        _pendingEmail:
          type: string
          description: >-
            The member's email address before it has been verified, for accounts
            where email verification is required
        customRoles:
          type: array
          items:
            type: string
          description: >-
            The set of additional roles, besides the base role, assigned to the
            member
        mfa:
          type: string
          description: Whether multi-factor authentication is enabled for this member
        excludedDashboards:
          type: array
          items:
            type: string
          description: Default dashboards that the member has chosen to ignore
        _lastSeen:
          $ref: '#/components/schemas/UnixMillis'
          description: The member's last session date (as Unix milliseconds since epoch)
        _lastSeenMetadata:
          $ref: '#/components/schemas/LastSeenMetadata'
          description: >-
            Additional metadata associated with the member's last session, for
            example, whether a token was used
        _integrationMetadata:
          $ref: '#/components/schemas/IntegrationMetadata'
          description: >-
            Details on the member account in an external source, if this member
            is provisioned externally
        teams:
          type: array
          items:
            $ref: '#/components/schemas/MemberTeamSummaryRep'
          description: Details on the teams this member is assigned to
        permissionGrants:
          type: array
          items:
            $ref: '#/components/schemas/MemberPermissionGrantSummaryRep'
          description: >-
            A list of permission grants. Permission grants allow a member to
            have access to a specific action, without having to create or update
            a custom role.
        creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the member was created
        oauthProviders:
          type: array
          items:
            $ref: '#/components/schemas/OAuthProviderKind'
          description: A list of OAuth providers
        version:
          type: integer
          description: Version of the current configuration
        roleAttributes:
          $ref: '#/components/schemas/RoleAttributeMap'
          description: The role attributes for the member
      required:
        - _links
        - _id
        - role
        - email
        - _pendingInvite
        - _verified
        - customRoles
        - mfa
        - _lastSeen
        - creationDate
      title: Member
    Members:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Member'
          description: An array of members
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        totalCount:
          type: integer
          description: The number of members returned
      required:
        - items
        - _links
      title: Members
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    ForbiddenErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: ForbiddenErrorRep
    NotFoundErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: NotFoundErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/members"

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/members';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/members"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/members")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/members")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.launchdarkly.com/api/v2/members', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/members");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/members")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```