Documentation

Documentation

Authentication via messengers instead of SMS — no per-message costs. Every authenticated user becomes reachable for notifications by phone number through the same bots. The system picks the right messenger automatically; you control the priority.

Message API

Send notifications to users who logged in via your app. Use the per-application message_api_token from cabinet settings (header X-Authorization: token …).

Base URL

https://id.antirius.com

Send message

POST
/api/v1/message/send
Request
POST /api/v1/message/send
Content-Type: application/json
X-Authorization: token YOUR_MESSAGE_API_TOKEN

{
  "recipient": "+79001234567",
  "message": "Hello from API"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "platform": "telegram",
  "message_id": "123456",
  "sent_at": "2026-04-17T10:00:00.000Z",
  "correlation_id": "683f1a2b3c4d5e6f7a8b9c0d"
}

Auth sessions (widget / hosted login)

POST
/api/v1/auth/session

Create auth session

Request
POST /api/v1/auth/session
Content-Type: application/json
Origin: https://yoursite.com

{
  "app_id": "YOUR_APP_ID",
  "locale": "ru",
  "return_url": "https://yoursite.com/callback"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "session_id": "683f1a2b3c4d5e6f7a8b9c0d",
  "expires_at": "2026-05-13T11:00:00.000Z",
  "app_id": "YOUR_APP_ID",
  "redirect_url": "https://yoursite.com/callback",
  "display_order": ["telegram", "max", "whatsapp"],
  "links": {
    "telegram": "https://t.me/YourBot?start=683f1a2b...",
    "max": "https://max.me/YourBot?start=683f1a2b...",
    "whatsapp": "https://wa.me/1234567890?text=..."
  },
  "hosted_login_url": "https://id.antirius.com/login/YOUR_APP_ID"
}

Query parameter type

GET /api/v1/auth/session/{session_id} and GET /api/v1/widget/session/status accept type=status or type=full (default is full if omitted). issue_token=0 is a legacy alias for type=status.

FieldDescription
type=statusReturns status, messenger_opened, timestamps. No token, session not consumed. Unlimited polls.
type=fullOn confirmed: returns token, user, app_id. First successful full response marks the session used (token_consumed on later full polls).
GET
/api/v1/auth/session/:session_id?type=status

Check session status only (no JWT)

Request
GET /api/v1/auth/session/SESSION_ID?type=status

GET /api/v1/auth/session/SESSION_ID?type=status&poll=true
Response
HTTP/1.1 200 OK
Content-Type: application/json

// type=status — ожидание в мессенджере
{
  "status": "pending",
  "poll_type": "status",
  "messenger_opened": false,
  "created_at": "2026-05-13T10:55:00.000Z",
  "expires_at": "2026-05-13T11:00:00.000Z"
}

// type=status — пользователь открыл deeplink
{
  "status": "pending",
  "poll_type": "status",
  "messenger_opened": true,
  "messenger_opened_at": "2026-05-13T10:55:42.000Z"
}

// type=status — подтверждён (без JWT)
{
  "status": "confirmed",
  "poll_type": "status",
  "confirmed_at": "2026-05-13T10:56:30.000Z"
}

Response fields (type=status)

FieldDescription
status"pending", "confirmed", "expired", or "cancelled"
poll_type"status"
messenger_openedtrue after the user opened the deeplink in a messenger
messenger_opened_atISO 8601, when set
token_consumedtrue if a full request already consumed the session (informational only)
GET
/api/v1/auth/session/:session_id?type=full

Check session status (full — issues JWT)

Request
GET /api/v1/auth/session/SESSION_ID?type=full

GET /api/v1/auth/session/SESSION_ID?type=status&poll=true
Response
HTTP/1.1 200 OK
Content-Type: application/json

// type=full — первый запрос после confirmed (выдача JWT)
{
  "status": "confirmed",
  "poll_type": "full",
  "confirmed_at": "2026-05-13T10:56:30.000Z",
  "token": "eyJhbGciOiJSUzI1NiIs...",
  "user": {
    "_id": "507f1f77bcf86cd799439011",
    "user_id": "123456789",
    "type": "telegram",
    "first_name": "John",
    "last_name": "Doe",
    "username": "johndoe",
    "phone": "+79001234567"
  },
  "app_id": "YOUR_APP_ID",
  "expires_at": "2026-05-13T11:55:00.000Z"
}

Response fields (confirmed)

FieldDescription
status"confirmed"
tokenSigned JWT (RS256) — see the JWT Token section below for payload and verification
userUser object (see fields below)
app_idApplication ID
confirmed_atConfirmation time (ISO 8601)
expires_atToken expiration time (ISO 8601)

User object fields

FieldDescription
_idUser ID (24 hex chars)
user_idMessenger user ID
type"telegram", "max" or "whatsapp"
first_nameFirst name (from messenger profile at the time of auth, not stored)
last_nameLast name (from messenger profile, may be null)
usernameUsername (from messenger profile, may be null)
phonePhone number (e.g. "+79001234567")
Long polling

Use poll=true for long polling (server holds the connection up to 10 seconds). Prefer type=status for repeated polls; use type=full once when you need the JWT.

Request
async function waitForAuth(sessionId) {
  while (true) {
    const res = await fetch(
      `https://id.antirius.com/api/v1/auth/session/${sessionId}?type=status&poll=true`
    );
    const peek = await res.json();

    if (peek.status === 'confirmed') {
      const fullRes = await fetch(
        `https://id.antirius.com/api/v1/auth/session/${sessionId}?type=full`
      );
      return fullRes.json(); // { token, user, app_id }
    }
    if (peek.status === 'expired' || peek.status === 'cancelled') {
      throw new Error('Session ' + peek.status);
    }
  }
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

// type=full — первый запрос после confirmed (выдача JWT)
{
  "status": "confirmed",
  "poll_type": "full",
  "confirmed_at": "2026-05-13T10:56:30.000Z",
  "token": "eyJhbGciOiJSUzI1NiIs...",
  "user": {
    "_id": "507f1f77bcf86cd799439011",
    "user_id": "123456789",
    "type": "telegram",
    "first_name": "John",
    "last_name": "Doe",
    "username": "johndoe",
    "phone": "+79001234567"
  },
  "app_id": "YOUR_APP_ID",
  "expires_at": "2026-05-13T11:55:00.000Z"
}

Notes

  • The service does not store personal data (name, username). It works as a proxy: profile fields are taken directly from the messenger at the time of authentication and included in the response and JWT.
  • All IDs are 24-character hex strings.
  • Session expiry time is in the creation response (field "expires_at", ISO 8601).
  • Use poll=true for long polling (server holds the connection up to 10 seconds). Prefer type=status for repeated polls; use type=full once when you need the JWT.
  • Possible session statuses: "pending", "confirmed", "expired", "cancelled".