facturas package exposes a small, stable public API covered by semantic versioning. Every method, type, and store constructor documented on this page will not change in a breaking way without a version bump. You can import from the package root facturas or from its named sub-paths — all of them are listed at the end of this page.
createArcaClient(options?)
The main factory function. Call it once at startup and reuse the returned ArcaClient instance throughout your application.
createArcaClient throws ArcaConfigurationError immediately.
Options
string
required
Your 11-digit CUIT (tax ID). Falls back to the
ARCA_TAX_ID environment variable.string
required
PEM-encoded ARCA/AFIP certificate issued for your CUIT. Falls back to
ARCA_CERTIFICATE_PEM. Treat this value as a secret.string
required
PEM-encoded private key matching the certificate above. Falls back to
ARCA_PRIVATE_KEY_PEM. Treat this value as a secret."test" | "production"
required
Target ARCA environment. Falls back to
ARCA_ENVIRONMENT. There is no default — the client throws if this is absent from both sources.number
default:"30000"
HTTP request timeout in milliseconds.
number
default:"0"
Number of additional transport-layer retry attempts. Retries apply only to
ArcaTransportError (connection failures, timeouts, non-XML HTTP error responses). SOAP faults and service-level errors are never retried automatically.number
default:"500"
Milliseconds to wait between transport retries.
ArcaLoggerConfig
Optional structured logger configuration. Pass
{ level: "debug" } to enable SOAP traces, WSAA login origin, and retry logs. Pass { disabled: true } to suppress all SDK output. Provide a custom sink via { level, log(level, message, ...args) { … } }. The default minimum level is warn. You can also set ARCA_LOG_LEVEL in the environment without touching code.ArcaStore
A unified durable store for WSAA session tickets and invoice/credit-note idempotency reservations. Providing a store enables durability across process restarts and serverless cold starts. See Store Constructors below.
ArcaWsaaSessionStore
An optional separate store used only for WSAA login tickets. Takes priority over
store for ticket management. Useful when you already have a shared cache and only want to persist auth tokens, not issuance reservations.ArcaClient Methods
issue(input, options?)
Derives the ARCA request, reserves the next voucher number, sends the authorization, and returns the fiscal outcome. On an indeterminate result (timeout, connection loss, inconclusive response), issue automatically looks up the voucher at ARCA before returning — so you never need to check manually on a subsequent call.
Promise<IssueOutcome>
IssueInput
required
High-level invoice descriptor. See the Invoices guide for the full field list.
"wsfe" | "wsmtxca"
default:"\"wsfe\""
Target service. Pass
"wsmtxca" to issue with full line-item detail via WSMTXCA.number
An externally reserved voucher number. When supplied,
issue skips the automatic getNextVoucherNumber call and uses this number instead.string
An application-level key that ties the operation to your store reservation. Replaying the same key with the same input recovers the previous result; replaying with a different input throws
ARCA_INPUT_IDEMPOTENCY_MISMATCH.string | number
CUIT of the taxpayer on whose behalf you are issuing (for multi-tenant integrations).
boolean
Discard the cached WSAA ticket and obtain a fresh one before this call.
boolean
Include the raw ARCA SOAP response on the returned outcome.
boolean
Include the exact
WsfeVoucherInput or WsmtxcaIssueRequest that was sent to ARCA on the returned outcome under sent.preview(input, options?)
Derives the ARCA request object that issue would send, without making any network calls or reserving a number. Use this to inspect the fiscal amounts, derived voucher type, and service-level payload before committing.
IssuePreview
recover(key)
Looks up a previously stored idempotency reservation by its key. Returns the stored record if it exists, or undefined if no reservation was found under that key.
Promise<…reservation | undefined>
issueCreditNote(input, options?)
Issues a credit note against a previously authorized voucher. Accepts the same options as issue.
Promise<IssueOutcome>
issueDebitNote(input, options?)
Issues a debit note against a previously authorized voucher. Accepts the same options as issue.
Returns: Promise<IssueOutcome>
previewCreditNote(input, options?)
Derives the ARCA request a credit note issuance would send, with no network calls.
Returns: IssuePreview
previewDebitNote(input, options?)
Derives the ARCA request a debit note issuance would send, with no network calls.
Returns: IssuePreview
arca.wsfe
The low-level WSFE service handle. Exposes raw ARCA methods including authorize, getNextVoucherNumber, getLastAuthorizedVoucher, lookupVoucher, and runtime catalog methods. See Exact Layer for the full surface.
arca.wsmtxca
The low-level WSMTXCA service handle. Same pattern as wsfe, adding full line-item encoding. See Exact Layer for details.
arca.padron
The Padrón service handle. Use it to look up taxpayer details or resolve a CUIT from a document number.
Padrón “not found” detection relies on SOAP fault message text from ARCA, which is less reliable than the code-based flows used by WSFE. Handle
null returns defensively.Store Constructors
All four store constructors are part of the public semver contract. Pass the result of any of them as thestore option to createArcaClient. A single store covers both WSAA session tickets and issuance idempotency reservations.
createPostgresStore(options)
Uses your application’s existing Postgres client. Compatible with Neon, Supabase Postgres, Vercel Postgres, pg, and postgres.
(text: string, params: unknown[]) => Promise<…>
required
A parameterized query function. Results can be an array of rows or an object
{ rows }. For the postgres package, adapt with sql.unsafe(text, params).string
default:"\"arca_store\""
Name of the table to use. Must be a simple SQL identifier (no schema prefix or quoting).
createRedisStore(redis, options?)
Wraps an ioredis or Upstash Redis client.
Use a durable Redis instance with no eviction on reservation keys. Neither adapter sets a TTL on reservation records.
createFileStore(directory)
Persists keys as individual files under directory. Suitable for single-server deployments with a private, durable volume.
0600; new directories are created with 0700. Keys are hashed to filenames. No process-level locking is provided.
createMemoryStore()
An in-process store for tests and examples. Does not survive process restarts and cannot coordinate across workers.
createPadronService(options)
Creates a Padrón service instance wired with the provided authentication and SOAP transport. In most applications you access Padrón directly via arca.padron, which is created automatically by createArcaClient. The standalone constructor is exported from facturas/padron for integration scenarios where you assemble the SDK’s internal modules yourself.
Returns: PadronService with getTaxpayerDetails(taxId) and getTaxIdByDocument(documentNumber).
Error Classes
All SDK errors extendArcaError and carry a stable code string. Import error classes from either facturas or facturas/errors.
Error class summary
Error class summary
isArcaAuthenticationError(error) as a type-narrowing predicate when you cannot use instanceof (for example, across module boundaries). Use toArcaSafeErrorMetadata(error) to extract a structured, loggable error summary that never includes raw credentials or request bodies.
Package Exports
Thefacturas package exposes the following named sub-paths. All of them are stable and covered by semver.
facturas
Main entry point.
createArcaClient, builder functions, error classes, store constructors, and all public types.facturas/errors
All error classes and predicate helpers in isolation. Useful for libraries that handle errors without importing the full client.
facturas/constants
ARCA reference data: voucher type codes, VAT rates, document types, currencies, and receiver conditions. See Constants.
facturas/types
All public TypeScript types without runtime code.
facturas/wsfe
createWsfeService and all WSFE-specific types. See Exact Layer.facturas/wsmtxca
createWsmtxcaService and all WSMTXCA-specific types. See Exact Layer.facturas/padron
createPadronService and Padrón result types.Internal SOAP, HTTP, and WSAA modules are not part of the semver contract and should not be imported directly. Stick to the sub-paths listed above.