Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c8a449b
docs: align OpenAPI specifications with the public API
javorosas Sep 29, 2026
b719010
docs: add public documentation contribution guidelines
javorosas Sep 30, 2026
cc06191
docs: preserve SAT codes and clarify API contract details
javorosas Sep 30, 2026
e6f1774
docs: correct CommonJS installation examples
javorosas Sep 30, 2026
8d10536
docs: fix draft stamp nullability and validate webhook operation IDs
javorosas Sep 30, 2026
230ddda
docs: fix payment enum and draft UUID contracts
javorosas Sep 30, 2026
6cf4101
docs: align complement variants and response field contracts
javorosas Sep 30, 2026
d5bdd5c
docs: describe receipt invoice preview summaries
javorosas Sep 30, 2026
767c802
docs: align payment taxability codes
javorosas Sep 30, 2026
a460e03
docs: allow partial invoice preview inputs
javorosas Sep 30, 2026
22b515b
chore: update YAML parser security fixes
javorosas Sep 30, 2026
4bcb2b6
docs: refine CFDI and complement input relationships
javorosas Sep 30, 2026
4a6db95
docs: align optional invoice fields and single payment inputs
javorosas Sep 30, 2026
dc42f9d
docs: align draft customers and clarify webhook subscription values
javorosas Sep 30, 2026
b7063fb
docs: track and verify OpenAPI checksums
javorosas Oct 1, 2026
6c23055
docs: remove redundant OpenAPI checksum tracking
javorosas Oct 1, 2026
2aeefea
docs: define typed invoice creation responses
javorosas Oct 1, 2026
3e9c63c
docs: distinguish draft invoice creation variants
javorosas Oct 1, 2026
ce658ad
docs: select invoice drafts through status
javorosas Oct 1, 2026
2bde696
docs: place invoice status before conditional fields
javorosas Oct 1, 2026
572b621
docs: clarify accepted ISO date formats and correct descriptions
javorosas Oct 1, 2026
3e49b06
docs: improve API reference order and update renderer
javorosas Oct 1, 2026
7817b43
fix: align payment summaries and webhook contracts
javorosas Oct 1, 2026
d1bf2ba
docs: clarify download response objects and correct SDK examples
javorosas Oct 1, 2026
2c1330b
docs: describe incomplete customer input with edit links
javorosas Oct 1, 2026
8e70171
docs: align conditional customer, cancellation and global invoice inputs
javorosas Oct 1, 2026
d36d6e3
docs: preserve required values and field descriptions in input variants
javorosas Oct 1, 2026
469af3e
docs: correct nullable customer fields and edit link expiry
javorosas Oct 1, 2026
8674c3a
docs: correct partial product updates and SDK examples
javorosas Oct 2, 2026
8d2ac5f
docs: narrow binary downloads in Node examples
javorosas Oct 2, 2026
60c067a
docs: make binary and webhook examples type safe
javorosas Oct 2, 2026
1badb5a
docs: preserve required product creation fields
javorosas Oct 2, 2026
fa73952
docs: allow unvalidated customer timestamps to be null
javorosas Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: OpenAPI contract

on:
pull_request:
paths:
- website/openapi_v2*.yaml
- website/scripts/check-openapi.mjs
- website/test/openapi-types.fixture.txt
- website/package.json
- website/pnpm-lock.yaml
- website/pnpm-workspace.yaml
- .github/workflows/openapi.yml
push:
branches: [main]
workflow_dispatch:

jobs:
contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 11.5.1
- uses: actions/setup-node@v4
with:
node-version: 24.x
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
working-directory: website
- run: pnpm test:openapi
working-directory: website
28 changes: 28 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# AGENTS.md

## Public documentation and confidentiality

- This is a public repository. Publish only the intended public API contract and
information authorized for public documentation.
- Private sources may be consulted to verify API behavior. Never publish their
source code, internal file paths, commit hashes, implementation details,
private data, or internal plans in files, commit messages, pull requests,
review comments, issues, or CI output.
- Keep evidence from private sources in private files or repositories. Explain
public corrections in terms of observable API behavior without citing private
implementation sources.
- Keep PR titles and descriptions focused on the documentation change. Omit
unrelated internal plans and conversational context.
- Before committing or publishing, review the full diff, commit messages, and
accompanying descriptions for confidential information.
- If confidential information was published, a later deletion commit is not
sufficient. Clean affected branch history, verify remote references, and
explicitly report any host-side references or cached copies that remain.

