🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@frihet/sdk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frihet/sdk

Official Frihet SDK — AI-native business management API client

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
3
-75%
Maintainers
1
Weekly downloads
 
Created
Source

@frihet/sdk

Official TypeScript SDK for the Frihet API. AI-native business management.

Install

npm install @frihet/sdk

Quick start

import Frihet from '@frihet/sdk';

const frihet = new Frihet({ apiKey: 'fri_...' });

// Create an invoice
const invoice = await frihet.invoices.create({
  clientName: 'Acme Corp',
  items: [{ description: 'Consulting', quantity: 10, unitPrice: 150 }],
});

// List overdue invoices
const overdue = await frihet.invoices.list({ status: 'overdue' });

// Mark as paid
await frihet.invoices.markPaid(invoice.id);

// Send by email
await frihet.invoices.send(invoice.id, { recipientEmail: 'billing@acme.com' });

// Download PDF
const pdf = await frihet.invoices.pdf(invoice.id);

Resources

ResourceMethods
frihet.invoiceslist, retrieve, create, update, del, search, markPaid, send, pdf, createBatch
frihet.expenseslist, retrieve, create, update, del, search, createBatch
frihet.clientslist, retrieve, create, update, del, search
frihet.vendorslist, retrieve, create, update, del, search
frihet.productslist, retrieve, create, update, del, search
frihet.quoteslist, retrieve, create, update, del, search, send, pdf
frihet.webhookslist, retrieve, create, update, del
frihet.intelligencecontext, summary, monthly, quarterly

Intelligence

// Full business context (one call for AI agents)
const ctx = await frihet.intelligence.context();

// Monthly P&L with tax liability
const march = await frihet.intelligence.monthly('2026-03');

// Quarterly tax prep (Modelo 303/130)
const q1 = await frihet.intelligence.quarterly('2026-Q1');

// Financial summary with date range
const ytd = await frihet.intelligence.summary({ from: '2026-01-01', to: '2026-12-31' });

Error handling

import Frihet, { RateLimitError, NotFoundError, ValidationError } from '@frihet/sdk';

try {
  await frihet.invoices.retrieve('nonexistent');
} catch (err) {
  if (err instanceof NotFoundError) {
    console.log('Invoice not found');
  } else if (err instanceof RateLimitError) {
    console.log(`Retry after ${err.retryAfter}s`);
  } else if (err instanceof ValidationError) {
    console.log('Validation:', err.details);
  }
}

Webhook verification

import { Webhooks } from '@frihet/sdk';

const isValid = Webhooks.verifySignature(
  rawBody,
  req.headers['x-frihet-signature'],
  webhookSecret,
);

Configuration

const frihet = new Frihet({
  apiKey: 'fri_...',
  baseUrl: 'https://api.frihet.io/v1', // default
  timeout: 30000, // 30s default
});

// Per-request options
await frihet.invoices.create(data, {
  idempotencyKey: 'unique-key-123',
  timeout: 60000,
});

Features

  • Full TypeScript types with autocompletion
  • Automatic retry on rate limits (429) and server errors (5xx)
  • Exponential backoff with configurable retries
  • Idempotency key support for safe retries
  • Dual CJS/ESM output
  • Zero runtime dependencies
  • Request ID tracking on errors
  • HMAC webhook signature verification

License

MIT

Keywords

frihet

FAQs

Package last updated on 21 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts