Tiime
SDK TypeScript

Vue d'ensemble

Intégrez Tiime dans vos applications TypeScript

Le SDK tiime-sdk permet d'intégrer l'API Tiime dans vos applications Node.js. Il fonctionne de manière autonome, sans le CLI.

Installation

Terminal
npm install tiime-sdk

Exemple rapide

app.ts
import { TiimeClient } from "tiime-sdk";

const client = new TiimeClient();

// Factures payees
const invoices = await client.invoices.list({ status: "paid" });

// Soldes bancaires
const balances = await client.bankAccounts.balance();

// Creer une facture
const created = await client.invoices.create({
  emission_date: "2026-03-01",
  client: { id: 100 },
  lines: [{
    description: "Prestation de conseil",
    quantity: 5,
    unit_amount: 800,
    vat_type: { code: "normal" },
    invoicing_unit: { id: 3, code: "day" },
  }],
  status: "draft",
});

Authentification

Le SDK resout l'authentification automatiquement. Trois modes sont supportes :

Terminal
export TIIME_EMAIL=vous@example.com
export TIIME_PASSWORD=votre-mot-de-passe
export TIIME_COMPANY_ID=12345
app.ts
const client = new TiimeClient(); // tout est resolu automatiquement
app.ts
const client = new TiimeClient({
  email: "vous@example.com",
  password: "votre-mot-de-passe",
  companyId: 12345,
});

Si tiime-cli est installe, le SDK utilise ses tokens automatiquement :

Terminal
tiime auth login && tiime company use --id 12345
app.ts
const client = new TiimeClient(); // utilise les tokens stockes par le CLI

Token direct

Vous pouvez aussi passer un access token via TIIME_ACCESS_TOKEN ou l'option tokens: { access_token, expires_at }.

Ressources disponibles

RessourceAccesMethodesDescription
Facturesclient.invoices8CRUD + envoi + PDF + duplication
Devisclient.quotations5CRUD + envoi + PDF
Clientsclient.clients4CRUD + recherche
Comptes bancairesclient.bankAccounts3Liste + details + soldes
Transactionsclient.bankTransactions6Liste + pagination auto + imputation
Notes de fraisclient.expenseReports3CRUD
Documentsclient.documents5Liste + categories + upload + download
Labelsclient.labels3Personnalises + standards + tags
Utilisateursclient.users3Profil + infos legales + settings
Entrepriseclient.company4Details + config + dashboard
Entreprisesclient.listCompanies()1Liste des entreprises du compte

Gestion des erreurs

errors.ts
import { TiimeClient, TiimeError } from "tiime-sdk";

try {
  const invoice = await client.invoices.get(99999);
} catch (error) {
  if (error instanceof TiimeError) {
    console.error(`Erreur ${error.status}: ${error.message}`);
    console.error(`Endpoint: ${error.endpoint}`);
  }
}

Retry automatique

Le SDK integre un retry avec backoff exponentiel sur les erreurs 429 (rate limit) et 5xx (erreurs serveur).

En savoir plus

On this page