Create Avatar & Render (fast)

By default, creating an avatar using the Loom AI API involves a full solve as well as rendering a preview. If you wish to simply render one specific pose or animation, you can skip the defaults and roughly save half of the time necessary for the total process. However, if you plan to export your avatar's GLTF and/or do further subsequent renderings, the defaults will save time.

1. Authenticate

Select the appropriate oauth2 authentication flow for your use case and obtain an API access token. See Authentication for details.

For sake of simplicity of this example, you can use your application's client credentials to authenticate directly using the oauth2 resource owner flow. Returns an access token on success.

If you use other authentication flows, make sure to enable scopes read:avatars write:avatars read:renderings write:renderings.

curl --request POST \
  --url 'https://auth.loomai.com/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=http://auth0.com/oauth/grant-type/password-realm \
  --data realm=Username-Password-Authentication \
  --data username={PASSWORD} \
  --data password={USERNAME} \
  --data audience=https%3A%2F%2Fapi.loomai.com%2F \
  --data client_id={CLIENT_ID} \
  --data client_secret={CLIENT_SECRET}

2. Create Avatar w/o Defaults

Post a photo of a face to create an avatar. Returns response header X-Loom-Status containing the id of created avatar if successful. See Avatars > Create for details.

Note the query parameters solve and render disabling the default solve of uploaded photograph as well as rendering of a preview respectively.

curl -X POST "https://api.loomai.com/v0.5/avatars?solve=false&render=false" \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@{IMAGE_FILE};type=image/jpeg"

3. Create Rendering

Following call renders your avatar in pose hi with white background color. For more details on parameters, available stickers & animations, see Avatars > Renderings > Create.

Renderings are processed asynchronously. See Avatars > Renderings > Resolve Status for details on how to query processing status.

See Avatars > Renderings > Resolve to resolve rendererd avatar upon completion.

curl -X POST 'https://api.loomai.com/v0.5/avatars/{AVATAR_ID}/renderings?pose=hi&background_color=#fff' \
  -H "Authorization: Bearer {ACCESS_TOKEN}"

Last updated