MavatoraDeveloper APIOpen studio

Put a talking avatar on your website

Every avatar has its own ID. Its face, voice and character come ready from the studio. You add one line of code and set your own rules on your side.

Quick start

  1. Sign in to the studio, create an avatar and save it to the library.
  2. Open your account menu → Developer API. Turn the avatar on and add your website domain to Allowed websites.
  3. Copy the embed code and paste it before </body> on your site.
<script src="https://mavatora.com/embed.js"
        data-avatar-id="AVATAR_ID"
        data-key="SITE_KEY"
        async></script>

That's it: a round button with the avatar's photo appears in the corner. Visitors click it and talk by voice.

Key only. data-avatar-id is optional. Without it, the first avatar you enabled in Developer API is used:

<script src="https://mavatora.com/embed.js" data-key="SITE_KEY" async></script>

Install options

1. Floating button

The code above. Add data-position="left" to put it on the left, data-label="Ask Anna" to change the label, data-open="true" to open it on page load.

2. Inline block

The avatar fills any element you choose. Give the element a size.

<div data-talking-avatar="AVATAR_ID" data-key="SITE_KEY"
     data-greeting="Hi! Ask me anything about our store."
     style="width:380px;height:560px;border-radius:20px;overflow:hidden"></div>
<script src="https://mavatora.com/embed.js" async></script>

3. JavaScript (full control)

<script src="https://mavatora.com/embed.js"></script>
<script>
  const avatar = TalkingAvatar.mount({
    avatarId: "AVATAR_ID",
    key: "SITE_KEY",
    target: "#avatar",          // omit for a floating button
    greeting: "Hi! How can I help you today?",
    rules: "You are the assistant of Acme Store. Answer only about our products.",
    context: "Opening hours: Mon–Fri 9–18. Free delivery over $50.",
    lang: "English"
  });
  avatar.on("live", active => console.log("conversation", active));
</script>

Works with any site: plain HTML, WordPress (Custom HTML block or footer scripts), Shopify (theme.liquid), Webflow, Wix, Tilda, React, Vue, Next.js.

React

useEffect(() => {
  const s = document.createElement("script");
  s.src = "https://mavatora.com/embed.js";
  s.onload = () => { ref.current = window.TalkingAvatar.mount({ avatarId, key, target: boxRef.current, rules }); };
  document.body.appendChild(s);
  return () => ref.current?.destroy();
}, []);

Options

OptionHTML attributeDescription
avatarIddata-avatar-id / data-talking-avatarAvatar ID from the studio. Optional — without it the first avatar enabled for the key is used.
keydata-keyYour site key. Required.
targetdata-targetCSS selector or element for an inline avatar. Omit for a floating button.
rulesdata-rulesInstructions for the avatar: role, what to talk about, what to avoid (up to 6,000 characters).
contextdata-contextFacts about your business the avatar can use: prices, hours, FAQ (up to 12,000 characters).
greetingdata-greetingFirst phrase of the conversation.
langdata-langDefault language: English, Russian, Ukrainian, Spanish, Portuguese, German, French… The avatar still follows the visitor's language.
backgrounddata-backgroundstudio (default), transparent or a color like #ffffff.
positiondata-positionright (default) or left for the floating button.
labeldata-labelText next to the floating button. false hides it.
onEvent—(type, data) => {} — receives every event.

Rules & context

The avatar already has a face, voice and base character from the studio. Rules and context are added on top for your website only — you can use one avatar on several sites with different rules.

rules: `You are Anna, the online consultant of Acme Store.
- Answer only questions about our products, delivery and returns.
- If you don't know the answer, offer to connect the visitor with a manager.
- Never promise discounts.
- Keep answers to 1–3 sentences.`

Change rules at any time without reloading: avatar.setRules("..."), avatar.setContext("..."). New rules apply from the next conversation.

Rules live in your page code, so visitors can see them. Don't put secrets there.

Methods & events

MethodDescription
start()Start the conversation (opens the floating panel). The browser asks for the microphone.
stop()End the conversation.
ask(text)Send a text question; the avatar answers by voice.
setRules(text) · setContext(text) · setGreeting(text)Update instructions.
open() · close()Show or hide the floating panel.
isLive()true while a conversation is active.
destroy()Remove the avatar from the page.
EventData
readyThe avatar has loaded.
livetrue / false — conversation started or ended.
statusStatus text, e.g. “Connected. Speak — she is listening.”
error{ code, message } — see errors.
open · closeFloating panel shown or hidden.

The floating widget created from HTML attributes is available as TalkingAvatar.widget. Inline avatars from attributes are available as element.__talkingAvatar.

Security

Plans & limits

PlanAvatars via APIConversations / month
Free1100
Pro105,000
Business10050,000

One conversation = one press of “Talk” (up to 30 minutes). The counter resets on the 1st of each month. To change your plan, contact ceo@fitofan.com.

REST API

For custom players and mobile apps. All endpoints allow cross-origin requests.

GET /api/v1/avatar

GET https://mavatora.com/api/v1/avatar?id=AVATAR_ID&key=SITE_KEY

200 { "id": "…", "name": "Anna", "gender": "f", "layout": "mobile",
      "thumb": "https://…/thumb.jpg", "data": "https://…/data.json" }

POST /api/v1/session

Returns a one-time Gemini Live token for a voice conversation with this avatar. Counts as one conversation.

POST https://mavatora.com/api/v1/session
Content-Type: application/json

{ "avatar": "AVATAR_ID", "key": "SITE_KEY" }

200 { "token": "auth_tokens/…" }

The easiest custom integration is still the iframe the widget uses:

<iframe src="https://mavatora.com/embed.html?avatar=AVATAR_ID&key=SITE_KEY&lang=English"
        allow="microphone; autoplay" style="width:380px;height:560px;border:0"></iframe>

Control it with postMessage: {type:"avatar:start"}, {type:"avatar:stop"}, {type:"avatar:ask", text}, {type:"avatar:config", rules, context, greeting}. It sends back avatar:loaded, avatar:live, avatar:status, avatar:error.

Errors

CodeMeaning
invalid_keyThe key is wrong or was regenerated.
avatar_not_enabledTurn the avatar on in Developer API.
domain_not_allowedAdd this website to Allowed websites.
avatar_not_foundThe avatar was deleted.
limit_reachedMonthly conversation limit of your plan is reached.
voice_unavailableThe voice service is temporarily unavailable — try again.

FAQ

The microphone doesn't work

Your site must use https://. If you add the iframe yourself, keep allow="microphone; autoplay".

Can I use one avatar on several websites?

Yes. Add all domains to Allowed websites and give each site its own rules.

Does it work on mobile?

Yes. On phones the floating panel opens full screen.