Unlocking assets through API (Beta)
Unlock/lock specific assets for certain users through API calls
This documentation covers a set of API endpoints to manage assets for users, including unlocking and locking them and equipping and unequipping them on avatars.
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}'
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.post
https://api.readyplayer.me/v1
/assets
Use this endpoint to create a new locked asset by setting locked property as true
patch
https://api.readyplayer.me/v1
/assets/:id
Use this endpoint to turn an existing asset into a locked asset
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.
put
https://api.readyplayer.me/v1/assets/:id/
unlock
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.
You can lock a previously unlocked asset for a given user.
put
https://api.readyplayer.me/v1/assets/:id/
lock
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.
If you unlocked an asset for a user, you can equip the asset to any of your user’s avatars.
put
https://api.readyplayer.me/v1/avatars/:id/
equip
Use this endpoint to equip an unlocked asset to a user's 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.
put
https://api.readyplayer.me/v1/avatars/:id/
unequip
Use this endpoint to unequip an asset from a user's avatar