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

# PFStatisticsCreateStatisticDefinitionAsync

> Reference for PFStatisticsCreateStatisticDefinitionAsync, a PlayFab Services C API function that creates a new entity statistic definition.

Create a new entity statistic definition.

## Syntax

```cpp theme={null}
HRESULT PFStatisticsCreateStatisticDefinitionAsync(  
    PFEntityHandle entityHandle,  
    const PFStatisticsCreateStatisticDefinitionRequest* request,  
    XAsyncBlock* async  
)  
```

### Parameters

**`entityHandle`**   PFEntityHandle

PFEntityHandle to use for authentication.

**`request`**   [PFStatisticsCreateStatisticDefinitionRequest\*](/services/playfab/api-references/c/pfstatisticstypes/structs/pfstatisticscreatestatisticdefinitionrequest)

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 Windows, Linux, and macOS. See also StatisticDeleteStatisticDefinitionAsync. Call XAsyncGetStatus to get the status of the operation. If the service call is unsuccessful, the async result will be E\_PF\_AGGREGATION\_TYPE\_NOT\_ALLOWED\_FOR\_LINKED\_STAT, E\_PF\_AGGREGATION\_TYPE\_NOT\_ALLOWED\_FOR\_MULTI\_COLUMN\_STATISTIC, E\_PF\_API\_NOT\_ENABLED\_FOR\_TITLE, E\_PF\_DUPLICATE\_COLUMN\_NAME\_FOUND, E\_PF\_DUPLICATE\_STATISTIC\_NAME, E\_PF\_ENTITY\_TYPE\_SPECIFIED\_REQUIRES\_AGGREGATION\_SOURCE, E\_PF\_EXTERNAL\_ENTITY\_NOT\_ALLOWED\_FOR\_TIER, E\_PF\_INVALID\_BASE\_TIME\_FOR\_INTERVAL, E\_PF\_INVALID\_ENTITY\_TYPE\_FOR\_AGGREGATION, E\_PF\_MAX\_QUERYABLE\_VERSIONS\_EXCEEDED, E\_PF\_MAX\_QUERYABLE\_VERSIONS\_VALUE\_NOT\_ALLOWED\_FOR\_TIER, E\_PF\_MULTI\_LEVEL\_AGGREGATION\_NOT\_ALLOWED, E\_PF\_PLAY\_FAB\_ERROR\_EVENT\_NOT\_SUPPORTED\_FOR\_ENTITY\_TYPE, E\_PF\_STATISTIC\_COLUMN\_AGGREGATION\_MISMATCH, E\_PF\_STATISTIC\_COLUMN\_LENGTH\_MISMATCH, E\_PF\_STATISTIC\_COUNT\_LIMIT\_EXCEEDED, E\_PF\_STATISTIC\_DEFINITION\_HAS\_NULL\_OR\_EMPTY\_VERSION\_CONFIGURATION, E\_PF\_STATISTIC\_NAME\_CONFLICT, E\_PF\_STATISTIC\_NOT\_FOUND, E\_PF\_VERSION\_CONFIGURATION\_CANNOT\_BE\_SPECIFIED\_FOR\_LINKED\_STAT, E\_PF\_VERSION\_CONFIGURATION\_IS\_REQUIRED or any of the global PlayFab Service errors. See doc page "Handling PlayFab Errors" for more details on error handling.

## Requirements

**Header:** PFStatistics.h

## See also

[PFStatistics members](/services/playfab/api-references/c/pfstatistics/pfstatistics_members)


## Related topics

- [Services C API overview - PFStatistics.h](/services/playfab/api-references/c/pfstatistics/pfstatistics_members.md)
- [PFStatisticsGetStatisticDefinitionAsync](/services/playfab/api-references/c/pfstatistics/functions/pfstatisticsgetstatisticdefinitionasync.md)
- [PFStatisticsListStatisticDefinitionsAsync](/services/playfab/api-references/c/pfstatistics/functions/pfstatisticsliststatisticdefinitionsasync.md)
- [PFStatisticsDeleteStatisticDefinitionAsync](/services/playfab/api-references/c/pfstatistics/functions/pfstatisticsdeletestatisticdefinitionasync.md)
- [PFStatisticsUpdateStatisticDefinitionAsync](/services/playfab/api-references/c/pfstatistics/functions/pfstatisticsupdatestatisticdefinitionasync.md)
