# Get Community Members

GET https://services.leadconnectorhq.com/social-media-posting/{locationId}/community/accounts/{accountId}/users

List the members you can publish a post as, for one connected Community channel.

`accountId` is the Community account ID from the Get Accounts API. Each Community account represents one channel and members are scoped to it: for a private channel only that channel's members are returned, for a public channel the group's members are. Always list members per account rather than reusing one list across accounts.

Pass a returned `contactId` as `communityPostDetails.postAsUser[accountId].id` when creating a post. Only members who can publish are returned — a member must be `Active` and hold a `role` in the group.

Results are paginated; `meta.nextPage` is `null` on the last page.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `socialplanner/oauth.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location Id |
| `accountId` | string | Yes | Community account Id, from the Get Accounts API |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `searchText` | string | No | Filter members by name. Communities matches on 2 or more characters; a less than 2 characters value returns no members. |
| `pageNo` | number | No | Page number for pagination. Defaults to 1. |
| `limit` | number | No | Number of members per page. Defaults to 10, max 100. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/{locationId}/community/accounts/{accountId}/users": {
      "get": {
        "summary": "Get Community Members",
        "operationId": "getCommunityMembers",
        "description": "List the members you can publish a post as, for one connected Community channel.\n\n`accountId` is the Community account ID from the Get Accounts API. Each Community account represents one channel and members are scoped to it: for a private channel only that channel's members are returned, for a public channel the group's members are. Always list members per account rather than reusing one list across accounts.\n\nPass a returned `contactId` as `communityPostDetails.postAsUser[accountId].id` when creating a post. Only members who can publish are returned — a member must be `Active` and hold a `role` in the group.\n\nResults are paginated; `meta.nextPage` is `null` on the last page.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location Id",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "required": true,
            "in": "path",
            "description": "Community account Id, from the Get Accounts API",
            "schema": {
              "example": "aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496",
              "type": "string"
            }
          },
          {
            "name": "searchText",
            "required": false,
            "in": "query",
            "description": "Filter members by name. Communities matches on 2 or more characters; a less than 2 characters value returns no members.",
            "schema": {
              "minLength": 2,
              "example": "jane",
              "type": "string"
            }
          },
          {
            "name": "pageNo",
            "required": false,
            "in": "query",
            "description": "Page number for pagination. Defaults to 1.",
            "schema": {
              "minimum": 1,
              "default": 1,
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of members per page. Defaults to 10, max 100.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 10,
              "example": 10,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCommunityUsersSuccessfulResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "404": {
            "description": "Community account not found: no active Community account with this `accountId` in the location",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "socialplanner/oauth.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetCommunityUsersSuccessfulResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 200
          },
          "message": {
            "type": "string",
            "description": "Message",
            "example": "Fetched Community Members"
          },
          "results": {
            "description": "Requested Results",
            "example": {
              "users": [
                {
                  "contactId": "YBjxnYiXJKmoyV7WDjjG",
                  "fullName": "Jane Cooper",
                  "avatar": "https://storage.googleapis.com/revex-communities/avatars/jane.png",
                  "role": "admin",
                  "status": "Active"
                }
              ],
              "meta": {
                "currentPage": 1,
                "nextPage": null,
                "prevPage": null,
                "total": 1
              }
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "users": {
                    "description": "Community members who can be selected to post as",
                    "example": [
                      {
                        "contactId": "YBjxnYiXJKmoyV7WDjjG",
                        "fullName": "Jane Cooper",
                        "role": "admin",
                        "status": "Active"
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "contactId": {
                          "type": "string",
                          "description": "Contact ID of the community member. Pass this as `communityPostDetails.postAsUser[accountId].id` when creating a post.",
                          "example": "YBjxnYiXJKmoyV7WDjjG"
                        },
                        "fullName": {
                          "type": "string",
                          "description": "Display name of the community member",
                          "example": "Jane Cooper"
                        },
                        "avatar": {
                          "type": "string",
                          "description": "Avatar URL of the community member",
                          "example": "https://storage.googleapis.com/revex-communities/avatars/jane.png"
                        },
                        "role": {
                          "type": "string",
                          "description": "Role held by the member in the group. A member without a role cannot publish.",
                          "example": "admin"
                        },
                        "status": {
                          "type": "string",
                          "description": "Membership status in the group. Only `Active` members can publish.",
                          "example": "Active"
                        }
                      },
                      "required": [
                        "contactId"
                      ],
                      "title": "CommunityMemberDTO"
                    }
                  },
                  "meta": {
                    "description": "Pagination metadata. `nextPage` is `null` on the last page.",
                    "example": {
                      "currentPage": 1,
                      "nextPage": 2,
                      "prevPage": null,
                      "total": 10
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "currentPage": {
                            "type": "number",
                            "description": "Current page number",
                            "example": 1
                          },
                          "nextPage": {
                            "type": "number",
                            "description": "Next page number, or `null` on the last page",
                            "example": 2,
                            "nullable": true
                          },
                          "prevPage": {
                            "type": "number",
                            "description": "Previous page number, or `null` on the first page",
                            "example": null,
                            "nullable": true
                          },
                          "total": {
                            "type": "number",
                            "description": "Number of members returned on this page, not the total across all pages. Page through using `nextPage` until it is `null`.",
                            "example": 10
                          }
                        },
                        "title": "PaginationMeta"
                      }
                    ]
                  }
                },
                "required": [
                  "users"
                ],
                "title": "GetCommunityUsersResponseDTO"
              }
            ]
          }
        },
        "required": [
          "success",
          "statusCode",
          "message"
        ],
        "title": "GetCommunityUsersSuccessfulResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "NotFoundDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for not found",
            "example": 404
          },
          "message": {
            "type": "string",
            "description": "Error message describing the not found failure",
            "example": "Not Found"
          },
          "error": {
            "type": "string",
            "description": "Error type identifier",
            "example": "The requested resource was not found"
          }
        },
        "title": "NotFoundDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const response = await ghl.socialMediaPosting.getCommunityMembers('<LOCATIONID>', '<ACCOUNTID>');
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

response = await client.socialMediaPosting.get_community_members('<LOCATIONID>', '<ACCOUNTID>')
print(response)
```

**PHP** (`gohighlevel/api-client`)

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

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$response = $ghl->socialMediaPosting->getCommunityMembers('<LOCATIONID>', '<ACCOUNTID>');
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/{locationId}/community/accounts/{accountId}/users"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/community/accounts/<accountId>/users' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