## API contract changes

- Verify changes to types, required fields, defaults, authentication, parameters,
and status codes against authoritative sources. Do not treat an SDK declaration
or a review comment alone as proof of API behavior.
- Keep the Spanish and English OpenAPI contracts structurally aligned.
- Run the relevant repository checks for specification changes.
6 changes: 3 additions & 3 deletions website/docs/getting-started/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ Importa la librería antes de usarla.
<Tabs groupId="codeExamples">
<TabItem value="js" label="Node.js" default>

CommonJS
```javascript
import Facturapi from 'facturapi'
const Facturapi = require('facturapi');
```

ESM / Typescript
ESM / TypeScript

```javascript
import Facturapi from 'facturapi';
```
Expand Down
8 changes: 6 additions & 2 deletions website/docs/guides/invoices/cancelaciones.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,14 @@ import fs from 'node:fs';
const facturapi = new Facturapi('sk_test_API_KEY');

const xmlStream = await facturapi.invoices.downloadCancellationReceiptXml('58e93bd8e86eb318b019743d');
xmlStream.pipe(fs.createWriteStream('acuse_cancelacion.xml'));
if ('pipe' in xmlStream && typeof xmlStream.pipe === 'function') {
xmlStream.pipe(fs.createWriteStream('acuse_cancelacion.xml'));
}

const pdfStream = await facturapi.invoices.downloadCancellationReceiptPdf('58e93bd8e86eb318b019743d');
pdfStream.pipe(fs.createWriteStream('acuse_cancelacion.pdf'));
if ('pipe' in pdfStream && typeof pdfStream.pipe === 'function') {
pdfStream.pipe(fs.createWriteStream('acuse_cancelacion.pdf'));
}
```

</TabItem>
Expand Down
8 changes: 6 additions & 2 deletions website/docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,13 @@ import fs from 'fs';
const zipStream = await facturapi.invoices.downloadZip(invoice.id);
// Guarda la descarga en un archivo
const file = fs.createWriteStream('./factura.zip');
zipStream.pipe(file);
if ('pipe' in zipStream && typeof zipStream.pipe === 'function') {
zipStream.pipe(file);
}
// O envíalo como respuesta a tu cliente (en ExpressJS)
zipStream.pipe(res);
if ('pipe' in zipStream && typeof zipStream.pipe === 'function') {
zipStream.pipe(res);
}
```

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const darkCodeTheme = require("prism-react-renderer").themes.dracula;
},
options: {
disableSearch: true,
requiredPropsFirst: true,
sortRequiredPropsFirst: true,
noAutoAuth: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ Import the library before using it in your code.
<Tabs groupId="codeExamples">
<TabItem value="js" label="Node.js" default>

CommonJS
```javascript
import Facturapi from 'facturapi'
const Facturapi = require('facturapi');
```

ESM / Typescript
ESM / TypeScript

```javascript
import Facturapi from 'facturapi';
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ import fs from 'node:fs';
const facturapi = new Facturapi('sk_test_API_KEY');

const xmlStream = await facturapi.invoices.downloadCancellationReceiptXml('58e93bd8e86eb318b019743d');
xmlStream.pipe(fs.createWriteStream('cancellation_receipt.xml'));
if ('pipe' in xmlStream && typeof xmlStream.pipe === 'function') {
xmlStream.pipe(fs.createWriteStream('cancellation_receipt.xml'));
}

const pdfStream = await facturapi.invoices.downloadCancellationReceiptPdf('58e93bd8e86eb318b019743d');
pdfStream.pipe(fs.createWriteStream('cancellation_receipt.pdf'));
if ('pipe' in pdfStream && typeof pdfStream.pipe === 'function') {
pdfStream.pipe(fs.createWriteStream('cancellation_receipt.pdf'));
}
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ import fs from 'fs';
const zipStream = await facturapi.invoices.downloadZip(invoice.id);
// Save the downloaded file to disk
const file = fs.createWriteStream('./factura.zip');
zipStream.pipe(file);
if ('pipe' in zipStream && typeof zipStream.pipe === 'function') {
zipStream.pipe(file);
}
// Or send it as a response to your customer (ExpressJS syntax)
zipStream.pipe(res);
if ('pipe' in zipStream && typeof zipStream.pipe === 'function') {
zipStream.pipe(res);
}
```

</TabItem>
Expand Down
Loading
Loading