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

# Services C API overview - PFEntity.h

> Services C API overview - PFEntity.h

## Functions

| Function                                                                                                                                           | Description                                                                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [PFEntityCloseHandle](/services/playfab/api-references/c/pfentity/functions/pfentityclosehandle)                                                   | Closes a PFEntityHandle.                                                                                                                                                                        |
| [PFEntityDuplicateHandle](/services/playfab/api-references/c/pfentity/functions/pfentityduplicatehandle)                                           | Duplicates a PFEntityHandle.                                                                                                                                                                    |
| [PFEntityGetAPIEndpoint](/services/playfab/api-references/c/pfentity/functions/pfentitygetapiendpoint)                                             | Gets the API endpoint for the PFServiceConfig associated with an entity handle.                                                                                                                 |
| [PFEntityGetAPIEndpointSize](/services/playfab/api-references/c/pfentity/functions/pfentitygetapiendpointsize)                                     | Gets the size of the buffer needed to hold the API endpoint string from an entity handle.                                                                                                       |
| [PFEntityGetEntityKey](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitykey)                                                 | Get the PFEntityKey for an entity.                                                                                                                                                              |
| [PFEntityGetEntityKeySize](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitykeysize)                                         | Get the size in bytes needed to store the PFEntityKey for an Entity.                                                                                                                            |
| [PFEntityGetEntityTokenAsync](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitytokenasync)                                   | Get the cached PFEntityToken for an Entity.                                                                                                                                                     |
| [PFEntityGetEntityTokenResult](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitytokenresult)                                 | Gets the result of a successful PFEntityGetEntityTokenAsync call.                                                                                                                               |
| [PFEntityGetEntityTokenResultSize](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitytokenresultsize)                         | Get the size in bytes needed to store the result of a PFEntityGetEntityTokenAsync call.                                                                                                         |
| [PFEntityGetSecretKey](/services/playfab/api-references/c/pfentity/functions/pfentitygetsecretkey)                                                 | Gets the PlayFab secretKey associated with a title Entity. Will fail with E\_PF\_NOSECRETKEY if there is no Secret Key associated with the provided Entity.                                     |
| [PFEntityGetSecretKeySize](/services/playfab/api-references/c/pfentity/functions/pfentitygetsecretkeysize)                                         | Gets the size of the buffer needed to hold the PlayFab secretKey. Will fail with E\_PF\_NOSECRETKEY if there is no Secret Key associated with the provided Entity.                              |
| [PFEntityIsTitlePlayer](/services/playfab/api-references/c/pfentity/functions/pfentityistitleplayer)                                               | Convenience method to check if an Entity is a Title Player. This is equivalent to calling PFEntityGetEntityKey and comparing entityKey.type to PFTitlePlayerEntityType.                         |
| [PFEntityRegisterTokenExpiredEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentityregistertokenexpiredeventhandler)         | Register a handler for EntityToken expired events.                                                                                                                                              |
| [PFEntityRegisterTokenRefreshedEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentityregistertokenrefreshedeventhandler)     | Register a handler for EntityToken refreshed events.                                                                                                                                            |
| [PFEntityTokenExpiredEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentitytokenexpiredeventhandler)                         | EntityToken expired event handler. Needed to reauthenticate players in scenarios where the SDK is unable to automatically refresh the cached EntityToken.                                       |
| [PFEntityTokenRefreshedEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentitytokenrefreshedeventhandler)                     | A handler invoked every time an Entity is automatically re-authenticated, thus obtaining a new EntityToken. An entity will be automatically re-authenticated prior to its EntityToken expiring. |
| [PFEntityUnregisterTokenExpiredEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentityunregistertokenexpiredeventhandler)     | Unregisters a previously registered callback.                                                                                                                                                   |
| [PFEntityUnregisterTokenRefreshedEventHandler](/services/playfab/api-references/c/pfentity/functions/pfentityunregistertokenrefreshedeventhandler) | Unregisters a previously registered PFEntityTokenRefreshedCallback.                                                                                                                             |

## Structures

| Structure                                                                          | Description                                                                              |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [PFEntityToken](/services/playfab/api-references/c/pfentity/structs/pfentitytoken) | PlayFab EntityToken and its expiration time. Used to authenticate PlayFab service calls. |


## Related topics

- [PFEntityGetEntityKey](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitykey.md)
- [PFEntityToken](/services/playfab/api-references/c/pfentity/structs/pfentitytoken.md)
- [PFEntityGetEntityKeySize](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitykeysize.md)
- [PFEntityGetEntityTokenAsync](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitytokenasync.md)
- [PFEntityGetEntityTokenResult](/services/playfab/api-references/c/pfentity/functions/pfentitygetentitytokenresult.md)
