> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tutorial to Count Players of a Segment

> Retrieve the player count for a PlayFab segment using the new GetSegmentPlayerCount API (preview), which replaces the retired GetPlayersInSegment endpoint.

# Count Players of a Segment (Preview)

<Note>
  The GetSegmentPlayerCount API is in preview. We anticipate ongoing changes to it as we continue gathering feedback and optimizing for customer use.
</Note>

This tutorial walks you through getting the player count of a given segment using the new GetSegmentPlayerCount APIs (currently in preview). These APIs, together with the ExportPlayersInSegment API and GetSegmentExport API, fully replace the functionality of the retired GetPlayersInSegment APIs. For getting started with the export APIs, follow this tutorial: [Tutorial to export players in a Segment - PlayFab | Microsoft Learn.](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-export-players-in-a-segment)

Send a POST request with the Segment ID as a payload to the GetSegmentPlayerCount API. The 'ProfilesInSegment' in the response is the player count for the segment.

<img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/get-segment-player-count.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=6ffdf5b78fa010288319a7538599f230" alt="Get Segment Player Count" width="1833" height="387" data-path="images/playfab/data-analytics/acting-data/get-segment-player-count.png" />

<Note>
  The API requires the ‘X-SecretKey’ header with the value being a Title Secret key. The ‘Content-Type’ header should be set to ‘application/json’
</Note>


## Related topics

- [Tutorial to export players in a Segment](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-export-players-in-a-segment.md)
- [Player Segments](/services/playfab/player-progression/player-data/player-segments.md)
- [Player Segment configuration](/services/playfab/player-progression/player-data/player-segment-configuration.md)
- [Segment Configuration](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-configuration.md)
- [PFSegmentsGetPlayersInSegmentResult](/services/playfab/api-references/c/pfsegmentstypes/structs/pfsegmentsgetplayersinsegmentresult.md)
