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

# How to set internal player data

> Set internal PlayFab player data through server APIs to store private key-value fields tied to a player that are inaccessible from game clients.

To set internal player data, use the Server API [UpdateUserInternalData](xref:titleid.playfabapi.com.server.playerdatamanagement.updateuserinternaldata) method. This is data that the client can't access.

The C# Sample in this article are written for the Unity SDK. The Unity SDK uses an event driven model to handle non-synchronous tasks. To run the sample code using the C# SDK, you must modify the code to use an async Task model. Methods that must be modified have Async append to the method name in the signature. For example, SetObject in the Unity SDK becomes SetObjectAsync in the C# SDK. For more information, see [Asynchronous programming with async and await](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/).

## C# code example

The following **C#** code example uses the PlayFab server API to create (or update, if a key value already exists) the KVPs with the key named `Class`, with the value `Fighter`, and `Race` with the value `Human`.

```csharp theme={null}
public void UpdateUserInternalData() {
    PlayFabServerAPI.UpdateUserInternalData(new UpdateUserInternalDataRequest() {
        PlayFabId = "user PlayFabId here - obtained from any successful LoginResult",
        Data = new Dictionary<string, string>() {
            {"Class", "Fighter"},
            {"Race", "Human"},
        },
    },
    result => Debug.Log("Set internal user data successful"),
    error => {
        Debug.Log("Got error updating internal user data:");
        Debug.Log(error.GenerateErrorReport());
    });
}
```

## See also

[How to get internal player data](/services/playfab/player-progression/player-data/how-to-get-internal-player-data)


## Related topics

- [How to get internal player data](/services/playfab/player-progression/player-data/how-to-get-internal-player-data.md)
- [Quickstart Player Data](/services/playfab/player-progression/player-data/quickstart.md)
- [How to set read-only player data](/services/playfab/player-progression/player-data/how-to-set-read-only-player-data.md)
- [PFPlayerDataManagementServerGetUserInternalDataAsync](/services/playfab/api-references/c/pfplayerdatamanagement/functions/pfplayerdatamanagementservergetuserinternaldataasync.md)
- [PFPlayerDataManagementServerGetUserPublisherInternalDataAsync](/services/playfab/api-references/c/pfplayerdatamanagement/functions/pfplayerdatamanagementservergetuserpublisherinternaldataasync.md)
