Ask or search…

Unlocking assets through API (Beta)

Unlock/lock specific assets for certain users through API calls
his documentation covers a set of API endpoints to manage assets for users, including unlocking and locking them and equipping and unequipping them on avatars.

Authorizing requests:

For all subsequent requests to the Asset endpoints, you need an API Key. Please go to Studio -> API Keys to create one.
You can authorize by adding x-api-key to the header of the request.
--header 'x-api-key: {your-api-key}'
Refer to API docs for more info about common error codes and else.
The API key needs to have "WRITE" permissions for Users, Assets and Avatars.

1. Create a locked asset

Before you can start unlocking an asset for users you need to have an asset that is locked - not usable without unlocking. You can think of a locked = true asset as premium, something that needs to be bought or earned and locked = false as free.
Use this endpoint to create a new locked asset by setting locked property as true
Use this endpoint to turn an existing asset into a locked asset
See Manage custom outfits using the API for more information about asset management.

2. Unlock an Asset for the User

Locked assets should be unlocked first to be usable by the user. You should unlock the asset for the user after they have successfully purchased it or claimed through other means.
Use this endpoint for unlocking an asset for a user
If the asset is already unlocked for this user, the endpoint will respond with an error.
While the user might initiate the flow, such as by making a purchase, ensure that the call is made from your backend, as it involves your API key.

3. Lock an Asset for a User

You can lock a previously unlocked asset for a given user.
Use this endpoint for locking an unlocked asset for a user
If the asset hasn’t been unlocked for this user, this endpoint will respond with an error.
Successfully calling this endpoint will also automatically unequip this asset from all of the user’s avatars.

4. Equip an Asset on an Avatar

If you unlocked an asset for a user, you can equip the asset to any of your user’s avatars.
Use this endpoint to equip an unlocked asset to a user's avatar

5. Unequip an Asset from an Avatar

Similarly, as with equip-asset, you can also unequip an asset from an avatar.
In the request’s body, provide the avatar’s ID and the asset’s ID.
Use this endpoint to unequip an asset from a user's avatar