Quick Start

Get started with AffirmID in minutes. Install our SDK, configure your API key, and start sending authentication requests.

1. Get your API key

Create an API key in your dashboard under Settings → API Keys.

2. Install the SDK

npm install @affirmid/node

3. Send your first request

Use the example code to create an authentication request.

example.ts
// Initialize the AffirmID client
import { AffirmID } from '@affirmid/node';

const client = new AffirmID({
  apiKey: process.env.AFFIRMID_API_KEY
});

// Create an authentication request — this pushes to the
// user's registered devices
const authRequest = await client.auth.create({
  userId: 'user_123',
  context: {
    application: 'Acme App',
    ipAddress: req.ip,
  },
});

// Poll for the response, or use webhooks instead
const result = await client.auth.waitForResult(
  authRequest.id,
  { timeout: 60000 }
);

if (result.approved) {
  console.log('Authentication successful!');
}

Authentication

API Key Authentication

All API requests require authentication using an API key passed in theX-API-Key header.

curl -H "X-API-Key: your_api_key" https://api.affirmid.com/api/v1/mfa/user/:userId/status

Endpoints

POST/api/v1/mfa/verify/push

Send a push approval request and create an auth request

GET/api/v1/mfa/status/:requestId

Get the status of an authentication request

POST/api/v1/mfa/verify/totp

Verify a TOTP code

GET/api/v1/mfa/user/:userId/status

Check which factors a user has enrolled

POST/api/v1/identity/verify

Request identity verification

GET/api/v1/identity/status/:requestId

Get the status of an identity verification request

Official SDKs

Node.js

v1.0.0

Python

v1.0.0

Go

v1.0.0

Ruby

Coming soon

PHP

Coming soon

Java

Coming soon

Need help integrating?

Our developer support team is here to help you build secure authentication into your applications.