---
schema_version: "1"
id: ff43ce3b3b44e36c00cc0e4678758ff8fbf199447c19cb180b18c77a9604bfc5
title: Communities Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_Communities_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Communities_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: baeb75dea0f36ea69356b88ea2c40a607b1ed085763170be4f47dbd941d29178
description: Get information about Experience Cloud sites in your org.These methods are for Communities. All methods are static.Get a list of Experience Cloud sites that the context user has access to.Get a list of Experience Cloud sites with the specified status that the context user has access to. Get information about an Experience Cloud site.
---
# Communities Class

Get information about Experience Cloud sites in your org.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## Communities Methods

These methods are for Communities. All methods are static.

- **[getCommunities()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Communities_static_methods.htm#apex_ConnectAPI_Communities_getCommunities)**  
    Get a list of Experience Cloud sites that the context user has access to.
- **[getCommunities(communityStatus)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Communities_static_methods.htm#apex_ConnectAPI_Communities_getCommunities_2)**  
    Get a list of Experience Cloud sites with the specified status that the context user has access to.
- **[getCommunity(communityId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Communities_static_methods.htm#apex_ConnectAPI_Communities_getCommunity)**  
    Get information about an Experience Cloud site.

### getCommunities()

Get a list of Experience Cloud sites that the context user has access to.

#### API Version

28.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CommunityPage getCommunities()

#### Return Value

Type: [ConnectApi.CommunityPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_communityPage.htm "Page of Experience Cloud sites.")

### getCommunities(communityStatus)

Get a list of Experience Cloud sites with the specified status that the context user has access to.

#### API Version

28.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CommunityPage getCommunities(ConnectApi.CommunityStatus communityStatus)

#### Parameters

**communityStatus**

Type: ConnectApi.​CommunityStatus

communityStatus—Status of the Experience Cloud site. Values are:

- Live
- Inactive
- UnderConstruction

#### Return Value

Type: [ConnectApi.CommunityPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_communityPage.htm "Page of Experience Cloud sites.")

### getCommunity(communityId)

Get information about an Experience Cloud site.

#### API Version

28.0

#### Available to Guest Users

35.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.Community getCommunity(String communityId)

#### Parameters

communityId

Type: String

ID of an Experience Cloud site. You can’t specify null or internal.

#### Return Value

Type: [ConnectApi.​Community](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_community.htm "Experience Cloud site.")