Procedure:
This article explains how to delete a specific key-value pair in Unity Cloud Save using the REST API and Basic Authentication with a Service Account. This method is ideal for automating data deletion or performing admin tasks outside of the Unity Dashboard.
I used Postman for this article, but feel free to use any software and adjust the steps accordingly.
Sections:
- Service Account Setup and Authorization
- Deleting a Key Using Basic Auth
- Visual Aid
- Other Deletion Endpoints in Cloud Save
- Important Considerations
Service Account Setup and Authorization
To use the Admin API for deletion, ensure:
- You have a Service Account set up in the Unity Dashboard.
- The Service Account has been granted the Cloud Save Editor role (project-level permission).
- You have access to the Key ID and Secret Key from the service account.
You’ll authenticate your requests using Basic Authentication:
- Username = Key ID
- Password = Secret Key
Deleting a Key Using Basic Auth
Step 1: Enter DELETE request URL
To delete a specific key-value pair for a player, make a DELETE
request to the following endpoint:
DELETE https://services.api.unity.com/cloud-save/v1/data/projects/{projectId}/environments/{environmentId}/players/{playerId}/items/{key}?writeLock={writeLock}
Replace placeholders:
-
{projectId}
– Your Unity project ID -
{environmentId}
– The environment ID (e.g.,production
) -
{playerId}
– The player’s Unity Authentication ID -
{key}
– The Cloud Save key you wish to delete -
{writeLock}
– The current write lock value for the key (you can retrieve this by fetching the item first)*
*this isn't required, but good practice to prevent accidental overwrites or conflicts.
Step 2: Authenticate the request in Postman
- In Postman, go to the Authorization tab.
- Set Type to
Basic Auth
. - For Username, enter your Key ID (from your Unity Service Account).
- For Password, enter your Secret Key (from the same Service Account).
- Postman will automatically add the correct
Authorization
header to your request.
Visual Aid
The Unity Dashboard has two key areas you’ll need to reference:
-
Service Accounts page (under Administration):
- Key ID = used as the username in Basic Auth
- Secret Key = used as the password in Basic Auth*
*the [Add Key] button will appear after creating a Service Account and will automatically open the window below.
- The Player Data page (within Cloud Save)*.
-
Player Data page (under Cloud Save)*:
- Project ID – visible in the URL
- Environment ID – visible in the URL
- Player ID – shown in the header
- Key – shown in the Key column
- Write Lock – shown in the Write Lock column
*the Player Data page will show all of this information after selecting the player and viewing an individual player's data.
Other Deletion Endpoints in Cloud Save
Unity Cloud Save supports additional deletion options:
Endpoint | Description |
---|---|
deleteItems |
Delete multiple key-value pairs |
deletePublicItem / deletePublicItems
|
Delete public (non-authenticated) data |
deleteProtectedItem / deleteProtectedItems
|
Delete protected data |
deleteFile |
Delete uploaded player files |
Check the Unity Cloud Save API documentation for full details.
Important Considerations
- There is no “Delete All” option in the Dashboard — bulk deletion requires scripting.
- Deleting player data does not delete the player ID. Use the Unity Authentication API to remove the player record entirely.
- Including a Write Lock in delete requests helps prevent accidental overwrites or race conditions.
- Player-uploaded files are stored separately from key-value pairs — use
deleteFile
to manage them.