Atenxion AI PlatformLearn how our product works
Atenxion Platform

Status Codes

Code

Description

200

Success

401

Unauthorized (missing token)

403

Forbidden (invalid token)

500

Server error

Available Endpoints

  • POST https://api-qa.brillar.ai/api/post-login/user-login - Authenticate users
  • POST https://api-qa.brillar.ai/api/post-login/new-transaction - Create a new transaction
  • POST https://api-qa.brillar.ai/api/post-login/user-logout - Log users out

Setup For Javascript

1. Install Required Package

npm install axios

2. Authentication

All API requests require a token in the Authorization header:

headers: {
  Authorization: `${token}`
}

API Implementation

1. User Login

import axios from 'axios';

const SERVER_URL = 'https://api-qa.brillar.ai'; 

async function loginUser(credentials) {
  try {
    const response = await axios.post(`${SERVER_URL}/api/post-login/user-login`, 
    {
        userId: credentials.userId,
        data:{
	        "employeeId":"4243234"
        }
    },
	{
	    headers: { Authorization: `${token}` }
	} 
   );
    return true; 
  } catch (error) {
    console.error('Login failed:', error.response?.data || error.message);
    throw error;
  }
}

2. Create Transaction

async function createTransaction(credentials,transactionData, token) {
  try {
    const response = await axios.post(
      `${SERVER_URL}/api/post-login/new-transaction`,
      {
        userId: credentials.userId,
        agentId: credentials.agentId,
        transaction: transactionData
      },
      {
        headers: { Authorization: `Bearer ${token}` }
      }
    );
    return true; 
  } catch (error) {
    console.error('Transaction failed:', error.response?.data || error.message);
    throw error;
  }
}

3. User Logout

async function logoutUser(userData, token) {
  try {
    await axios.post(
      `${SERVER_URL}/api/post-login/user-logout`,
      {
        userId: userData.userId,
        agentId: userData.agentId
      },
      {
        headers: { Authorization: `${token}` }
      }
    );
    
    return true; 
  } catch (error) {
    console.error('Logout failed:', error.response?.data || error.message);
    throw error;
  }
}

Setup For Python

1. Install Required Package

pip install requests

2. Authentication

All API requests require a token in the Authorization header:

headers = {
    "Authorization": f"{token}"
}

API Implementation

1. User Login

import requests

SERVER_URL = 'https://api-qa.brillar.ai'

def login_user(credentials, token):
    try:
        response = requests.post(
            f"{SERVER_URL}/api/post-login/user-login",
            json={
                "userId": credentials["userId"],
                "agentId": credentials["agentId"]
            },
            headers={
                "Authorization": f"Bearer {token}"
            }
        )
        response.raise_for_status()
        return True
    except requests.exceptions.HTTPError as err:
        print("Login failed:", err.response.text)
        raise

2. Create Transaction

def create_transaction(credentials, transaction_data, token):
    try:
        response = requests.post(
            f"{SERVER_URL}/api/post-login/new-transaction",
            json={
                "userId": credentials["userId"],
                "agentId": credentials["agentId"],
                "transaction": transaction_data
            },
            headers={
                "Authorization": f"Bearer {token}"
            }
        )
        response.raise_for_status()
        return True
    except requests.exceptions.HTTPError as err:
        print("Transaction failed:", err.response.text)
        raise

3. User Logout

def logout_user(credentials, token):
    try:
        response = requests.post(
            f"{SERVER_URL}/api/post-login/user-logout",
            json={
                "userId": credentials["userId"],
                "agentId": credentials["agentId"]
            },
            headers={
                "Authorization": f"Bearer {token}"
            }
        )
        response.raise_for_status()
        return True
    except requests.exceptions.HTTPError as err:
        print("Logout failed:", err.response.text)
        raise