Prerequisites

  • Node.js 18+, Python 3.8+, or Go 1.19+
  • A backend server that can make HTTPS requests
  • Users with the AffirmID mobile app installed
01

Create an Account

Sign up for a free AffirmID developer account to get started.

Visit our signup page and create your developer account. You'll get immediate access to:

  • 10,000 free authentications/month
  • Full API access
  • Test environment
  • Developer dashboard
Create Free Account
02

Get Your API Key

Generate an API key from your dashboard to authenticate requests.

After signing in, navigate to Settings → API Keys in your dashboard and create a new key.

Important: Store your API key securely. It will only be shown once during creation. Never expose it in client-side code or public repositories.

AFFIRMID_API_KEY=affirmid_live_xxxxxxxxxxxxxxxx
03

Install the SDK

Add our official SDK to your project using your package manager.

Choose your preferred language and install the SDK:

# Node.js / TypeScript
npm install @affirmid/node
# Python
pip install affirmid
# Go
go get github.com/affirmid/affirmid-go
04

Make Your First Request

Initialize the client and create an authentication request.

Here's a complete example to send a push authentication request:

import { AffirmID } from '@affirmid/node';

// Initialize with your API key
const affirmid = new AffirmID({
  apiKey: process.env.AFFIRMID_API_KEY
});

// Create an authentication request
async function authenticateUser(userId: string, ip: string) {
  const request = await affirmid.auth.create({
    userId: userId,
    application: 'My App',
    ipAddress: ip,
    message: 'Login attempt from Chrome on Windows'
  });

  // Poll for the result (or use webhooks)
  const result = await affirmid.auth.waitForResult(request.id, {
    timeout: 60000 // 60 second timeout
  });

  return result.decision; // 'approved' | 'denied' | 'expired'
}