Tax NigeriaTax Nigeria Docs
    Tax NigeriaTax Nigeria Docs
    Tax AssistantAPI ReferenceIntroductionQuickstartAuthenticationEmbeddable AI WidgetNigerian Tax Laws & 2026 ReformsErrors & Rate Limits

    Partner API

    Embeddable AI Widget

    Embed Tax Nigeria's intelligent tax assistant directly into any website, web portal, or SaaS application with a single script tag.

    Embeddable Tax Nigeria AI Widget

    The Tax Nigeria Chat Widget allows businesses, fintechs, payroll providers, and accounting firms to embed Nigeria's leading tax intelligence agent onto any web page or SaaS application.

    The widget is lightweight (under 15KB gzipped), requires zero third-party dependencies, runs asynchronously, and provides instant answers grounded in current Nigerian tax legislation (including the Nigeria Tax Act 2025/2026, CITA, PITA, VAT, and WHT regulations).

    Looking for an interactive playground? Test brand colors, positions, greetings, and starter questions live with our Interactive Widget Playground & Demo.


    Key Capabilities

    • Instant 1-Line Drop-In: Add a single <script> tag before your closing </body> tag to activate the assistant.
    • Dual Operation Pathways: Choose between instant Anonymous Drop-In (zero setup) or Registered Dashboard Widgets (domain-whitelisted with custom quotas).
    • Grounded Nigerian Tax Knowledge: Pre-trained and retrieval-augmented across Personal Income Tax (PAYE), Company Income Tax (CIT), Value Added Tax (VAT), and Withholding Tax (WHT).
    • Brand Customization: Customize primary brand colors, header titles, welcome greetings, and screen position (bottom-right or bottom-left).
    • Custom Starter Prompts: Guide your users with industry-specific starter questions (for Payroll, Fintech, Real Estate, or E-commerce).
    • Proactive Nudge Bubble: Automatically presents a non-intrusive floating speech bubble to invite visitor engagement.
    • Programmatic JavaScript API: Open, close, toggle, or update questions dynamically via window.TaxNGWidget.
    • Cross-Frame Lifecycle Events: Listen for load, expand, collapse, and theme changes via standard HTML5 window.addEventListener('message').

    Integration Modes: Anonymous vs Registered

    The Tax Nigeria Widget provides two distinct operating modes designed to balance frictionless testing with enterprise security:

    FeatureMode 1: Anonymous Drop-InMode 2: Registered Dashboard Widget
    Setup RequiredNone. Copy and paste script tag.1-minute registration in Settings.
    Widget IDNot neededdata-widget-id="wid_live_..."
    Domain LockingOpen (works on any website)Origin & Referer Whitelist (blocks unauthorized hotlinking)
    Visitor Daily QuotaFixed at 5 questions / visitor / dayConfigurable (15 to 100 questions / visitor / day)
    Appearance ManagementStatic HTML data-* attributesRemote Dashboard Studio (updates live without redeploying)
    Query TelemetryLocal to visitor browserAggregated query counters in your dashboard
    Best ForPrototypes, staging, internal wikisProduction SaaS, fintech apps, company portals

    Mode 1: Anonymous Drop-In (Zero Setup)

    The Anonymous Drop-In mode is the fastest way to get started. You do not need to register an account or configure any backend credentials.

    How It Works

    • Add the public script tag to your web page HTML.
    • Your visitors receive 5 free tax calculations and legal queries per 24 hours (tracked fairly per visitor IP and device).
    • Configure branding, titles, and starter questions statically using HTML data-* attributes.

    Code Examples (Mode 1)

    <!-- Place before closing </body> tag -->
    <script 
      src="https://taxnigeria.ng/widget/taxng-widget.js" 
      data-position="bottom-right" 
      data-primary-color="#066738"
      data-title="Tax Nigeria Assistant"
      data-greeting="Hello! Ask any question regarding PAYE, CIT, or VAT."
      data-nudge="true"
    ></script>

    Mode 2: Registered Dashboard Widget (Domain-Protected)

    Mode 2 is recommended for all production websites, client portals, and SaaS platforms. It attaches your unique data-widget-id to protect your platform against unauthorized embedding and provides deep control over styling and visitor limits.

    Why Register Your Widget?

    1. Domain Whitelisting (Anti-Hotlinking): Only authorized domains (e.g. acmepayroll.ng, app.mycompany.com, localhost:3000) can initialize your widget. Unauthorized third parties attempting to copy your embed tag onto their own websites will receive HTTP 403 Forbidden.
    2. Higher Visitor Allowances: Increase the daily visitor question limit from the default 5 up to 100 questions per visitor per day.
    3. Live Remote Styling: Change brand colors, titles, greetings, launcher position, and starter prompts directly in your dashboard without touching your codebase or deploying changes.
    4. Instant Pause / Resume: Deactivate a live widget immediately from your dashboard if needed.

    Registration Steps

    Open Settings in Tax Nigeria

    Log in to your Tax Nigeria Workspace, click Settings in the sidebar, and select Embeddable Widgets.

    Click Register Widget

    Click the + Register Widget button to launch the Widget Studio.

    Configure Security & Brand Appearance

    • Widget Name: Give your widget an identifiable label (e.g. "Main Marketing Portal" or "Payroll App").
    • Allowed Domains: Enter your production domains, staging domains, and localhost:3000 (one per line). Subdomains and wildcards (*.yourcompany.com) are fully supported.
    • Daily Question Limit: Choose how many queries each visitor can ask per day (e.g. 15, 25, 50, or 100).
    • Brand Styling: Choose your brand color, position (bottom-right or bottom-left), welcome headline, and up to 6 custom starter questions.
    • On mobile devices, use the Live Preview toggle to inspect the exact look and feel before saving.

    Copy Your Embed Code

    Click Register Widget. Your unique data-widget-id (such as wid_live_8f3a9e12) will be generated. Copy the snippet and paste it into your application.

    Code Examples (Mode 2)

    <!-- Place before closing </body> tag -->
    <script 
      src="https://taxnigeria.ng/widget/taxng-widget.js" 
      data-widget-id="wid_live_8f3a9e12"
    ></script>

    HTML Data Attributes Reference

    When using Mode 1 (Anonymous) or overriding settings locally in Mode 2, use the following data-* attributes on the <script> tag:

    AttributeTypeDefaultDescription
    data-widget-idstring(Optional)Your registered widget ID (e.g. wid_live_...). Activates Mode 2 with domain security and remote styling.
    data-mode"chat" | "redirect""chat""chat" opens the embedded AI window. "redirect" opens data-redirect-url in a new browser tab upon click.
    data-position"bottom-right" | "bottom-left""bottom-right"Screen anchor location for the launcher button and chat window.
    data-primary-colorstring (hex)"#066738"Primary brand color applied to the floating button, send button, and accents.
    data-titlestring"Tax Nigeria Assistant"Title displayed in the chat window header.
    data-greetingstring""Welcome headline shown above starter questions on initial open.
    data-subtitlestring""Secondary description displayed directly below the greeting.
    data-starter-promptsJSON | string""List of starter questions. Supports JSON arrays or pipe-separated strings.
    data-nudge"true" | "false""true"Controls whether the proactive floating speech bubble appears next to the launcher button.
    data-nudge-textstring"Have questions on Nigerian tax? Ask here"Prompt text shown inside the floating nudge bubble.
    data-redirect-urlstring (URL)"https://taxnigeria.ng"Target destination URL when data-mode="redirect".
    data-z-indexstring | number"999999"Custom CSS z-index for the widget to ensure it floats above your site navigation.

    Custom Starter Prompts

    Starter prompts allow you to suggest relevant questions tailored to your user demographic. You can configure them in the dashboard (Mode 2) or supply them via script tag attributes (Mode 1).

    Option A: JSON Array Syntax

    <script 
      src="https://taxnigeria.ng/widget/taxng-widget.js"
      data-mode="chat"
      data-starter-prompts='[
        "What are the WHT rates on software contracts?",
        "How does VAT apply to digital services in Nigeria?",
        "Can you compute PAYE for remote staff in Lagos?"
      ]'
    ></script>

    Option B: Pipe-Separated Syntax

    <script 
      src="https://taxnigeria.ng/widget/taxng-widget.js"
      data-mode="chat"
      data-starter-prompts="What is Withholding Tax? | How do I register for VAT? | What are the 2026 PAYE bands?"
    ></script>

    JavaScript Programmatic API

    Control the widget from your own navigation bars, CTA buttons, or customer support links via the global window.TaxNGWidget object.

    MethodArgumentsDescription
    window.TaxNGWidget.open()NoneOpens the chat window and displays conversation history.
    window.TaxNGWidget.close()NoneCollapses and hides the chat modal.
    window.TaxNGWidget.toggle()NoneToggles the open / collapsed state.
    window.TaxNGWidget.setMode(mode)"chat" | "redirect"Dynamically switches click behavior between chat and external redirect.
    window.TaxNGWidget.setStarterPrompts(prompts)string[] | stringDynamically updates the starter questions without reloading the page.

    Example: Binding to a Custom Support Button

    // Attach to a custom "Ask Tax Specialist" button in your navbar
    document.getElementById('nav-tax-help-btn').addEventListener('click', () => {
      if (window.TaxNGWidget) {
        window.TaxNGWidget.setStarterPrompts([
          "Explain the tax deductions for this invoice",
          "What is the applicable VAT rate in Nigeria?",
          "How to remit withholding tax to FIRS"
        ]);
    
        window.TaxNGWidget.open();
      }
    });

    Cross-Frame Lifecycle Events (postMessage)

    The host page can listen for lifecycle events emitted by the embedded chat iframe using the standard HTML5 window.addEventListener('message') interface:

    window.addEventListener('message', (event) => {
      if (!event.data || typeof event.data !== 'object') return;
    
      switch (event.data.type) {
        case 'taxng-widget:ready':
          console.log('Tax Nigeria Widget is fully initialized and ready');
          break;
    
        case 'taxng-widget:close':
          console.log('User closed or collapsed the chat widget');
          break;
    
        case 'taxng-widget:expand':
          console.log('Widget expansion state changed:', event.data.expanded);
          break;
    
        case 'taxng-widget:theme-change':
          console.log('Widget theme switched to:', event.data.theme);
          break;
      }
    });

    Security & Domain Whitelisting

    Origin & Referer Verification

    In Mode 2, every configuration fetch and chat stream verifies the Origin and Referer request headers against your allowed domains list.

    • If a request originates from an unlisted website, the API responds with HTTP 403 and the widget displays a polite notice.
    • Whitelist patterns support exact root domains (acmepayroll.ng), explicit ports (localhost:3000), and wildcard subdomains (*.acmepayroll.ng).

    Content Security Policy (CSP)

    The widget endpoint transmits framing headers allowing embedding across all standard HTTPS origins:

    Content-Security-Policy: frame-ancestors 'self' * https: http:;

    Local Development Notice

    Modern web browsers enforce strict security policies for local file:/// URLs that prevent cross-origin iframe communication. When testing locally, always run a local HTTP development server (such as localhost:3000, npx serve, Vite, or VS Code Live Server) rather than opening HTML files directly from disk.

    Authentication

    Securely authenticate with the Tax Nigeria Partner API using scoped API keys.

    Nigerian Tax Laws & 2026 Reforms

    Comprehensive statutory overview of the Nigeria Tax Act 2025 (NTA) and Nigeria Tax Administration Act 2025 (NTAA), effective 1 January 2026.

    On this page

    Embeddable Tax Nigeria AI WidgetKey CapabilitiesIntegration Modes: Anonymous vs RegisteredMode 1: Anonymous Drop-In (Zero Setup)How It WorksCode Examples (Mode 1)Mode 2: Registered Dashboard Widget (Domain-Protected)Why Register Your Widget?Registration StepsOpen Settings in Tax NigeriaClick Register WidgetConfigure Security & Brand AppearanceCopy Your Embed CodeCode Examples (Mode 2)HTML Data Attributes ReferenceCustom Starter PromptsOption A: JSON Array SyntaxOption B: Pipe-Separated SyntaxJavaScript Programmatic APIExample: Binding to a Custom Support ButtonCross-Frame Lifecycle Events (postMessage)Security & Domain WhitelistingOrigin & Referer VerificationContent Security Policy (CSP)Local Development Notice