Quickstart

Get started with Lexiso in under 5 minutes. This guide covers installation, authentication, and your first authorization request.

Installation

npm install lexiso

Initialize the Client

const { Lexiso } = require('lexiso');

const client = new Lexiso('sk_live_your_api_key');

Create an Agent

Agents represent AI systems that will make financial decisions on behalf of users.

const agent = await client.createAgent('My AI Assistant', 'openai');

console.log(agent.id); // agent_abc123

Create a Policy

Policies define spending limits and constraints for agents.

const policy = await client.createPolicy(
  agent.id,
  'Default Spending Policy',
  {
    amount_limits: {
      per_transaction: 100,
      daily: 500,
      monthly: 2000
    },
    allowed_categories: ['shopping', 'software', 'travel']
  }
);

Authorize a Transaction

Check if a transaction is allowed under the agent's policies.

const decision = await client.authorize(agent.id, 49.99, {
  merchant: 'Amazon',
  category: 'shopping'
});

if (decision.decision === 'allow') {
  // Proceed with payment
  console.log('Authorized:', decision.signature);
} else {
  // Handle denial
  console.log('Denied:', decision.reason);
}