Quickstart SDK E-Factura

First API call

From zero to a confirmed invoice in SPV in under 30 minutes. This guide walks you through every step.

01
Get your API key
02
Install the SDK
03
Create your first invoice
04
Check SPV status
01

Get your API key

Go to app.billyou.ro/api and generate your API key. For development and testing, generate a sandbox key (prefix bly_test_). Live keys have the prefix bly_live_.

Never commit your API keys to version control. Use environment variables.
02

Install the SDK

Install the official Billyou SDK via your package manager. SDKs are available for Node.js, Python and PHP.

terminal
# npm
npm install billyou-sdk

# yarn
yarn add billyou-sdk

# pnpm
pnpm add billyou-sdk
03

Create your first invoice

Initialize the SDK with your API key and call invoices.create(). Setting spv: true will automatically submit the invoice to ANAF.

create-invoice.ts
import Billyou from 'billyou-sdk';

const billyou = Billyou.create({
  apiKey: 'bly_live_your_key_here',
});

const invoice = await billyou.invoices.create({
  client: {
    cui: 'RO12345678',
    name: 'Acme Solutions SRL',
  },
  items: [{
    name: 'Servicii software',
    quantity: 1,
    price: 1250.00,
    vatRate: 19,
  }],
  spv: true,
});

// invoice.id  - your invoice ID
// invoice.spvId - ANAF registration number
// invoice.status - 'confirmed' | 'pending' | 'error'
04

Check SPV status

ANAF processes invoices asynchronously, typically within 2-30 seconds. You can poll for the status or set up webhooks to receive real-time notifications.

check-status.ts
const status = await billyou.invoices.getStatus(
  invoice.id
);

// status.spvStatus - 'ok' | 'nok' | 'in_prelucrare'
// status.spvId    - ANAF registration number
// status.errors   - array of ANAF errors if rejected

Next steps