SDK · One script, no dependencies

ID verification SDK: drop the check into your site

Load ais.js, call AIS.mount() and the check appears in your page or in a modal. Copy-paste guides for every common website stack.

How it works

The SDK
<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>

Plain JavaScript, no dependencies, works in every modern browser. AIS.mount() needs one of two credentials:

CredentialWhere it comes fromBest for
clientToken (ais_ct_)Your server creates the check with POST /api/v1/verifications and passes client_token to the page. Valid 1 hour, one check only.Recommended. The check is tied to your customer record, with their name, email and metadata.
publishableKey (ais_pk_live_ / ais_pk_test_)Copied from API Keys in the dashboard and placed in the page.No back end (WordPress, Shopify, site builders). The check is anonymous, so pass your own reference.

On a computer, the customer can scan a QR code and finish on their phone. Your page still gets onComplete. Treat onComplete as a signal to refresh: confirm the result on your server with a webhook or GET /api/v1/verifications/{id} before acting on it. A publishable key or client token can never read results.

Allowed domains (required to embed)

The check only renders inside a page whose origin is listed under Developers, Allowed domains. Otherwise onError fires with origin_not_allowed. Changes take up to a minute to apply.

  • Use the exact origin: scheme, host and port, for example https://www.example.com.au.
  • https://*.example.com.au allows every subdomain.
  • http://localhost:3000 and http://127.0.0.1 are allowed for testing. Other origins must be https.
  • Up to 20 domains. Once you list any, publishable keys only start checks from those sites.

Plain HTML

With a client token (recommended)

index.html
<!-- Where the check appears -->
<div id="ais-verify"></div>

<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
<script>
  // 1. Ask YOUR server for a client token (see "Server side" below).
  fetch("/start-verification", { method: "POST" })
    .then(function (r) { return r.json(); })
    .then(function (data) {
      // 2. Mount the check with it. Never put a secret key in a web page.
      AIS.mount({
        clientToken: data.client_token,   // ais_ct_..., valid for 1 hour
        container: "#ais-verify",
        mode: "inline",                   // or "modal"
        onComplete: function (r) {
          // r = { id, status, result }. Confirm on your server before acting on it.
          window.location = "/verified?id=" + encodeURIComponent(r.id);
        },
        onError: function (e) { console.error(e.code, e.message); }
      });
    });
</script>

With a publishable key (no back end)

index.html
<!-- No back end needed: a publishable key starts an anonymous check -->
<div id="ais-verify"></div>

<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
<script>
  AIS.mount({
    publishableKey: "ais_pk_test_YOUR_TEST_PUBLISHABLE_KEY",  // example: use your own ais_pk_test_ / ais_pk_live_ key
    container: "#ais-verify",
    mode: "inline",
    reference: "order_1234",             // your own id, comes back in every webhook
    metadata: { source: "checkout" },    // optional string key/values
    onComplete: function (r) { console.log("Finished", r.id, r.status, r.result); },
    onError: function (e) { console.error(e.code, e.message); }
  });
</script>

As a modal

index.html
<button type="button" id="verify-btn">Verify my identity</button>

<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
<script>
  document.getElementById("verify-btn").addEventListener("click", function () {
    var handle = AIS.mount({
      publishableKey: "ais_pk_test_YOUR_TEST_PUBLISHABLE_KEY",  // example key
      mode: "modal",                       // opens over your page; no container needed
      onExit: function (e) { console.log("Closed", e.reason); },
      onComplete: function (r) { handle.destroy(); }
    });
  });
</script>

Server side: create the check and return a token

Your page calls a route on your own server. That route creates the verification with your secret key and returns only client_token. Set send_email: false because the check is shown in your page. If a token has expired before the customer starts, mint a new one for the same check with POST /api/v1/verifications/{id}/client_token.

server.mjs

// Node 18+ with Express. Keep the secret key in an environment variable.
import express from "express";

const app = express();
app.use(express.json());

