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

# PFEntityGetEntityKey

> Get the PFEntityKey for an entity.

Get the PFEntityKey for an entity.

## Syntax

```cpp theme={null}
HRESULT PFEntityGetEntityKey(  
    PFEntityHandle entityHandle,  
    size_t bufferSize,  
    void* buffer,  
    const PFEntityKey** entityKey,  
    size_t* bufferUsed  
)  
```

### Parameters

**`entityHandle`**   PFEntityHandle

PFEntityHandle returned from a auth call.

**`bufferSize`**   size\_t

The size of the buffer for the PFEntityKey. The required size can be obtained from PFEntityGetEntityKeySize.

**`buffer`**   void\*<br />\**Out\_writes\_bytes\_to*(bufferSize,*bufferUsed)*

Byte buffer used for the PFEntityKey and its fields.

**`entityKey`**   [PFEntityKey\*\*](/services/playfab/api-references/c/pftypes/structs/pfentitykey-c)<br />*library-allocated output*

TBD

**`bufferUsed`**   size\_t\*<br />*optional output*

The number of bytes in the provided buffer that were used.

### Return value

Type: HRESULT

Result code for this API operation.

## Remarks

entityKey is a pointer within buffer and does not need to be freed separately.

## Requirements

**Header:** PFEntity.h

## See also

[PFEntity members](/services/playfab/api-references/c/pfentity/pfentity_members)


## Related topics

- [PFEntityIsTitlePlayer](/services/playfab/api-references/c/pfentity/functions/pfentityistitleplayer.md)
- [Entity Handles](/services/playfab/sdks/c/entity-handles.md)
- [Quickstart GDK](/services/playfab/sdks/c/quickstart-gdk.md)
- [Quickstart iOS](/services/playfab/sdks/c/quickstart-ios.md)
- [Quickstart Linux](/services/playfab/sdks/c/quickstart-linux.md)
