Sudrel API
Dashboard Create API key

Documentation › Tools

Guides

SDKs

TypeScript and PHP SDKs and what each one covers.

Official SDKs

Language Package Status
Node.js / TypeScript @sudrel/sdk (with the sudrel CLI) npm: npm install @sudrel/sdk
PHP 8.1+ sudrel/sdk Packagist: composer require sudrel/sdk

The API is plain REST and does not need an SDK. The Your first invoice guide has examples in curl, C# and Delphi, and Webhooks has signature verification in TypeScript, PHP, Python and C#. There is no SDK for C#, Delphi, Python or Ruby.

What each SDK covers

Feature TypeScript PHP No SDK (REST)
Issue, validate, query and list NFS-e Yes Yes Yes
Wait for the invoice to leave transmitindo Yes (nfse.esperar) Yes (esperar) Querying GET /v1/nfse/{id}
Cancel, confirm, XML, PDF Yes Yes Yes
Replace Through the substituicao block in emitir Through the substituicao block in emitir Yes
Batches: create (JSON or spreadsheet), query, items, issue, reprocess Yes Yes Yes
Batches: list and report Yes No Yes
Companies: list and readiness Yes Yes Yes
Companies: get details Yes No Yes
Companies: create, certificate, pause, resume, remove No No Yes
Webhooks: create, list, update, remove, rotate secret, test, deliveries, resend Yes Yes Yes
Webhooks: get one Yes No Yes
Verify the webhook signature Yes Yes Examples in Webhooks
Event log Yes Yes Yes
Received documents, account, usage, NBS, municipality parameters No No Yes

The SDKs generate and reuse the Idempotency-Key by themselves, follow the cursor pagination and also return the invoice when the Sistema Nacional NFS-e rejects it (the 422 with nfse).

TypeScript

import { Sudrel } from '@sudrel/sdk';

const sudrel = new Sudrel(); // lê SUDREL_API_KEY
const nota = await sudrel.nfse.emitir({
  empresa_id: process.env.EMPRESA!,
  referencia: 'PED-1001',
  tomador: { documento: '11222333000181' },
  valor: '1500.00',
  servico: { descricao: 'Consultoria em sistemas' },
});
console.log((await sudrel.nfse.esperar(nota.id!)).status);

The CLI in the same package forwards the account's events to a local receiver, signed like a real delivery, without exposing a port and without registering a webhook:

npx -p @sudrel/sdk sudrel eventos seguir --encaminhar http://localhost:3000/webhook