// Your page calls this, then passes client_token to AIS.mount().
app.post("/start-verification", async (req, res) => {
  const user = req.user; // however your app knows who is signed in
  const r = await fetch("https://portal.australianidentitysolutions.com.au/api/v1/verifications", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.AIS_SECRET_KEY}`, // ais_test_... or ais_live_...
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      customer: { email: user.email, name: user.name },
      reference: String(user.id), // your own id, returned in every webhook
      send_email: false,          // the check is embedded, so don't email a link
    }),
  });
  const v = await r.json();
  if (!r.ok) return res.status(r.status).json({ error: v.error.message });

  // Save v.id against the user, then give the browser ONLY the client token.
  res.json({ client_token: v.client_token });
});

app.listen(3000);

Values such as the user's email, name and id are examples: use your own signed-in user.

React

Nothing to install from npm. Load the SDK script once, then mount it in an effect and destroy it on unmount.

VerifyIdentity.tsx
// VerifyIdentity.tsx. Load the SDK once, e.g. in index.html or your root layout:
// <script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
import { useEffect, useRef } from "react";

type AisResult = { id: string; status: string; result: "approved" | "declined" | null };
declare global {
  interface Window {
    AIS?: { mount: (opts: Record<string, unknown>) => { id: string | null; destroy: () => void } };
  }
}

export function VerifyIdentity({ clientToken, onDone }: { clientToken: string; onDone: (r: AisResult) => void }) {
  const box = useRef<HTMLDivElement>(null);

  useEffect(() => {
    if (!window.AIS || !box.current) return;
    const handle = window.AIS.mount({
      clientToken,              // from your server
      container: box.current,
      mode: "inline",
      onComplete: onDone,
      onError: (e: { code: string; message: string }) => console.error(e.code, e.message),
    });
    return () => handle.destroy(); // clean up on unmount
  }, [clientToken, onDone]);

  return <div ref={box} style={{ minHeight: 680 }} />;
}

Next.js (App Router)

Load the script with next/script, mount from a client component, and create the check in a route handler so the secret key stays on the server.

app/verify/page.tsx

// app/verify/page.tsx (Next.js App Router)
import Script from "next/script";
import { VerifyIdentity } from "./verify-identity";

export default function VerifyPage() {
  return (
    <>
      <Script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js" strategy="afterInteractive" />
      <VerifyIdentity />
    </>
  );
}

WordPress

Option 1: Custom HTML block (easiest)

Edit the page, add a Custom HTML block, paste this and update the page. Add your site to Allowed domains first.

Custom HTML block
<!-- WordPress: edit the page, add a "Custom HTML" block and paste this -->
<div id="ais-verify"></div>
<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
<script>
  AIS.mount({
    publishableKey: "ais_pk_live_YOUR_PUBLISHABLE_KEY",  // example: your ais_pk_live_ key
    container: "#ais-verify",
    mode: "inline"
  });
</script>

Option 2: a small shortcode plugin

Save this as wp-content/plugins/ais-verify/ais-verify.php, activate AIS Identity Verification under Plugins, then put [ais_verify] or [ais_verify mode="modal" reference="order_1234"] on any page.

ais-verify.php
<?php
/**
 * Plugin Name: AIS Identity Verification
 * Description: Adds the [ais_verify] shortcode. Example: [ais_verify mode="modal" reference="order_1234"]
 * Version: 1.0.0
 */
if (!defined('ABSPATH')) exit;

const AIS_PUBLISHABLE_KEY = 'ais_pk_live_YOUR_PUBLISHABLE_KEY'; // example: your ais_pk_live_ key

add_shortcode('ais_verify', function ($atts) {
    $a = shortcode_atts(['mode' => 'inline', 'reference' => ''], $atts);
    wp_enqueue_script('ais-sdk', 'https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js', [], null, true);

    $id  = 'ais-verify-' . wp_rand();
    $cfg = [
        'publishableKey' => AIS_PUBLISHABLE_KEY,
        'container'      => '#' . $id,
        'mode'           => $a['mode'] === 'modal' ? 'modal' : 'inline',
    ];
    if ($a['reference'] !== '') $cfg['reference'] = sanitize_text_field($a['reference']);
    wp_add_inline_script('ais-sdk', 'AIS.mount(' . wp_json_encode($cfg) . ');');

    return '<div id="' . esc_attr($id) . '"></div>';
});

Shopify, Wix and other site builders

Most builders have a box for custom code. Paste this into it, using your publishable key:

Embed code (paste into your builder)
<div id="ais-verify"></div>
<script src="https://portal.australianidentitysolutions.com.au/sdk/v1/ais.js"></script>
<script>
  AIS.mount({
    publishableKey: "ais_pk_live_YOUR_PUBLISHABLE_KEY",  // example: your ais_pk_live_ key
    container: "#ais-verify",
    mode: "inline"
  });
</script>
  • Shopify: Online Store, Themes, Customise, add a Custom Liquid section to the page and paste the code. Add your store domain (for example https://yourstore.myshopify.com and your custom domain) to Allowed domains.
  • Squarespace, Webflow and similar: use the page's Code block or Embed element.
  • Wix and builders that sandbox embeds: some builders run embed code inside their own frame on a different domain, which can block the camera or fail the Allowed domains check. Use the widget in redirect mode (below) there: it opens the check in a new tab. If you have listed Allowed domains, the domain the builder's frame runs on must be one of them.

No-code widget (Verify Identity button)

One script tag adds a styled Verify Identity button. It is built on the SDK and existing widget snippets keep working.

Modal (pop-up on your page)
<script
  src="https://portal.australianidentitysolutions.com.au/widget.js"
  data-key="ais_pk_live_YOUR_PUBLISHABLE_KEY"
  data-button-text="Verify Identity"
  data-button-color="#0e7c66"
  data-mode="modal"
  data-reference="order_1234">
</script>
Redirect (opens the check in a new tab)
<script
  src="https://portal.australianidentitysolutions.com.au/widget.js"
  data-key="ais_pk_live_YOUR_PUBLISHABLE_KEY"
  data-mode="redirect">
</script>
AttributeMeaning
data-keyYour publishable key (ais_pk_live_ or ais_pk_test_). Required.
data-modemodal (default, needs Allowed domains) or redirect (new tab).
data-button-textButton label. Default: Verify Identity.
data-button-colorHex colour, for example #0e7c66.
data-referenceYour own id for the check, returned in webhooks.

Options and modes

AIS.mount optionMeaning
clientTokenFrom your server (recommended). Starts with ais_ct_.
publishableKeyInstead of clientToken: creates an anonymous check from the browser.
mode"inline" (default) renders in container; "modal" opens over the page with a close button, backdrop click and Escape to close.
containerInline mode: an element or a CSS selector that exists on the page.
referencePublishable-key mode only: your own id (up to 200 characters). With a client token, set it on your server.
metadataPublishable-key mode only: up to 20 string key/values.
heightInline frame height, for example 720 or "720px". Default 680px; without it the frame resizes to fit (400 to 1400px).

AIS.mount() returns a handle: handle.id (the verification id once the check has loaded) and handle.destroy(), which removes the frame and stops listening. AIS.version gives the SDK version.

Callbacks

CallbackReceivesWhen
onReady{ id }The check has loaded in the frame.
onStarted{ id }The customer began (allowed the camera or moved to their phone).
onComplete{ id, status, result }The check reached completed, in_review, expired, abandoned or canceled. result is approved, declined or null. Fires once.
onExit{ id, reason }The customer left: reason is "closed" when they close the modal.
onError{ code, message }Something stopped the check from starting or running. See the codes below.

Error codes

codeMeaning and fix
origin_not_allowedThis website is not in Allowed domains. Add its exact origin in the dashboard.
invalid_client_tokenThe token is malformed or has expired (1 hour). Create a new one on your server.
secret_key_in_browserA secret key (ais_live_ / ais_test_) was passed to the browser. Use a client token or publishable key, and revoke the exposed key now.
invalid_keypublishableKey does not start with ais_pk_.
missing_credentialsPass clientToken or publishableKey.
invalid_containerInline mode needs a container element or selector that exists.
insufficient_creditLive mode: the account's credit does not cover a new check.
rate_limitedToo many checks started from this key or visitor. Try again shortly.
network_error / timeoutThe browser could not reach the portal. Ask the customer to retry.
Browser endpoints have their own limit of 30 requests per minute (per account and mode, and per visitor IP for new checks), separate from the 100 per minute server API limit.