> ## 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.

# PFSegmentsServerAddPlayerTagAsync

> Adds a given tag to a player profile. The tag's namespace is automatically generated based on the source of the tag.

Adds a given tag to a player profile. The tag's namespace is automatically generated based on the source of the tag.

## Syntax

```cpp theme={null}
HRESULT PFSegmentsServerAddPlayerTagAsync(  
    PFEntityHandle titleEntityHandle,  
    const PFSegmentsAddPlayerTagRequest* request,  
    XAsyncBlock* async  
)  
```

### Parameters

**`titleEntityHandle`**   PFEntityHandle

PFEntityHandle for a title Entity obtained using PFAuthenticationGetEntityWithSecretKeyAsync.

**`request`**   [PFSegmentsAddPlayerTagRequest\*](/services/playfab/api-references/c/pfsegmentstypes/structs/pfsegmentsaddplayertagrequest)

Populated request object.

**`async`**   XAsyncBlock\*<br />*Inout*

XAsyncBlock for the async operation.

### Return value

Type: HRESULT

Result code for this API operation.

## Remarks

This API is available on Win32, Linux, and macOS. This API will trigger a player\_tag\_added event and add a tag with the given TagName and PlayFabID to the corresponding player profile. TagName can be used for segmentation and it is limited to 256 characters. Also there is a limit on the number of tags a title can have. See also ServerGetPlayerTagsAsync, ServerRemovePlayerTagAsync. Call XAsyncGetStatus to get the status of the operation. If the service call is unsuccessful, the async result will be E\_PF\_PLAYER\_TAG\_COUNT\_LIMIT\_EXCEEDED or any of the global PlayFab Service errors. See doc page "Handling PlayFab Errors" for more details on error handling.

## Requirements

**Header:** PFSegments.h

## See also

[PFSegments members](/services/playfab/api-references/c/pfsegments/pfsegments_members)


## Related topics

- [Services C API overview - PFSegments.h](/services/playfab/api-references/c/pfsegments/pfsegments_members.md)
- [PFSegmentsServerGetPlayerTagsAsync](/services/playfab/api-references/c/pfsegments/functions/pfsegmentsservergetplayertagsasync.md)
- [PFSegmentsServerRemovePlayerTagAsync](/services/playfab/api-references/c/pfsegments/functions/pfsegmentsserverremoveplayertagasync.md)
- [PFSegmentsServerGetPlayerTagsGetResult](/services/playfab/api-references/c/pfsegments/functions/pfsegmentsservergetplayertagsgetresult.md)
- [PFSegmentsAddPlayerTagRequest](/services/playfab/api-references/c/pfsegmentstypes/structs/pfsegmentsaddplayertagrequest.md)
