Ask or search…
K
Links

Create a user with an avatar

Create a user and assign that user an avatar via the API.

1. Authorize and create an anonymous user

In this guide, we'll walk you through the process of creating an anonymous user and obtaining the access token required to access the API endpoints. The following endpoint will create a new user and it returns the access token to use for the creation of an avatar.
post
https://[your-subdomain].readyplayer.me/api/users
Create anonymous user

2. Create a default avatar for the user

To create and render an initial avatar for your user, you need to call 3 endpoints.

2.1 Fetch all possible templates

Firstly you need to fetch all of the possible templates that you can create an avatar from. Templates are pre-configured avatar templates which make it easier for you to create an avatar via the API. To fetch the avatar templates you can call the following endpoint authenticated with the token returned on the request from step 1.
get
https://api.readyplayer.me/v2/avatars/templates
Get all templates

2.2 Create a draft avatar from a template

Once you have made a call to fetch the list of templates, you can then take one of the template IDs and make a call to create a draft avatar for the user by calling the following endpoint.
post
https://api.readyplayer.me/v2/avatars/templates/[template-id]
Assign specific template to the user

2.3 Fetch draft avatar

After making the call to create your new draft avatar, you can then fetch this avatar as a GLB by calling the following URL with your new avatar-id.
get
https://api.readyplayer.me/v2/avatars/[avatar-id].glb?preview=true
Fetch the assigned avatar as a GLB file

2.4 Save draft avatar

The previous steps created a draft avatar for the user, which will expire after x amount of time. To save the avatar and permanently save it for the user, you will need to save the avatar with the following endpoint:
put
https://api.readyplayer.me/v2/avatars/[avatar-id]
Save updated avatar

3. Fetch avatar

You can now fetch your newly saved avatar from the URL below with the avatar id.
get
https://models.readyplayer.me/[avatar-id].glb
Return avatar in glb format

4. Customize your avatar

You now have a working example with Ready Player Me avatars. You can go now into the next section, which explains how to customize your character with outfits.