All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Add draft support methods for retentions:
retentions.updateDraft,retentions.copyToDraft, andretentions.stampDraft.
- Expose structured API error metadata through
FacturapiError, includingstatus,code,path,location,errors,logId, and responseheaders.
- Add support for custom request headers through the
Facturapiconstructor options. - Add
receipts.toInvoiceto create customer invoices from multiple receipt keys. - Add
receipts.previewToInvoicePdfto generate PDF previews for to-invoice payloads.
- Add new export catalogs for customs regimes, transport keys, SCT permits, COFEPRIS sectors, pharmaceutical forms, special transport conditions, customs documents, transport types, transport figures, ISTMO registry, loading keys, maritime configurations, rail traffic, containers, rail cars, rail service types, transfer reasons, incoterms, and customs units.
- Expose the new enums on the
Facturapiclass as static getters for namespace-style access.
- Add
organizations.updateDefaultSeriesto set an organization default series by type.
- Return blob if content-type is octet-stream. This is the coverage for zip files
- Add
TaxFactor.EXENTO("Exento") to align SDK enums with the API/OpenAPI allowed tax factor values.
- Fix
organizations.checkDomainIsAvailableto callGET /organizations/domain-checkwith query params (instead of an unsupportedPUTpayload flow). - Align method input naming to query semantics for clearer usage (
query).
- Add
facturapi.comercioExteriorCatalogs.searchTariffFractionsmethod for Fracción Arancelaria SAT catalog - Add organization team/access management methods under
organizations:listTeamAccess,retrieveTeamAccess,removeTeamAccess,listSentTeamInvites,inviteUserToTeam,cancelTeamInvite,listReceivedTeamInvites,respondTeamInvite,listTeamRoles,listTeamRoleTemplates,listTeamRoleOperations,retrieveTeamRole,createTeamRole,updateTeamRole, anddeleteTeamRole. - Add typed responses and inputs for organization access, invites, and roles.
- Add automated test suites for Node runtime (
vitest), web-simulated runtime (vitest+jsdom), and browser smoke tests (playwright). - Add TypeScript contract tests with
tsdfor public SDK types. - Add CI workflow to run runtime tests, type tests, and browser smoke tests in GitHub Actions.
- Include
rfc_provider_certin stamp-related invoice typings and responses (thanks to @tetexxr).
- Use
PUTfor role reassignment/update methods:organizations.updateTeamAccessRoleandorganizations.updateTeamRole. - Use
Authorization: Bearer <apiKey>by default in SDK requests (API supports this scheme). - Improve cross-runtime compatibility through feature-detection based runtime handling and binary type normalization.
- Restrict npm published contents to runtime artifacts/docs (
dist,README,CHANGELOG,LICENSE) using a packagefileswhitelist. - Pin
npmto10.9.2in CI/deploy workflows for deterministic lockfile validation across Node versions.
- Improve non-OK HTTP error handling fallback when JSON error bodies are malformed or missing, returning clearer text/status errors.
- Handle
ReadableStreamread failures during binary download conversion to Node streams to avoid unhandled rejections. - Strengthen WebCrypto webhook signature validation by using
subtle.verifyand explicit hex signature validation. - Improve debugging for invalid upload inputs with clearer unsupported file type errors.
- Fix
organizations.uploadLogoandorganizations.uploadCertificatein Node.js 18 by avoidingFileconstructor usage during upload preparation.
- Update declared Node.js engine requirement to
>=18.0.0to match runtime dependencies.
- Add
CancellationStatus.VERIFYING("verifying") to support SAT cancellation requests in verification.
- Method of
retentions.cancelnow accept motive and substitution as in invoices cancellation method.
- Add new catalogs for cartaporte
searchAirTransportCodes,searchTransportConfigs,searchRightsOfPassage,searchCustomsDocuments,searchPackagingTypes,searchTrailerTypes,searchHazardousMaterials,searchNavalAuthorizations,searchPortStations,searchMarineContainers
- Add
invoices.previewPdfmethod to generate a preview PDF of an invoice before stamping it.
- Deprecate
Organization.planproperty.
- Add
add_onsproperty to the Organization type. - Add missing attributes to
Organization.customization.pdf_extra.
- Add
organizations.updateSelfInvoiceSettingsmethod to update self-invoice settings for the organization.
- Webhook validation. Now the signature is validated locally in Node and web environments (but not in React Native, where the API is still used).
- Type fixes for signature validation.
- Fix
organizations.uploadLogoandorganizations.uploadCertificatemethods to acceptBufferorReadableStreamas input in Node.js.
- Fix route for
customers.sendEditLinkByEmailmethod.
- Webhook events:
invoice.created_from_dashboardandcustomer.edit_link_completed
- Add
customers.sendEditLinkByEmailmethod to send an edit link to a customer via email.
- Allow creating edit links for customers, passing query params to create and edit customer methods.
- Edit link properties for customers.
- New fields for the Invoice object:
received_payment_idsandtarget_invoice_ids, used to track payments and PPD invoices.
- Added try/catch to conditional import and define "stream" as external.
- Fix conditional import on web environments.
- Fix bug in Node.js environment in which the library was not returning the right kind of stream on download methods.
- Fix bug in which body params were not being sent in the request.
- Compatibility with browser environments and React Native. Now you can use Facturapi in the browser or in React Native, as long as you have a Fetch API compatible environment.
- Types for webhooks responses.
- Add
organizations.memethod to get the organization information.
- Name of validateSignature parameter "signature".
- Add types for all method responses. Method parameters are still not typed.
- List Live Api Keys:
listLiveApiKeysfor organizations - Delete Live Api Keys:
deleteLiveApiKeyfor organizations - Validate webhooks responses:
validateSignaturefor webhooks
- Fix optional
paramsfor invoice
- Fix
organization.createSeriesGroupandorganization.updateSeriesGroup. Thanks to @pastine
- Methods for CRUD of series
- Create method for series:
organization.createSeriesGroup - Read method for your organization series:
organization.listSeriesGroup - Update method for an specific series:
organization.updateSeriesGroup - Delete method for an specific series:
organization.deleteSeriesGroup
- Remove deprecated method
products.keysin favor ofcatalogs.searchProducts. - Remove deprecated method
products.unitsin favor ofcatalogs.searchUnits. - Corrected the name of the method
invoices.editDrafttoinvoices.updateDraft. - The rest of the changes are internal and should not affect the public API.
- We rewrote the the library in TypeScript and now it's partially typed. Most request parameters and responses are not typed yet, but we plan to add more types in future releases.
- We export all type definitions, so you can use them in your TypeScript projects.
- New method to copy invoices to a new draft:
invoices.copyToDraft.
- New method to delete certificates from the organization:
organizations.deleteCertificate. - New query param
asyncin create invoice method:. - New methods for draft invoices:
invoices.editDraft,invoices.stampDraft. - New method to update invoice status with the latest value from the SAT:
invoices.updateStatus.
- Webhooks API
- Add
invoices.downloadCancellationReceiptPdf.
- Add
invoices.downloadCancellationReceiptXml,receipts.sendByEmailandreceipts.downloadPdf.
Note: Although this update includes a breaking change, only the minor version will be bumped, since we haven't officially announced the new API version yet.
- Remove
organizations.getApiKeys.
- Add
organizations.getTestApiKey,organizations.renewTestApiKeyandorganizations.renewLiveApiKey.
- Allow setting the API version in the client constructor.
- Change API version to point to /v2, in order to support CFDI 4.0
- Support sending params to
invoices.cancelmethod.
- Stop logging request config
- New endpoint:
tools.validateTaxId.
- Support for Retentions API
- Updated dependencies to address potential vulnerabilities.
- New method on receipts API:
createGlobalInvoice
facturapi.organizations.uploadCertificateonly acceptedFileStreams. Now it supports any kind of readableStream, as well asBuffer.
- Support for receipts API
- Edit organization's receipts settings
- Check domain availability
- Select organization's domain
- Use correct endpoint for
catalogs.searchProducts
- Catalogs API
- Search product keys using
catalogs.searchProducts. - Search unit keys using
catalogs.searchUnits.
- Search product keys using
- Updated all dependencies to clear security warnings
- Previously swallowing messages from non-axios errors
product.keysandproduct.unitsare deprecated in favor of the new catalogs API, and will be removed on the next major release.
- Now you must create the Facturapi instance using the
newkeyword every time.
Before:
// This was allowed
const facturapi = Facturapi('YOUR_API_KEY');Now:
// Now you must always use new
const facturapi = new Facturapi('YOUR_API_KEY');- Reject with an Error, not with an object
- Support Organizations API
- Search
product_keys usingfacturapi.products.keys('your search') - Search
unit_keys usingfacturapi.products.units('your search') - Constants for PaymentMethod, InvoiceType, InvoiceUse, InvoiceRelation
- Now contants should be accessed as static properties from the Facturapi class, instead of from the instance.
Before:
const facturapi = new Facturapi('YOUR_API_KEY');
console.log(facturapi.TaxType.IVA); // > IVANow:
console.log(Facturapi.TaxType.IVA); // > IVA- Protocol should be HTTPS
- First release
- Wrapper methods for:
- Customers
- Products
- Invoices
- Added README file