Skip to main content

Integrate into your website

Avaturn can be easily embedded into your website! It's free.

  • Please find a complete example at CodeSandbox.
  • See three.js example here: link :::

Basic integration

You can use <iframe> element to embed Avaturn into your web page. Add this to your web page:

allow="camera *; clipboard-write"

This is how it could look:

You can tune the styles of the iframe (at least height and width to make it look good on your web site). You can also embed it full screen (demo, CodeSandbox).

This example embeds domain. This is ok for initial test, but this domain has limitations. Please create your own domain <your-app-name> with all features unlocked at developer portal.


Receiving an avatar

So far we've just embedded Avaturn, but we need to be able to interact with it. Specifically, we need to receive avatar once it's created. This is done using messaging mechanics. Once a user finishes customizing their avatar and presses Save button, Avaturn sends a message to your web page.

"source": "avaturn", // always 'avaturn', you should check this value when receiving the message
"date": "...", // `` for the moment when the message was created
"eventName": "...", // event name is one of ["v2.avatar.exported"]
"data": {
"url": "...",
"urlType": "..." // 'httpURL' | 'dataURL'

On you webpage you can receive the event like this.

function subscribe(event) {
/* Here we process the events from the iframe */

let json;
try {
json = JSON.parse(;
} catch (error) {
console.log('Error parsing the event data.');

if (json.source !== 'avaturn') {

// Get avatar GLB URL
if (json.eventName === 'v2.avatar.exported') {
// `json` now holds the message
// `` is url for the avatar

Putting it all together

Please find end-to-end example here:

Edit web_sdk-example