JavaScript Library Reference


The 23andMe JavaScript library enables web developers to embed 23andMe features on a third-party website. This library adds a single function named TTAM ("Twenty-Three And Me") to the global namespace. This function is initialized with the client_id from your dashboard, and returns an object that can render 23andMe content.

The latest version, 0.3, is available at https://api.23andme.com/res/js/ttam-0.3.js.

TTAM().connectButton()

This functionality enables a developer to include a "Connect with 23andMe" button for their web apps. You may use a link, or this branded, recognizable button. The developer provides the client_id and scopes for the authorization, and a button is loaded that lets a genotyped user click to authorize access to their data. Clicking the button will automatically show the authorization screen, and redirect to your client's redirect_uri.

<script src="https://api.23andme.com/res/js/ttam-0.3.js"></script>
<div id="wrapper">Button...</div>
<script>
    window.onload = function () {
        var ttam = TTAM('123456789abcdef0123456789abcdef0');
        ttam.connectButton('wrapper', ["basic", "rs1234"]);
    };
</script>

TTAM(client_id).connectButton(element_id, scopes);

element_id The id of the enclosing DOM element. This element's contents will be replaced by the button iframe.
scopes An array of scopes for which to authorize the user.